Maximo

 View Only
Expand all | Collapse all

OSLC JSON Rest API - Security

  • 1.  OSLC JSON Rest API - Security

    Posted Fri October 07, 2022 07:45 PM
    Hello,

    Can someone please explain or share some documentation on how the "security model" works with OSLC JSON Rest API? 

    We presently have a user that is placed in the "maxadmin" group (that have almost all the privileges). We created the APIKeys of that user and we are using those API keys for HTTP Get/Post requests for exchanging the data with other external applications. We were wondering to use another user  (from a different security group) that may have only "limited privileges". However, today I was surprised to see the following:

    1) We created a group that has "least privileges" (it does not have even read privilege for wotrack, asset etc.)
    2) We created a user that belongs to 1)
    3) We created the APIKeys for 2)
    4) Now we wanted to test the HTTP Get/Post using that the APIKeys generated in 3) to see whether the security model will restrict us or not.

    We were surprised to see that we were able to retrieve the data from almost all the object structures; we were infact able to perform HTTP Post to insert/update the rows in the underlying MBOs using those APIKeys. 

    How do we  control the access privs for this above? 

    We are also executing the automation scripts via HTTP Post using OSLC JSON Rest API. How do we control that as well?

    ------------------------------
    Pankaj Bhide
    Computer Systems Engineer
    Berkeley National Laboratory
    Berkeley CA
    ------------------------------



    #Maximo
    #MaximoIntegrationandScripting
    #AssetandFacilitiesManagement


  • 2.  RE: OSLC JSON Rest API - Security

    Posted Mon October 10, 2022 08:47 AM

    For object structures, long term you should look at enabling the system property mxe.int.enableosauth. This was disabled by default in upgraded environments and enabled by default in new instances, but I believe we're looking to enable it by default in all environments. Before you can enable this though, you need to go through and identify all object structures that you utilize and ensure that they have security configured in the Object Structures application. For example, MXASSET out of the box has no security configured (Authorization name is empty) which means that any authenticated user can utilize the object structure. 

    Utilizing the "Configure Object Structure Security" action, you can either tie the authorization name to an application (such as ASSET) or you can configure unique permissions for that object structure (which is what I would recommend). To configure unique security permissions for the object structure, check the "Use Object Structure for Authorization Name" checkbox in the dialog.


    If you enable the system property before configuring this on each of the object structures, those object structures will not be usable. This includes all integration methods (file, table, SOAP, REST, etc.) for all users (including MAXADMIN/MXINTADM). That's why it's very important you identify each object structure currently being used and ensure this is configured. This could impact third party mobility products as well. 

    If the automation scripts are actions on the object structure, you can secure them by tying an option name to the action. 

    If you're calling scripts using the script handler (/maximo/oslc/script or /maximo/api/script) then it's not well documented but there are ways to secure it. The first is you can tie an application & option to the script route handler (using the Add/Modify API Routes dialog in the Object Structures application). This blocks any user from calling a script that doesn't have the permission defined. Most users don't need to call automation scripts via the REST API so this alone may be sufficient.

    If you need more granular permission control (IE you can run script A but not script B), on the scripts you can add two variables (authapp & authsigoption). This will check these permissions for this specific automation script. If you don't have these variables, any user can use them. 



    ------------------------------
    Steven Shull
    ------------------------------



  • 3.  RE: OSLC JSON Rest API - Security

    Posted Mon October 10, 2022 11:40 AM
    Thanks Steve for taking time in documenting this. We will study your notes and we will work on it. Once again thanks.

    ------------------------------
    Pankaj Bhide
    Computer Systems Engineer
    Berkeley National Laboratory
    Berkeley CA
    ------------------------------



  • 4.  RE: OSLC JSON Rest API - Security

    Posted Tue February 21, 2023 04:28 AM

    And what about the security of MBO querying via REST?



    ------------------------------
    Andrey Ilinskiy
    ------------------------------



  • 5.  RE: OSLC JSON Rest API - Security

    Posted Tue February 21, 2023 07:10 AM

    The new JSON API doesn't allow you to access MBOs directly outside of an object structure though it does allow you to retrieve data through relationships. I don't believe there is something available today for restricting relationships (I'd recommend opening an idea here: https://ibm-ai-apps.ideas.ibm.com/ideas/)

    The legacy REST API where we did allow users to access MBOs directly, there is a way to configure security. You can block anyone from accessing certain MBOs by setting the mxe.rest.mbo.blockaccess system property. For securing MBOs (not blocking), you can go to the Object Structures application and select the Object Application Authorization in the More Actions. This will allow you to set what access you need to utilize that specific MBO.



    ------------------------------
    Steven Shull
    ------------------------------



  • 6.  RE: OSLC JSON Rest API - Security

    Posted Tue February 21, 2023 07:21 AM

    And what about authorizing API-Routes? 

    Do we need to configure each object type for the route-separated security configuration?



    ------------------------------
    Andrey Ilinskiy
    ------------------------------



  • 7.  RE: OSLC JSON Rest API - Security

    Posted Tue February 21, 2023 07:32 AM

    You have to be careful here because our products depend on a lot of these to be accessible to any user. For example, we use whoami to get key information like the user's default insert site, their labor code, etc. If you add security around it and one of your users doesn't have access to their own information, our applications might fail. 

    Most of these need to be left without additional security constraints. A few like executing a script make sense adding security around. 



    ------------------------------
    Steven Shull
    ------------------------------



  • 8.  RE: OSLC JSON Rest API - Security

    Posted Tue February 21, 2023 07:25 AM

    I want just to add for all that Steven wrote, that there is property mxe.oslc.validusewith, where u can determinate what OS types can be used by OSLC handler. 

    For example, exclude REPORTS to have less work. 

    By the way, it will be interesting, why out of the box, REPORTS objects include here 

    Steven ? :-) 



    ------------------------------
    Andrey Ilinskiy
    ------------------------------



  • 9.  RE: OSLC JSON Rest API - Security

    Posted Tue February 21, 2023 07:34 AM

    The change to include ROS was related to the Business Analyst work center. It used report object structures for surfacing the data and downloading. This one caught me by surprise as well but it makes sense in that context. 



    ------------------------------
    Steven Shull
    ------------------------------



  • 10.  RE: OSLC JSON Rest API - Security

    Posted Sun March 03, 2024 10:07 AM
    Edited by Jason Pun Sun March 03, 2024 10:08 AM

    Hi Steven

    I am not very understanding how to configure which user have permission to the script, since it only configured two variables, but how the script determine it and how to graent access to users or security group, can you elaborate more on it.

    Thanks

    Jason




  • 11.  RE: OSLC JSON Rest API - Security

    Posted Sun March 03, 2024 04:30 PM

    I added this to the https://ibm-maximo-dev.github.io/maximo-autoscript-documentation/rest/scripthandler documentation a while ago but I don't think it addresses your question specifically.

    I think what you are asking is how two text variables gets evaluated to determine if the user has access. All permissions in Maximo are based on an "app" and option name. I wrapped app in quotes because we now often have object structures in addition to traditional applications in the MAXAPPS & SIGOPTION tables. The app in this context can be a classic application (such as WOTRACK) or an object structure (like MXAPIWODETAIL). 

    For simplicity, in case you aren't familiar with object structure security, let's assume you want to use the WOTRACK application to secure the automation script. The authapp variable would be set to WOTRACK.

    In Application Designer, open the application (WOTRACK in this example) and use the Add/Modify Signature Options menu action in the More Actions. These names in the "Option" column are all available to be used as the authsigoption. For example, I could use the APPLYRTE signature option. 



    If there isn't an appropriate option in this list, you can add a new option. 

    Then in the Security Groups application, you grant the necessary permission to the security group(s) you want to have access. Any users in a group with the permission will then be able to invoke the automation script. The script handler will evaluate the security permission automatically if those two variables exist. 


    It is worth noting that most automation scripts depend on implicit variables (such as mbo) and won't work if someone were to invoke the automation script through the REST API.  This is really for automation scripts you intend to be invoked via the REST API and want to restrict to a subset of users. 



    ------------------------------
    Steven Shull
    ------------------------------