mondoohq / cnquery

open source, cloud-native, graph-based asset inventory
https://cnquery.io
Other
323 stars 23 forks source link

containsNone function returns ERROR: tried to call function with a non-array, please make sure the argument is an array #2718

Open scottford-io opened 1 year ago

scottford-io commented 1 year ago

Describe the bug While writing a query against AWS IAM policy I ran into an error using containsNone:

cnquery> aws.iam.attachedPolicies.where( arn == "arn:aws:iam::aws:policy/PowerUserAccess" ) { defaultVersion.document.Statement { _["NotAction"].containsNone(/rds:\*/) }}
1 error occurred:
    * 1 error occurred:
    * tried to call function with a non-array, please make sure the argument is an array
aws.iam.attachedPolicies.where: [
  0: {
    defaultVersion.document.Statement: 1 error occurred:
    * tried to call function with a non-array, please make sure the argument is an array

  }
]

The NotAction policy element is an array:

cnquery> aws.iam.attachedPolicies.where( arn == "arn:aws:iam::aws:policy/PowerUserAccess" ) { defaultVersion.document.Statement { _["NotAction"] }}
aws.iam.attachedPolicies.where: [
  0: {
    defaultVersion.document.Statement: [
      0: {
        NotAction: [
          0: "iam:*"
          1: "organizations:*"
          2: "account:*"
        ]
      }
      1: {
        NotAction: null
      }
    ]
  }
]
mm-weber commented 9 months ago

This might already be fixed, can you still reproduce this @scottford-io ?