sailpoint-oss / sailpoint-cli

The SailPoint Command Line Interface (CLI) makes it easy to interact with SailPoint's SaaS Platform in a programmatic way. Many functions that use to be accomplished through tools like Postman or from custom scripts can now be done directly on the command line with minimal setup.
https://developer.sailpoint.com/discuss
MIT License
24 stars 19 forks source link

[Bug] Template based search doesn't included nested attributes #120

Closed rob-buskens-sp closed 1 year ago

rob-buskens-sp commented 1 year ago

Describe the bug sail search template {templateName} command is not returning all attributes nested under attributes.

To Reproduce

  1. Create a templates file and set it for the cli to use.

Replace Source Name and Attribute Name with values relevant to the test environment.

[
    {
      "name": "attrSync1",
      "description": "attr sync events",
      "variables": [],
      "searchQuery": {
        "indices": ["events"],
        "queryType": "SAILPOINT",
        "query": {
          "query": "attributes.interface:\"Attribute Sync\" AND attributes.sourceName:\"Source Name\" AND attributes.attributeName:\"Attribute Name\""
        },
        "includeNested": true
      }
    },
    {
        "name": "attrSync2",
        "description": "attr sync events",
        "variables": [],
        "searchQuery": {
          "indices": ["events"],
          "queryType": "SAILPOINT",
          "query": {
            "query": "attributes.interface:\"Attribute Sync\" AND attributes.sourceName:\"Source Name\" AND attributes.attributeName:\"Attribute Name\""
          },
          "includeNested": true,
          "queryResultFilter": {
              "includes": [
                    "action",
                    "type",
                    "actor.system",
                    "target.name",                    
                    "attributes.provisioningResult",
                    "attributes.operation",
                    "attributes.sourceName",
                    "attributes.accountName",
                    "attributes.attributeName",
                    "attributes.previousValue",
                    "attributes.attributeValue"
              ]
          }
        }
      }
  ]
  1. run sail search template attrSync1; or
  2. sail search template attrSync2

Expected behavior All nested attributes are returned (from a postman search)

[
    {
        "org": "none-sb",\
        "pod": "stg08-useast1",
        "created": "2023-11-18T03:18:35.447Z",
        "id": "4194f48a7c21780fc3f9bb60953d93b8e78b5fa167827656595f89d86bae050e",
        "action": "ModifyAccount",
        "type": "PROVISIONING",
        "actor": {
            "name": "System"
        },
        "target": {
            "name": "Homer Simpson"
        },
        "stack": "wps",
        "trackingNumber": "610441cb7b804d4f9c41454f1d23653e",
        "attributes": {
            "cloudAppName": "Source Name",
            "provisioningResult": "committed",
            "appId": "72b0c8c92c12483698627f1259c3ef3f",
            "accountUuid": "null",
            "operation": "Set",
            "previousValue": "IABCD",
            "sourceId": "source",
            "sourceName": "Source Name",
            "accountName": "IABCD",
            "interface": "Attribute Sync",
            "attributeName": "Attribute Name",
            "attributeValue": "ABCD"
        },
        "objects": [
            "ACCOUNT"
        ],
        "operation": "MODIFY",
        "status": "PASSED",
        "technicalName": "ACCOUNT_MODIFY_PASSED",
        "name": "Modify Account Passed",
        "synced": "2023-11-18T03:18:35.715Z",
        "_type": "event",
        "_version": "v7"
    }
]

Actual behavior The following is the output and only attributes.sourceName is included:

{  
    "id": "fb7e2b4e8ea5ca50bc9f68afda42aa960a7f22fc90134befd56eff0ee3149e09",
    "name": "Modify Account Passed",
    "_type": "PROVISIONING",
    "created": "2023-11-13T15:43:35.250Z",
    "synced": "2023-11-13T15:43:35.432Z",
    "action": "ModifyAccount",
    "type": "",
    "actor": {
      "name": "System"
    },
    "target": {
      "name": "Homer Simpson"
    },
    "stack": "wps",
    "trackingNumber": "2b33986fc12a4afeb514814cb89a45b0",
    "ipAddress": "",
    "details": "",
    "attributes": {
      "sourceName": "Source Name"
    },
    "objects": [
      "ACCOUNT"
    ],
    "operation": "MODIFY",
    "status": "PASSED",
    "technicalName": "ACCOUNT_MODIFY_PASSED"
  }

Screenshots If applicable, add screenshots to help explain your problem.

Operating System (please complete the following information):

Browser (please complete the following information):

Additional context

Default API behaviour for search is to return nested attributes None template search behaves the same way.

rob-buskens-sp commented 1 year ago

see https://github.com/sailpoint-oss/sailpoint-cli/issues/119 comment on why this is happening. probably don't need two bugs.