Prisma Cloud:IAM設定クエリを実行するためのAPI例外エラー
3019
Created On 04/24/24 18:53 PM - Last Modified 05/07/24 13:57 PM
Symptom
APIを使用して検索IAM構成クエリ(RQL)を投稿しようとすると、エラーメッセージが表示されます。
Environment
- Prisma Cloud IAMポリシー
- API エンドポイント
Cause
- Prisma Cloudは、クラウドリソースクエリとIAM設定クエリに異なるAPIエンドポイントを使用します。
Resolution
- cloud.resource クエリの場合、API エンドポイント
は {{api-endpoint}}/search/config
- になりますが、IAM 設定クエリの場合、API エンドポイントは
{{api-endpoint}}/iam/api/v4/search/permission になります。
Additional Information
- 次のリンクでは、IAM設定RQLクエリの詳細は説明されていません。
「Perform Config Search」
https://pan.dev/prisma-cloud/api/cspm/search-config/
Postman を使用した API 呼び出しの例:
- Cloud.resource RQL
POST: https://{{api-endpoint}}/search/config
Body:
{
"heuristicSearch": true,
"query": "config from cloud.resource where cloud.type = 'aws' AND api.name = 'aws-s3api-get-bucket-acl' AND json.rule = "acl.grantsAsList[?(@.grantee=='AllUsers')].permission contains ReadAcp or acl.grantsAsList[?(@.grantee=='AllUsers')].permission contains FullControl",
"timeRange": {
"type": "to_now",
"value": "epoch"
},
"limit": 100,
"withResourceJson": false
}
- IAM設定RQL
POST: https://{{api-endpoint}}/iam/api/v4/search/permission
Body:
{
"query": "config from iam where dest.cloud.type = 'AWS' and source.public = true AND dest.cloud.service.name = 's3' AND dest.cloud.resource.type = 'bucket' AND grantedby.cloud.policy.condition ( 'aws:SourceArn' ) does not exist AND grantedby.cloud.policy.condition ( 'aws:VpcSourceIp' ) does not exist AND grantedby.cloud.policy.condition ( 'aws:username' ) does not exist AND grantedby.cloud.policy.condition ( 'aws:userid' ) does not exist AND grantedby.cloud.policy.condition ( 'aws:ResourceAccount' ) does not exist"
}