<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: IAM PassRole RQL with Conditionals in Prisma Cloud Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/iam-passrole-rql-with-conditionals/m-p/509181#M530</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Miketobias,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the below query.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;config from cloud.resource where api.name = 'aws-iam-get-policy-version' AND json.rule = (policy.Statement[?any(Effect contains "Allow" and Resource equals * and Action equals iam:PassRole and (Condition does not exist))] exists )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps!!!&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jul 2022 16:16:28 GMT</pubDate>
    <dc:creator>SBatchu</dc:creator>
    <dc:date>2022-07-25T16:16:28Z</dc:date>
    <item>
      <title>IAM PassRole RQL with Conditionals</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/iam-passrole-rql-with-conditionals/m-p/413014#M384</link>
      <description>&lt;P&gt;Hello!&amp;nbsp; I'm attempting to write some RQL to detect policies with the following permissions and struggling a bit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Action: "iam:PassRole"&lt;/P&gt;&lt;P&gt;Effect: "Allow"&lt;/P&gt;&lt;P&gt;Resource: "*"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, in general this isn't too bad to figure out.&amp;nbsp; The RQL below accomplishes this nicely, BUT doesn't have any concept of if a Condition statement is present.&amp;nbsp; I care a bit less about a PassRole permission for an IAM policy that is scoped to the IAM service.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;config from cloud.resource where api.name = 'aws-iam-get-policy-version' AND json.rule = document.Statement[?(@.Action=='iam:PassRole' &amp;amp;&amp;amp; @.Effect=='Allow')].Resource equals "*"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;This is where I'm struggling, to get the above search to consider if a Condition statement exists and ignore the finding if a Condition exists.&amp;nbsp; I've tried a number of things, all which seem to pass the initial Investigate validator but break when actually run.&lt;BR /&gt;To be more clear I don't want the following policy to trigger this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"Action": "iam:PassRole",
"Effect": "Allow",
"Resource": "*",
"Condition": {
  "StringEquals": {
    "iam:PassedToService": "transfer.amazonaws.com"
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;config from cloud.resource where api.name = 'aws-iam-get-policy-version' AND json.rule = "document.Statement[?(@.Action=='iam:PassRole' &amp;amp;&amp;amp; @.Effect=='Allow' &amp;amp;&amp;amp; @.Resource=='*' &amp;amp;&amp;amp; @.Condition !exists)]" &lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;config from cloud.resource where api.name = 'aws-iam-get-policy-version' AND json.rule = "document.Statement[?(@.Action=='iam:PassRole' &amp;amp;&amp;amp; @.Effect=='Allow' &amp;amp;&amp;amp; @.Condition !exists)].Resource equals *" &lt;/LI-CODE&gt;&lt;P&gt;I think I'm just missing how to consider a potential Condition in the RQL, any thoughts?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 16:51:44 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/iam-passrole-rql-with-conditionals/m-p/413014#M384</guid>
      <dc:creator>miketobias</dc:creator>
      <dc:date>2021-06-14T16:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: IAM PassRole RQL with Conditionals</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/iam-passrole-rql-with-conditionals/m-p/509181#M530</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Miketobias,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the below query.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;config from cloud.resource where api.name = 'aws-iam-get-policy-version' AND json.rule = (policy.Statement[?any(Effect contains "Allow" and Resource equals * and Action equals iam:PassRole and (Condition does not exist))] exists )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps!!!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 16:16:28 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/iam-passrole-rql-with-conditionals/m-p/509181#M530</guid>
      <dc:creator>SBatchu</dc:creator>
      <dc:date>2022-07-25T16:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: IAM PassRole RQL with Conditionals</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/iam-passrole-rql-with-conditionals/m-p/509266#M532</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;config from cloud.resource where api.name = 'aws-iam-get-policy-version' AND json.rule = document.Statement[?(@.Action=='iam:PassRole' &amp;amp;&amp;amp; @.Effect=='Allow' &amp;amp;&amp;amp; @.Resource == '*' )] exists and document.Statement[*].Condition does not exist&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank You&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 09:52:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/iam-passrole-rql-with-conditionals/m-p/509266#M532</guid>
      <dc:creator>SBatchu</dc:creator>
      <dc:date>2022-07-19T09:52:15Z</dc:date>
    </item>
  </channel>
</rss>

