如何检查是否RQL配置的policy正确检测资源
9037
Created On 10/04/21 05:48 AM - Last Modified 01/31/23 00:22 AM
Objective
有一些情况RQL很长以至于很难一眼就明白所有的意思。
本文解释检查一个RQL在这种情况下逐步进行。
Environment
Prisma Cloud 企业版
Procedure
例子Policy:AWS SNS未配置安全数据传输的主题policy
RQL:
config from cloud.resource where cloud.type = 'aws' AND api.name = 'aws-sns-get-topic-attributes' AND json.rule = Policy.Statement[*].Condition.Bool.aws:SecureTransport does not exist or Policy.Statement[?any((Effect equals Allow and Action contains Publish and (Principal.AWS equals * or Principal equals *) and (Condition.Bool.aws:SecureTransport contains false or Condition.Bool.aws:SecureTransport contains FALSE)) or (Effect equals Deny and Action contains Publish and (Principal.AWS equals * or Principal equals *) and (Condition.Bool.aws:SecureTransport contains true or Condition.Bool.aws:SecureTransport contains TRUE)))] exists
示例目标资源:
[STEPS ]
1. 分解RQL由运算符转换为逻辑单元,例如AND,OR , 括号等
2.比较拆机的RQL以及每个单元的资源。
将上面的和下面的进行比较。 声明中没有条件。
因此,RQL这部分变成真的。
NOTE : 在以下示例中,结果将为 false,因为目标键存在。
3.合并单元并检查目标资源是否匹配policy.
结论:以上RQL返回真
4. 我们现在确认RQL正确匹配目标资源。
Additional Information
RQL 中使用的运算符在以下文档中进行了描述。
-RQL运营商
https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-rql-reference/rql-reference/operators.html