You are handed one record. It is an AssumeRoleWithWebIdentity event in a production AWS account, the role in it is named something like example-deploy-role, and the subject value starts with repo:. Somewhere in a GitHub organization you do not administer, a workflow job got an hour of credentials in your account. The ticket says “confirm scope.”
<p>You are handed one record. It is an <code class="language-plaintext highlighter-rouge">AssumeRoleWithWebIdentity</code> event in a production AWS account, the role in it is named something like <code class="language-plaintext highlighter-rouge">example-deploy-role</code>, and the subject value starts with <code class="language-plaintext highlighter-rouge">repo:</code>. Somewhere in a GitHub organization you do not administer, a workflow job got an hour of credentials in your account. The ticket says “confirm scope.”</p>
<p>Three questions follow, and they are not the same question: which GitHub execution obtained this session, why did AWS admit it, and what did it actually do? Each one is answered by different evidence, held in a different system, with different retention. Working them in order is most of the job, and most of the work is knowing exactly what each field means and where it stops meaning anything.</p>
<p>This walkthrough follows that path from the AWS side back to GitHub and forward again to resource activity. By the end you should be able to write a scope statement that separates what the records establish from what they merely suggest - the difference between a finding and a guess.</p>
<p><em>Editorial Note: every account number, role ID, access key label, repository, run number and timestamp below is invented for this article. Account <code class="language-plaintext highlighter-rouge">111122223333</code> and bucket <code class="language-plaintext highlighter-rouge">amzn-s3-demo-bucket</code> are AWS documentation placeholders, not claimed to be reserved or real. No AWS account, GitHub organization or token was queried, minted or decoded in writing it. The synthetic records are trimmed to an allowlist of investigative fields: illustrations of field semantics, not observed evidence of anything.</em></p>
<p><br /></p>
<p><strong>Start from a successful issuance, not from the event name</strong></p>
<p>An <code class="language-plaintext highlighter-rouge">eventName</code> of <code class="language-plaintext highlighter-rouge">AssumeRoleWithWebIdentity</code> tells you a request arrived. It does not tell you a session existed. The operation <a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html">returns a set of temporary security credentials</a> consisting of an access key ID, a secret access key and a security token, so the thing you need in front of you is the <em>response</em>, not just the request.</p>
<p>That is unusually available here. CloudTrail normally redacts <code class="language-plaintext highlighter-rouge">responseElements</code> for read-only operations, but the STS role-assumption operations are a documented exception: for <code class="language-plaintext highlighter-rouge">AssumeRole</code>, <code class="language-plaintext highlighter-rouge">AssumeRoleWithSAML</code> and <code class="language-plaintext highlighter-rouge">AssumeRoleWithWebIdentity</code>, <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html">CloudTrail includes the full <code class="language-plaintext highlighter-rouge">responseElements</code> except <code class="language-plaintext highlighter-rouge">secretAccessKey</code></a>. Read that twice before you export anything. The secret access key is excluded; the session token is not, and AWS’s own published example event shows a <code class="language-plaintext highlighter-rouge">sessionToken</code> placeholder in the response object. Treat the raw record as credential-bearing material, pull an allowlist of fields into your case notes, and leave the rest where it is.</p>
<p>Here is the shape of what you keep.</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"eventVersion"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.11"</span><span class="p">,</span><span class="w">
</span><span class="nl">"userIdentity"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"WebIdentityUser"</span><span class="p">,</span><span class="w">
</span><span class="nl">"principalId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"arn:aws:iam::111122223333:oidc-provider/token.actions.githubusercontent.com:sts.amazonaws.com:repo:example-org/example-repo:environment:prod"</span><span class="p">,</span><span class="w">
</span><span class="nl">"userName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"repo:example-org/example-repo:environment:prod"</span><span class="p">,</span><span class="w">
</span><span class="nl">"identityProvider"</span><span class="p">:</span><span class="w"> </span><span class="s2">"arn:aws:iam::111122223333:oidc-provider/token.actions.githubusercontent.com"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"eventTime"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-04-14T09:12:47Z"</span><span class="p">,</span><span class="w">
</span><span class="nl">"eventSource"</span><span class="p">:</span><span class="w"> </span><span class="s2">"sts.amazonaws.com"</span><span class="p">,</span><span class="w">
</span><span class="nl">"eventName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"AssumeRoleWithWebIdentity"</span><span class="p">,</span><span class="w">
</span><span class="nl">"awsRegion"</span><span class="p">:</span><span class="w"> </span><span class="s2">"us-west-2"</span><span class="p">,</span><span class="w">
</span><span class="nl">"requestParameters"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"roleArn"</span><span class="p">:</span><span class="w"> </span><span class="s2">"arn:aws:iam::111122223333:role/example-deploy-role"</span><span class="p">,</span><span class="w">
</span><span class="nl">"roleSessionName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"700001-2"</span><span class="p">,</span><span class="w">
</span><span class="nl">"durationSeconds"</span><span class="p">:</span><span class="w"> </span><span class="mi">3600</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"responseElements"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"credentials"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"accessKeyId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"SYNTHETIC_SESSION_KEY_01"</span><span class="p">,</span><span class="w">
</span><span class="nl">"expiration"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Apr 14, 2026, 10:12:47 AM"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"subjectFromWebIdentityToken"</span><span class="p">:</span><span class="w"> </span><span class="s2">"repo:example-org/example-repo:environment:prod"</span><span class="p">,</span><span class="w">
</span><span class="nl">"assumedRoleUser"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"assumedRoleId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"SYNTHETIC_ROLE_ID_01:700001-2"</span><span class="p">,</span><span class="w">
</span><span class="nl">"arn"</span><span class="p">:</span><span class="w"> </span><span class="s2">"arn:aws:sts::111122223333:assumed-role/example-deploy-role/700001-2"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"provider"</span><span class="p">:</span><span class="w"> </span><span class="s2">"arn:aws:iam::111122223333:oidc-provider/token.actions.githubusercontent.com"</span><span class="p">,</span><span class="w">
</span><span class="nl">"audience"</span><span class="p">:</span><span class="w"> </span><span class="s2">"sts.amazonaws.com"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"additionalEventData"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"identityProviderConnectionVerificationMethod"</span><span class="p">:</span><span class="w"> </span><span class="s2">"IAMTrustStore"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"eventID"</span><span class="p">:</span><span class="w"> </span><span class="s2">"00000000-0000-4000-8000-00000000f001"</span><span class="p">,</span><span class="w">
</span><span class="nl">"readOnly"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="nl">"eventType"</span><span class="p">:</span><span class="w"> </span><span class="s2">"AwsApiCall"</span><span class="p">,</span><span class="w">
</span><span class="nl">"managementEvent"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="nl">"recipientAccountId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"111122223333"</span><span class="p">,</span><span class="w">
</span><span class="nl">"eventCategory"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Management"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p><em>Editorial Note: synthetic and deliberately incomplete. The <code class="language-plaintext highlighter-rouge">secretAccessKey</code> and <code class="language-plaintext highlighter-rouge">sessionToken</code> fields are omitted rather than redacted, and <code class="language-plaintext highlighter-rouge">SYNTHETIC_SESSION_KEY_01</code> and <code class="language-plaintext highlighter-rouge">SYNTHETIC_ROLE_ID_01</code> are nonfunctional labels, not key-shaped strings.</em></p>
<p>Four fields carry most of the weight. <code class="language-plaintext highlighter-rouge">subjectFromWebIdentityToken</code> is, <a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html">for OpenID Connect ID tokens, the value the identity provider returned as the token’s <code class="language-plaintext highlighter-rouge">sub</code> claim</a> - that is your GitHub identity string. <code class="language-plaintext highlighter-rouge">audience</code> is <a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html">the intended audience, also known as client ID, of the web identity token</a>. <code class="language-plaintext highlighter-rouge">assumedRoleUser</code> gives you the session ARN and assumed role ID. <code class="language-plaintext highlighter-rouge">credentials.accessKeyId</code> is the key the session will sign with, and it is your join key for the next step.</p>
<p>Two temporal traps. CloudTrail’s <code class="language-plaintext highlighter-rouge">eventTime</code> is <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-record-contents.html">the date and time the request was completed, in coordinated universal time</a> - a completion stamp, not a start stamp, and the acquisition time of the credentials only in the loose sense. Record it separately from the time you pulled the record. And <code class="language-plaintext highlighter-rouge">eventID</code> is <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-record-contents.html">a GUID generated by CloudTrail to uniquely identify each event</a>. It identifies an event. It is not a session identifier, and there is no arithmetic that turns it into a GitHub run ID.</p>
<p>Note <code class="language-plaintext highlighter-rouge">provider</code> here. The STS API reference defines the response <code class="language-plaintext highlighter-rouge">Provider</code> as <a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html">the issuing authority of the web identity token, containing the value of the <code class="language-plaintext highlighter-rouge">iss</code> field for OpenID Connect ID tokens</a> - which would be the issuer URL. AWS’s own OIDC CloudTrail example instead shows <code class="language-plaintext highlighter-rouge">provider</code> holding an IAM OIDC-provider ARN, and <code class="language-plaintext highlighter-rouge">userIdentity.identityProvider</code> likewise, while the CloudTrail identity reference says that for a <code class="language-plaintext highlighter-rouge">WebIdentityUser</code> the <code class="language-plaintext highlighter-rouge">identityProvider</code> field <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html">is the issuer name of the web identity federation provider</a>. Those two representations do not agree, and I have not found a document that reconciles them. So do not hard-code an expected format: copy what your record contains, verbatim, and corroborate it against the account’s IAM OIDC provider objects. The <code class="language-plaintext highlighter-rouge">identityProviderConnectionVerificationMethod</code> value under <code class="language-plaintext highlighter-rouge">additionalEventData</code> is a useful companion - it records <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html">whether AWS verified the connection using its library of trusted root CAs (<code class="language-plaintext highlighter-rouge">IAMTrustStore</code>) or a configured certificate thumbprint (<code class="language-plaintext highlighter-rouge">Thumbprint</code>)</a>.</p>
<p>Finally, <code class="language-plaintext highlighter-rouge">readOnly</code> is <code class="language-plaintext highlighter-rouge">true</code> on this event, and it is worth saying what that does not mean. It classifies <em>this control-plane operation</em> as non-mutating. The credentials it handed out are a different thing, and every request made with them gets evaluated on its own against whatever policies applied at that moment - a later section’s problem. Do not filter STS issuance out of an investigation because a read-only flag made it look boring.</p>
<p><br /></p>
<p><strong>Join the session to downstream requests, and know when you cannot</strong></p>
<p>The strongest available link between issuance and use is the access key. In a CloudTrail <code class="language-plaintext highlighter-rouge">userIdentity</code>, <code class="language-plaintext highlighter-rouge">accessKeyId</code> is <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html">the access key ID that was used to sign the request, and for temporary credentials it is the access key ID of the temporary credentials</a>. So <code class="language-plaintext highlighter-rouge">responseElements.credentials.accessKeyId</code> from the issuance event should appear as <code class="language-plaintext highlighter-rouge">userIdentity.accessKeyId</code> on requests made with that session.</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"eventVersion"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.11"</span><span class="p">,</span><span class="w">
</span><span class="nl">"userIdentity"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"AssumedRole"</span><span class="p">,</span><span class="w">
</span><span class="nl">"principalId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"SYNTHETIC_ROLE_ID_01:700001-2"</span><span class="p">,</span><span class="w">
</span><span class="nl">"arn"</span><span class="p">:</span><span class="w"> </span><span class="s2">"arn:aws:sts::111122223333:assumed-role/example-deploy-role/700001-2"</span><span class="p">,</span><span class="w">
</span><span class="nl">"accountId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"111122223333"</span><span class="p">,</span><span class="w">
</span><span class="nl">"accessKeyId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"SYNTHETIC_SESSION_KEY_01"</span><span class="p">,</span><span class="w">
</span><span class="nl">"sessionContext"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"sessionIssuer"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Role"</span><span class="p">,</span><span class="w">
</span><span class="nl">"principalId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"SYNTHETIC_ROLE_ID_01"</span><span class="p">,</span><span class="w">
</span><span class="nl">"arn"</span><span class="p">:</span><span class="w"> </span><span class="s2">"arn:aws:iam::111122223333:role/example-deploy-role"</span><span class="p">,</span><span class="w">
</span><span class="nl">"accountId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"111122223333"</span><span class="p">,</span><span class="w">
</span><span class="nl">"userName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"example-deploy-role"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"webIdFederationData"</span><span class="p">:</span><span class="w"> </span><span class="p">{},</span><span class="w">
</span><span class="nl">"attributes"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"creationDate"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-04-14T09:12:47Z"</span><span class="p">,</span><span class="w">
</span><span class="nl">"mfaAuthenticated"</span><span class="p">:</span><span class="w"> </span><span class="s2">"false"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"eventTime"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-04-14T09:13:22Z"</span><span class="p">,</span><span class="w">
</span><span class="nl">"eventSource"</span><span class="p">:</span><span class="w"> </span><span class="s2">"s3.amazonaws.com"</span><span class="p">,</span><span class="w">
</span><span class="nl">"eventName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"PutObject"</span><span class="p">,</span><span class="w">
</span><span class="nl">"awsRegion"</span><span class="p">:</span><span class="w"> </span><span class="s2">"us-west-2"</span><span class="p">,</span><span class="w">
</span><span class="nl">"requestParameters"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"bucketName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"amzn-s3-demo-bucket"</span><span class="p">,</span><span class="w">
</span><span class="nl">"key"</span><span class="p">:</span><span class="w"> </span><span class="s2">"deploy/example.txt"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"responseElements"</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span><span class="w">
</span><span class="nl">"eventID"</span><span class="p">:</span><span class="w"> </span><span class="s2">"00000000-0000-4000-8000-00000000f002"</span><span class="p">,</span><span class="w">
</span><span class="nl">"readOnly"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"eventType"</span><span class="p">:</span><span class="w"> </span><span class="s2">"AwsApiCall"</span><span class="p">,</span><span class="w">
</span><span class="nl">"managementEvent"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"recipientAccountId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"111122223333"</span><span class="p">,</span><span class="w">
</span><span class="nl">"eventCategory"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Data"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>Three identifier checks sit alongside the key match, then one timing check that needs care. The session ARN matches <code class="language-plaintext highlighter-rouge">responseElements.assumedRoleUser.arn</code>. The <code class="language-plaintext highlighter-rouge">principalId</code> is the assumed role ID plus session name, matching <code class="language-plaintext highlighter-rouge">assumedRoleId</code>. <code class="language-plaintext highlighter-rouge">sessionContext.sessionIssuer</code> names the issuing role, with its own stable <code class="language-plaintext highlighter-rouge">principalId</code>, <code class="language-plaintext highlighter-rouge">arn</code> and <code class="language-plaintext highlighter-rouge">accountId</code>.</p>
<p>Then <code class="language-plaintext highlighter-rouge">sessionContext.attributes.creationDate</code>, which is <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html">the date and time when the temporary security credentials were issued</a>. Do not require it to equal the issuance record’s <code class="language-plaintext highlighter-rouge">eventTime</code>: they are not the same quantity, the other being <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-record-contents.html">the date and time the request was completed</a>. What you want is compatibility at the precision your records actually carry, with a <code class="language-plaintext highlighter-rouge">creationDate</code> at or just before the issuance <code class="language-plaintext highlighter-rouge">eventTime</code>. In the two synthetic records here they are byte-identical because I set them that way - a convenience of the example, not a matching rule to code against. A few seconds of daylight is not a reason to reject a join the access key already supports.</p>
<p>And none of these four are independent witnesses. They are fields AWS derived from one role assumption and carried into two records, so they corroborate the key match rather than replacing it.</p>
<p>Now the counterexamples, because this is where investigations quietly go wrong.</p>
<ul>
<li><strong>The issuance <code class="language-plaintext highlighter-rouge">principalId</code> is not the downstream <code class="language-plaintext highlighter-rouge">principalId</code>.</strong> On the STS event the identity type is <code class="language-plaintext highlighter-rouge">WebIdentityUser</code>, whose <code class="language-plaintext highlighter-rouge">principalId</code> is documented as <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html">a combination of the issuer, application ID, and user ID</a>. On the S3 event the type is <code class="language-plaintext highlighter-rouge">AssumedRole</code> and the <code class="language-plaintext highlighter-rouge">principalId</code> is the assumed role ID plus session name. Those are different namespaces; joining one to the other returns nothing.</li>
<li><strong>The access key can be absent.</strong> For security reasons <code class="language-plaintext highlighter-rouge">accessKeyId</code> <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html">might not be present, or might be displayed as an empty string</a>. When that happens you fall back to session ARN plus time window, which is weaker - say so rather than quietly promoting it to the same confidence.</li>
<li><strong>The session name is caller-controlled and reusable.</strong> <code class="language-plaintext highlighter-rouge">RoleSessionName</code> is simply <a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html">an identifier for the assumed role session</a> supplied by the requester, and it is what gets embedded in the ARN and assumed role ID. If two jobs in one run use the same name, the session ARNs are identical and only the access key and timestamps separate them.</li>
<li><strong>A credential match is not a person.</strong> For <code class="language-plaintext highlighter-rouge">AssumeRoleWithWebIdentity</code>, CloudTrail records the role’s subsequent API calls with <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html">role identity only, no user</a>. You have established which credential set signed the request; who or what drove it is a separate question, answered on the GitHub side and imperfectly.</li>
</ul>
<p>Bound the activity window with the issuance time and the expiration from the response, then look for anything signed by that key inside it. Session duration matters here: the default is <a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html">3600 seconds, and the ceiling is the role’s own maximum session duration setting, which can be one to twelve hours</a>.</p>
<p><br /></p>
<p><strong>Identify the GitHub run, attempt and job</strong></p>
<p>The subject in the record - <code class="language-plaintext highlighter-rouge">repo:example-org/example-repo:environment:prod</code> - tells you the repository and the job context. It does not tell you which run. For that you need GitHub-side evidence, and the fastest lead is the session name, if whoever built the workflow was thoughtful enough to make it mean something. In this case it is <code class="language-plaintext highlighter-rouge">700001-2</code>, which the workflow set from the run ID and attempt number. That is a lead, not proof; the value is caller-supplied.</p>
<p>Take the lead to the documented read routes. <code class="language-plaintext highlighter-rouge">GET /repos/{owner}/{repo}/actions/runs/{run_id}</code> <a href="https://docs.github.com/en/rest/actions/workflow-runs">gets a specific workflow run</a>, <code class="language-plaintext highlighter-rouge">GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}</code> <a href="https://docs.github.com/en/rest/actions/workflow-runs">gets a specific workflow run attempt</a>, and <code class="language-plaintext highlighter-rouge">GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs</code> <a href="https://docs.github.com/en/rest/actions/workflow-jobs">lists jobs for that attempt</a>. GitHub documents all three as usable by <a href="https://docs.github.com/en/rest/actions/workflow-runs">anyone with read access to the repository</a> - which is true, and is not the whole requirement. Against a private repository the same pages add that <a href="https://docs.github.com/en/rest/actions/workflow-jobs">OAuth app tokens and personal access tokens (classic) need the <code class="language-plaintext highlighter-rouge">repo</code> scope</a>. That sentence covers classic tokens; I haven’t verified the fine-grained-token requirements here. Confirm the requirements for your token type with whoever administers the organization before a case is on the clock.</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"run"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">700001</span><span class="p">,</span><span class="w">
</span><span class="nl">"run_attempt"</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
</span><span class="nl">"run_number"</span><span class="p">:</span><span class="w"> </span><span class="mi">184</span><span class="p">,</span><span class="w">
</span><span class="nl">"workflow_id"</span><span class="p">:</span><span class="w"> </span><span class="mi">4410077</span><span class="p">,</span><span class="w">
</span><span class="nl">"path"</span><span class="p">:</span><span class="w"> </span><span class="s2">".github/workflows/deploy.yml"</span><span class="p">,</span><span class="w">
</span><span class="nl">"event"</span><span class="p">:</span><span class="w"> </span><span class="s2">"push"</span><span class="p">,</span><span class="w">
</span><span class="nl">"head_branch"</span><span class="p">:</span><span class="w"> </span><span class="s2">"main"</span><span class="p">,</span><span class="w">
</span><span class="nl">"head_sha"</span><span class="p">:</span><span class="w"> </span><span class="s2">"9f1c2ad4e6b8c0d2f4a6b8c0d2e4f6a8b0c2d4e6"</span><span class="p">,</span><span class="w">
</span><span class="nl">"run_started_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-04-14T09:11:40Z"</span><span class="p">,</span><span class="w">
</span><span class="nl">"previous_attempt_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://api.github.com/repos/example-org/example-repo/actions/runs/700001/attempts/1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"actor"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"example-author"</span><span class="p">,</span><span class="w"> </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">500101</span><span class="w"> </span><span class="p">},</span><span class="w">
</span><span class="nl">"triggering_actor"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"example-releaser"</span><span class="p">,</span><span class="w"> </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">500102</span><span class="w"> </span><span class="p">},</span><span class="w">
</span><span class="nl">"referenced_workflows"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
</span><span class="nl">"repository"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">600200</span><span class="p">,</span><span class="w"> </span><span class="nl">"full_name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"example-org/example-repo"</span><span class="w"> </span><span class="p">}</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"job"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">9900012345</span><span class="p">,</span><span class="w">
</span><span class="nl">"run_id"</span><span class="p">:</span><span class="w"> </span><span class="mi">700001</span><span class="p">,</span><span class="w">
</span><span class="nl">"run_attempt"</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"publish"</span><span class="p">,</span><span class="w">
</span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"completed"</span><span class="p">,</span><span class="w">
</span><span class="nl">"conclusion"</span><span class="p">:</span><span class="w"> </span><span class="s2">"success"</span><span class="p">,</span><span class="w">
</span><span class="nl">"started_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-04-14T09:12:03Z"</span><span class="p">,</span><span class="w">
</span><span class="nl">"completed_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-04-14T09:13:51Z"</span><span class="p">,</span><span class="w">
</span><span class="nl">"runner_name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"GitHub Actions 42"</span><span class="p">,</span><span class="w">
</span><span class="nl">"head_branch"</span><span class="p">:</span><span class="w"> </span><span class="s2">"main"</span><span class="p">,</span><span class="w">
</span><span class="nl">"steps"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w"> </span><span class="nl">"number"</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"configure aws credentials"</span><span class="p">,</span><span class="w"> </span><span class="nl">"started_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-04-14T09:12:44Z"</span><span class="p">,</span><span class="w"> </span><span class="nl">"completed_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-04-14T09:12:49Z"</span><span class="w"> </span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w"> </span><span class="nl">"number"</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"upload build output"</span><span class="p">,</span><span class="w"> </span><span class="nl">"started_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-04-14T09:12:49Z"</span><span class="p">,</span><span class="w"> </span><span class="nl">"completed_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-04-14T09:13:40Z"</span><span class="w"> </span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p><em>Editorial Note: a synthetic composite of fields from two separate documented responses, trimmed to what the correlation needs. It is not a verbatim API response, and GitHub did not log any of it into CloudTrail - you gather it yourself and record that you did.</em></p>
<p>The correlation you are building is a timeline overlap, not a cryptographic binding. Step 2 ran from <code class="language-plaintext highlighter-rouge">09:12:44</code> to <code class="language-plaintext highlighter-rouge">09:12:49</code>; the STS issuance completed at <code class="language-plaintext highlighter-rouge">09:12:47</code>; the S3 write completed at <code class="language-plaintext highlighter-rouge">09:13:22</code>, inside step 3. Two AWS activity stamps, each landing inside the step that would have produced it - that is what you hoped for and worth writing down. The expiration at <code class="language-plaintext highlighter-rouge">10:12:47</code> is not a third one and does not fall inside the job at all; it is a lifetime bound that outlives the job by about an hour, which deserves its own line, because a credential that outlives the execution stays usable after it. Be careful how you describe the two that do fit. These are two systems each recording their own timestamps at their own precision, and unless you have established what time source both were using, containment is what you have - not agreement between synchronized clocks, and not independent confirmations of one fact. It stays circumstantial, and if a second job in the same window assumed the same role, you have two candidates and should report two.</p>
<p><br /></p>
<p><img width="1448" height="1086" alt="Forensic Cloud Credential Timeline" src="https://github.com/user-attachments/assets/7ef17c47-76f5-4e0d-b7b0-bbe2b0b3a3be" /></p>
<p><br /></p>
<p>Some identity semantics worth getting right before you write any of this down:</p>
<ul>
<li><strong>Re-runs keep the run ID.</strong> <code class="language-plaintext highlighter-rouge">github.run_id</code> is <a href="https://docs.github.com/en/actions/reference/workflows-and-actions/contexts">a unique number for each workflow run within a repository, and this number does not change if you re-run the workflow run</a>. <code class="language-plaintext highlighter-rouge">github.run_attempt</code> <a href="https://docs.github.com/en/actions/reference/workflows-and-actions/contexts">begins at 1 for the first attempt and increments with each re-run</a>. A run ID alone is therefore ambiguous across attempts, which is why the attempt-scoped job route exists.</li>
<li><strong>A run and attempt still are not one execution.</strong> The pair does not identify a single job, a single matrix leg, or a single STS call: a workflow can assume the same role from several jobs, and a job can assume it more than once. So enumerate the attempt’s job list completely before ruling any job out. It is paginated - <a href="https://docs.github.com/en/rest/actions/workflow-jobs">30 results per page by default, 100 maximum</a> - and the response carries a <code class="language-plaintext highlighter-rouge">total_count</code> to reconcile against the rows you collected. Excluding a competing candidate on the strength of page one is how the second candidate disappears from the report.</li>
<li><strong>The numeric job ID is not <code class="language-plaintext highlighter-rouge">github.job</code>.</strong> The REST <code class="language-plaintext highlighter-rouge">job.id</code> is an integer; <code class="language-plaintext highlighter-rouge">github.job</code> is the workflow’s job key, <code class="language-plaintext highlighter-rouge">publish</code> in this example. Keep both, and label them.</li>
<li><strong>Actor and triggering actor can differ, and the privilege story is counterintuitive.</strong> GitHub documents that <a href="https://docs.github.com/en/actions/reference/workflows-and-actions/contexts">re-runs use the privileges of <code class="language-plaintext highlighter-rouge">github.actor</code>, even if the actor initiating the re-run (<code class="language-plaintext highlighter-rouge">github.triggering_actor</code>) has different privileges</a>. That is GitHub execution context. It says nothing about AWS effective permissions, and neither login proves a human sat at a keyboard. Keep the numeric account IDs next to the logins, because logins are renameable.</li>
</ul>
<p>One more thing about that action’s retry behavior, because it produces a specific false lead. The pinned README for the AWS credentials action states that on a failed STS call it retries <a href="https://raw.githubusercontent.com/aws-actions/configure-aws-credentials/e3dd6a429d7300a6a4c196c26e071d42e0343502/README.md">with exponential backoff twelve times by default</a>, configurable through <code class="language-plaintext highlighter-rouge">retry-max-attempts</code> or disabled with <code class="language-plaintext highlighter-rouge">disable-retry</code>. So a cluster of STS records seconds apart has an innocent explanation available to it. Available is not the same as established: that explanation only holds if that action, at a revision carrying that behavior, is what actually ran, and it competes with a workflow that assumes the role repeatedly across jobs, steps or matrix legs.</p>
<p>What it does not compete with is credential reuse. Each <code class="language-plaintext highlighter-rouge">AssumeRoleWithWebIdentity</code> call requires another token presentation: the operation’s <code class="language-plaintext highlighter-rouge">WebIdentityToken</code> parameter - <a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html">the OAuth 2.0 access token or OpenID Connect ID token that is provided by the identity provider</a> - is required. Someone using credentials already issued produces downstream calls signed by that access key, not a second assumption. The record type narrows what happened; it still does not tell you who presented the token. Establish the executed revision and check <code class="language-plaintext highlighter-rouge">run_attempt</code> before you settle it either way. A retry story is a hypothesis you test, not a reason to stop counting.</p>
<p><br /></p>
<p><strong>Establish what executed, not what the branch says today</strong></p>
<p>The repository’s <code class="language-plaintext highlighter-rouge">main</code> branch as it stands right now is not evidence about April. Four different things are commonly confused here, and they answer four different questions.</p>
<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">name</span><span class="pi">:</span> <span class="s">deploy</span>
<span class="na">on</span><span class="pi">:</span>
<span class="na">push</span><span class="pi">:</span>
<span class="na">branches</span><span class="pi">:</span> <span class="pi">[</span><span class="nv">main</span><span class="pi">]</span>
<span class="na">permissions</span><span class="pi">:</span>
<span class="na">id-token</span><span class="pi">:</span> <span class="s">write</span>
<span class="na">contents</span><span class="pi">:</span> <span class="s">read</span>
<span class="na">jobs</span><span class="pi">:</span>
<span class="na">publish</span><span class="pi">:</span>
<span class="na">runs-on</span><span class="pi">:</span> <span class="s">ubuntu-latest</span>
<span class="na">environment</span><span class="pi">:</span> <span class="s">prod</span>
<span class="na">steps</span><span class="pi">:</span>
<span class="pi">-</span> <span class="na">uses</span><span class="pi">:</span> <span class="s">actions/checkout@v6</span>
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">configure aws credentials</span>
<span class="na">uses</span><span class="pi">:</span> <span class="s">aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502</span>
<span class="na">with</span><span class="pi">:</span>
<span class="na">role-to-assume</span><span class="pi">:</span> <span class="s">arn:aws:iam::111122223333:role/example-deploy-role</span>
<span class="na">role-session-name</span><span class="pi">:</span> <span class="s">$-$</span>
<span class="na">aws-region</span><span class="pi">:</span> <span class="s">us-west-2</span>
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">upload build output</span>
<span class="na">run</span><span class="pi">:</span> <span class="s">aws s3 cp ./build/example.txt s3://amzn-s3-demo-bucket/deploy/example.txt</span>
</code></pre></div></div>
<p><em>Editorial Note: an illustrative fragment showing the fields this investigation reads. It is not a deployment template and has not been executed. The pinned action commit is the one GitHub’s own AWS guide uses in its example workflow; inspecting that README is not an audit of the action’s compiled code.</em></p>
<p>The workflow definition’s own revision is <code class="language-plaintext highlighter-rouge">github.workflow_sha</code>, <a href="https://docs.github.com/en/actions/reference/workflows-and-actions/contexts">the commit SHA for the workflow file</a>. The triggering commit is <code class="language-plaintext highlighter-rouge">github.sha</code>, and GitHub is explicit that <a href="https://docs.github.com/en/actions/reference/workflows-and-actions/contexts">the value of this commit SHA depends on the event that triggered the workflow</a> - for an unmerged pull request the documented <code class="language-plaintext highlighter-rouge">ref</code> is a merge ref, and <code class="language-plaintext highlighter-rouge">pull_request_target</code> events carry <a href="https://docs.github.com/en/actions/reference/workflows-and-actions/contexts">the <code class="language-plaintext highlighter-rouge">ref</code> from the base branch</a>. What the job actually checked out is a third thing, decided by the checkout step. And the action revisions and any reusable workflows are a fourth; the run response carries <code class="language-plaintext highlighter-rouge">referenced_workflows</code> entries with their own <code class="language-plaintext highlighter-rouge">path</code>, <code class="language-plaintext highlighter-rouge">sha</code> and <code class="language-plaintext highlighter-rouge">ref</code> - exactly what you want when a caller workflow is doing the real work.</p>
<p>Be careful about promising yourself a field you may never have. <code class="language-plaintext highlighter-rouge">workflow_sha</code> is a documented context value and an <a href="https://docs.github.com/en/actions/reference/security/oidc">OIDC token claim</a>; it is not a documented member of the REST workflow run response schema, which carries <code class="language-plaintext highlighter-rouge">path</code>, <code class="language-plaintext highlighter-rouge">workflow_id</code> and <code class="language-plaintext highlighter-rouge">head_sha</code> instead. Get the definition’s revision from retained run evidence rather than assuming an API hands it over.</p>
<p>Tags are moving pointers. <code class="language-plaintext highlighter-rouge">actions/checkout@v6</code> is a tag, and resolving that tag today tells you what it points at today. The revision that ran in April has to come from evidence retained from April, and the attempt logs are the usual place to look: GitHub documents a <a href="https://docs.github.com/en/rest/actions/workflow-runs">redirect URL to download an archive of log files for a specific workflow run attempt</a>, and that link expires after one minute, so follow the redirect programmatically rather than pasting it into a browser tab you will get back to in a moment.</p>
<p>Two things that endpoint does not promise. It does not promise the logs are still there - retention is a separate setting, and <a href="https://docs.github.com/en/rest/actions/workflow-runs">deleting all logs for a workflow run</a> is its own documented route, so absence of logs is not evidence about what ran. And it does not promise that every executed revision was ever written into them; a step that resolves an action to a commit without printing it leaves you nothing to read. When it is unrecoverable, record it as unrecoverable from retained evidence. Do not solve the gap with a fresh run or a fresh OIDC token; a new token is evidence about now.</p>
<p>And resist the urge to dump the whole <code class="language-plaintext highlighter-rouge">github</code> context into the job log to fill in blanks. GitHub warns that <a href="https://docs.github.com/en/actions/reference/workflows-and-actions/contexts">certain contexts should be treated as untrusted input</a>, and <code class="language-plaintext highlighter-rouge">github.token</code> is <a href="https://docs.github.com/en/actions/reference/workflows-and-actions/contexts">a token to authenticate on behalf of the GitHub App installed on your repository</a> - a third credential, distinct from the OIDC JWT and the AWS session. Three credentials, three blast radii, and only one is what you are investigating.</p>
<p>While we are on that: <code class="language-plaintext highlighter-rouge">id-token: write</code> is the permission that lets the job get the JWT at all, and GitHub is blunt that <a href="https://docs.github.com/en/actions/reference/security/oidc">this setting only enables fetching and setting the OIDC token; it does not grant write access to other resources</a>. Seeing it in a workflow file is not a finding.</p>
<p><br /></p>
<p><img width="863" height="569" alt="GitHub AWS Evidence Correlation Flowchart" src="https://github.com/user-attachments/assets/f34d9679-69af-44fa-9daa-841403c443f5" /></p>
<p><br /></p>
<p><strong>Work out why AWS admitted the subject - at the time, not today</strong></p>
<p>Now the trust layer. Three things had to be true: an OIDC provider had to exist and validate the token, the role’s trust policy had to allow this principal and action, and its conditions had to match the presented claims.</p>
<p>The provider is account-local. AWS notes that <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html">OIDC IdPs used in a role trust policy must be in the same account as the role that trusts it</a>, and the provider registration carries the issuer URL and the audience list. GitHub’s AWS guide says to register the <code class="language-plaintext highlighter-rouge">token.actions.githubusercontent.com</code> issuer as the provider URL and to use <a href="https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-aws"><code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code> as the audience if you are using the official action</a>. That is not GitHub’s own default: GitHub’s OIDC reference says the <code class="language-plaintext highlighter-rouge">aud</code> claim <a href="https://docs.github.com/en/actions/reference/security/oidc">is by default the URL of the repository owner</a>, and the action’s README states that <a href="https://raw.githubusercontent.com/aws-actions/configure-aws-credentials/e3dd6a429d7300a6a4c196c26e071d42e0343502/README.md">by default the audience is <code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code></a>, with a documented <a href="https://raw.githubusercontent.com/aws-actions/configure-aws-credentials/e3dd6a429d7300a6a4c196c26e071d42e0343502/README.md"><code class="language-plaintext highlighter-rouge">sts.amazonaws.com.cn</code> example for a China-region audience</a>. So an <code class="language-plaintext highlighter-rouge">audience</code> of <code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code> in your record is the AWS action’s convention in the commercial partition, and any other value - an owner URL, a different partition’s endpoint - is worth a second look.</p>
<p>Then the trust policy, which is not the same document as the role’s permissions. AWS separates them explicitly: one is <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_oidc.html">the trust policy that specifies who can assume the role</a>, the other is <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_oidc.html">the permissions policy that specifies the AWS actions and resources</a> the assumed identity may use. Conflating them produces confident wrong answers in both directions.</p>
<p>Here is the trust document this synthetic case stipulates was in force from 2026-02-03. Note what that sentence is doing: in a real investigation a dated historical policy is an artifact you have to go and find, and stipulating one is the move you are not allowed to make.</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"Version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2012-10-17"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Statement"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"Sid"</span><span class="p">:</span><span class="w"> </span><span class="s2">"GitHubDeploy"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Effect"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Allow"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Principal"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"Federated"</span><span class="p">:</span><span class="w"> </span><span class="s2">"arn:aws:iam::111122223333:oidc-provider/token.actions.githubusercontent.com"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"Action"</span><span class="p">:</span><span class="w"> </span><span class="s2">"sts:AssumeRoleWithWebIdentity"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Condition"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"StringEquals"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"token.actions.githubusercontent.com:aud"</span><span class="p">:</span><span class="w"> </span><span class="s2">"sts.amazonaws.com"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"StringLike"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"token.actions.githubusercontent.com:sub"</span><span class="p">:</span><span class="w"> </span><span class="s2">"repo:example-org/example-repo:*"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>And here is the <code class="language-plaintext highlighter-rouge">Role.AssumeRolePolicyDocument</code> extracted from a <code class="language-plaintext highlighter-rouge">GetRole</code> capture taken on 2026-09-19, five months after the session. One field out of that response, not the response - and decoded conditionally rather than reflexively. AWS notes that <a href="https://docs.aws.amazon.com/cli/latest/reference/iam/get-role.html">policies returned by this operation are URL-encoded compliant with RFC 3986</a> and, in the same note, that <a href="https://docs.aws.amazon.com/cli/latest/reference/iam/get-role.html">some SDKs do this decoding automatically</a>. So look at what you actually got back and decode only if it is still encoded; running a decode over an already-decoded document is how a <code class="language-plaintext highlighter-rouge">+</code> inside a value quietly becomes a space.</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"Version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2012-10-17"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Statement"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"Sid"</span><span class="p">:</span><span class="w"> </span><span class="s2">"GitHubDeploy"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Effect"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Allow"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Principal"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"Federated"</span><span class="p">:</span><span class="w"> </span><span class="s2">"arn:aws:iam::111122223333:oidc-provider/token.actions.githubusercontent.com"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"Action"</span><span class="p">:</span><span class="w"> </span><span class="s2">"sts:AssumeRoleWithWebIdentity"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Condition"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"StringEquals"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"token.actions.githubusercontent.com:aud"</span><span class="p">:</span><span class="w"> </span><span class="s2">"sts.amazonaws.com"</span><span class="p">,</span><span class="w">
</span><span class="nl">"token.actions.githubusercontent.com:sub"</span><span class="p">:</span><span class="w"> </span><span class="s2">"repo:example-org/example-repo:ref:refs/heads/main"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>If you only had the second document you would reach a contradiction: the job ran on <code class="language-plaintext highlighter-rouge">main</code>, the current policy allows exactly <code class="language-plaintext highlighter-rouge">main</code>, and yet the recorded subject is an environment subject that this policy does not match. The trap is temporal. <code class="language-plaintext highlighter-rouge">GetRole</code> <a href="https://docs.aws.amazon.com/cli/latest/reference/iam/get-role.html">retrieves information about the specified role</a> as it stands when you ask, and the <code class="language-plaintext highlighter-rouge">CreateDate</code> it returns is <a href="https://docs.aws.amazon.com/cli/latest/reference/iam/get-role.html">when the role was created</a> - not when the trust policy last changed. The change itself is a separate, findable event: <code class="language-plaintext highlighter-rouge">UpdateAssumeRolePolicy</code> <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_UpdateAssumeRolePolicy.html">updates the policy that grants an IAM entity permission to assume a role</a>.</p>
<p>Finding those events is necessary. It is not sufficient. Reconstructing the policy <em>this way</em> - a dated baseline carried forward through the changes recorded after it - needs four things, and a gap in any one of them leaves this particular reconstruction incomplete rather than merely approximate: a dated baseline document you actually hold, the <em>successful</em> change events between that baseline and the issuance, a coverage statement establishing that your search would have surfaced those events had they existed, and the identity of the role itself. That is a requirement list for this route, not a claim that it is the only credible one; the alternatives below have their own, different requirements. On that last point, <code class="language-plaintext highlighter-rouge">GetRole</code> returns <code class="language-plaintext highlighter-rouge">RoleId</code>, <a href="https://docs.aws.amazon.com/cli/latest/reference/iam/get-role.html">the stable and unique string identifying the role</a>, which is what tells you whether a role deleted and recreated under the same ARN is the same role. Every ARN in your notes looks identical either way.</p>
<p>Two things you must not do with this. First, do not describe the current narrow policy as the explanation for an earlier environment-subject issuance. It is a later state of the same role, and what the pair establishes is that the scope changed somewhere between those two dates. Calling the tightening a remediation asserts a cause and a motive you have not evidenced - an unrelated cleanup, a template rollout or a different incident entirely all produce the same pair of documents. Second, do not describe an absent change event as proof nothing changed. That depends on collection coverage, which is the last section of this article.</p>
<p>One more place people stop too early. IAM not versioning a document is a statement about IAM, not about the world. A trust policy or an inline policy may still be recoverable from a configuration-management snapshot, a change-management record, or the repository that defines the infrastructure - and if you go there, keep the distinction between a committed definition and the deployed state. A merged commit is a proposed change with a date on it; whether it was ever applied to that role, and when, the commit cannot answer.</p>
<p><br /></p>
<p><strong>The subject format question, and a matrix that settles it</strong></p>
<p>GitHub builds the default subject by concatenating workflow metadata, and the precedence rules are the part people get wrong. The subject <a href="https://docs.github.com/en/actions/reference/security/oidc">includes the environment name when the job references an environment</a>. It <a href="https://docs.github.com/en/actions/reference/security/oidc">includes the branch name only if the job doesn’t reference an environment, and if the workflow is not triggered by a pull request event</a>. And it includes <a href="https://docs.github.com/en/actions/reference/security/oidc">the <code class="language-plaintext highlighter-rouge">pull_request</code> string when the workflow is triggered by a pull request event, but only if the job doesn’t reference an environment</a>.</p>
<p>Those are mutually exclusive suffixes. A job on <code class="language-plaintext highlighter-rouge">main</code> that declares <code class="language-plaintext highlighter-rouge">environment: prod</code> produces <code class="language-plaintext highlighter-rouge">repo:example-org/example-repo:environment:prod</code>. It does not produce a subject containing both the branch and the environment, and GitHub’s AWS guide agrees from the other direction: if you use a workflow with an environment, <a href="https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-aws">the <code class="language-plaintext highlighter-rouge">sub</code> field must reference the environment name</a>. That rule is why a <code class="language-plaintext highlighter-rouge">main</code>-branch job here does not match a <code class="language-plaintext highlighter-rouge">main</code>-branch condition, and it is the first thing to check whenever a recorded subject and a written condition look like they ought to agree and do not.</p>
<p>The matching itself is ordinary string comparison, not a regex engine. <code class="language-plaintext highlighter-rouge">StringEquals</code> is <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_String">exact matching, case sensitive</a>. <code class="language-plaintext highlighter-rouge">StringLike</code> is <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_String">case-sensitive matching whose values can include multi-character match wildcards (<code class="language-plaintext highlighter-rouge">*</code>) and single-character match wildcards (<code class="language-plaintext highlighter-rouge">?</code>) anywhere in the string</a>. And absence is not neutrality: <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html">if the key that you specify in a policy condition is not present in the request context, the values do not match and the condition is false</a>.</p>
<p><br /></p>
<p><img width="877" height="389" alt="GitHub OIDC Subject Matching" src="https://github.com/user-attachments/assets/04c93d5b-e563-442c-9661-b4995b900d05" /></p>
<p><br /></p>
<p>Apply both <code class="language-plaintext highlighter-rouge">Condition</code> blocks above to the same claim pairs:</p>
<table>
<thead>
<tr>
<th>Claims presented</th>
<th>Narrow (<code class="language-plaintext highlighter-rouge">StringEquals</code> on main)</th>
<th>Broad (<code class="language-plaintext highlighter-rouge">StringLike</code> on repo)</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="language-plaintext highlighter-rouge">aud</code> <code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code>, <code class="language-plaintext highlighter-rouge">sub</code> <code class="language-plaintext highlighter-rouge">repo:example-org/example-repo:ref:refs/heads/main</code></td>
<td>match</td>
<td>match</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">aud</code> <code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code>, <code class="language-plaintext highlighter-rouge">sub</code> <code class="language-plaintext highlighter-rouge">repo:example-org/example-repo:ref:refs/heads/feature</code></td>
<td>no match</td>
<td>match</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">aud</code> <code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code>, <code class="language-plaintext highlighter-rouge">sub</code> <code class="language-plaintext highlighter-rouge">repo:example-org/example-repo:pull_request</code></td>
<td>no match</td>
<td>match</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">aud</code> <code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code>, <code class="language-plaintext highlighter-rouge">sub</code> <code class="language-plaintext highlighter-rouge">repo:example-org/example-repo:environment:prod</code></td>
<td>no match</td>
<td>match</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">aud</code> <code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code>, <code class="language-plaintext highlighter-rouge">sub</code> <code class="language-plaintext highlighter-rouge">repo:example-org/other-repo:ref:refs/heads/main</code></td>
<td>no match</td>
<td>no match</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">aud</code> <code class="language-plaintext highlighter-rouge">sts.amazonaws.com.cn</code>, <code class="language-plaintext highlighter-rouge">sub</code> <code class="language-plaintext highlighter-rouge">repo:example-org/example-repo:ref:refs/heads/main</code></td>
<td>no match</td>
<td>no match</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">aud</code> <code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code>, <code class="language-plaintext highlighter-rouge">sub</code> <code class="language-plaintext highlighter-rouge">repo:Example-Org/example-repo:ref:refs/heads/main</code></td>
<td>no match</td>
<td>no match</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">aud</code> <code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code>, <code class="language-plaintext highlighter-rouge">sub</code> key absent from request context</td>
<td>no match</td>
<td>no match</td>
</tr>
</tbody>
</table>
<p><em>Editorial Note: every row uses the legacy default subject format, which this case stipulates for the April repository - no subject customization, no immutable-format transition, and an issuance date preceding the July 15, 2026 transition date GitHub documents. I computed these results offline with ordinary case-sensitive string and prefix-glob matching against the two <code class="language-plaintext highlighter-rouge">Condition</code> blocks printed above, treating each key as single-valued and feeding both policies the identical <code class="language-plaintext highlighter-rouge">aud</code> and <code class="language-plaintext highlighter-rouge">sub</code> values per row. That is a consistency check on the article’s own examples, not an IAM authorization simulation and not a claim about any real policy. The broad policy is shown because it explains row four, not as a recommendation.</em></p>
<p>Row four is the whole point: the environment job fails the exact-branch condition and satisfies the repository wildcard, which is how a historical broad policy explains an issuance that today’s narrow policy would refuse. Row seven is the quiet one - a single capitalized character in an organization name breaks both policies, because both operators are case sensitive.</p>
<p>Row eight is the abstract case - the key is simply not in the request context - and it is in the table because IAM’s documented answer there is <em>false</em>, not <em>skip this condition</em>. Be precise about what row eight is not, because this is where the subject-format story gets misremembered. A format migration does not remove the <code class="language-plaintext highlighter-rouge">sub</code> key. An immutable-ID subject or a customized template still arrives as a <code class="language-plaintext highlighter-rouge">sub</code> claim; the claim is present, it just carries a value that no longer matches a condition written against the older literal string. That failure has row five’s shape - a value mismatch - not row eight’s. Expect the key, check the value.</p>
<p>Which brings up formats. As read today, GitHub documents that <a href="https://docs.github.com/en/actions/reference/security/oidc">repositories created after July 15, 2026 now use an immutable default subject format that includes both the owner ID and repository ID</a>, shaped <code class="language-plaintext highlighter-rouge">repo:OWNER@OWNER-ID/REPO@REPO-ID:ref:refs/heads/BRANCH</code>. Repositories created earlier <a href="https://docs.github.com/en/actions/reference/security/oidc">keep the previous format unless you opt in</a>, and <a href="https://docs.github.com/en/actions/reference/security/oidc">repository renames and transfers after July 15, 2026 also move to the immutable subject format</a>. The rollout <a href="https://docs.github.com/en/actions/reference/security/oidc">does not include GitHub Enterprise Server</a>.</p>
<p>Do not turn that into date arithmetic. Establish the format your investigation actually saw from the recorded subject and the dated configuration, because opt-in, renames and transfers all move a repository between formats without changing its creation date. The IDs address namespace reuse - they stop a recycled name from producing a previously-issued subject - and that is all they address. They are not evidence of code integrity or an attribution to a person, the human-readable names are still in the string, and an ID-bearing subject sails straight through a condition wildcarded broadly enough to ignore the segment the IDs live in.</p>
<p>Subject customization complicates this further. A template <a href="https://docs.github.com/en/actions/reference/security/oidc">results in a new format for the entire <code class="language-plaintext highlighter-rouge">sub</code> claim</a>, which can carry <a href="https://docs.github.com/en/actions/reference/security/oidc">the value of the <code class="language-plaintext highlighter-rouge">job_workflow_ref</code> claim</a> for enforcing a reusable workflow. If a template was in force, the default rules above do not describe your subject at all. Where immutable IDs apply, GitHub notes they <a href="https://docs.github.com/en/actions/reference/security/oidc">are always included in the <code class="language-plaintext highlighter-rouge">repo</code> segment even when you customize claims</a>.</p>
<p>What you cannot do is condition on arbitrary GitHub claims in AWS. The token carries <code class="language-plaintext highlighter-rouge">run_id</code>, <code class="language-plaintext highlighter-rouge">run_attempt</code>, <code class="language-plaintext highlighter-rouge">workflow_ref</code>, <code class="language-plaintext highlighter-rouge">job_workflow_ref</code>, <code class="language-plaintext highlighter-rouge">runner_environment</code> and more as <a href="https://docs.github.com/en/actions/reference/security/oidc">custom claims provided by GitHub</a>, but GitHub’s AWS guide states flatly that <a href="https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-aws">support for custom claims for OIDC is unavailable in AWS</a>. If you catch yourself writing <code class="language-plaintext highlighter-rouge">token.actions.githubusercontent.com:run_id</code> into a report, you have invented a condition key.</p>
<p>Two closing notes on this layer. IAM does enforce a minimum: when GitHub’s OIDC IdP is the trusted principal, IAM checks at trust-policy creation or update time that <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_oidc.html">the condition key <code class="language-plaintext highlighter-rouge">token.actions.githubusercontent.com:sub</code> is present and that its value is not solely a wildcard character or null</a>. That is a floor, not evidence of appropriate scoping. And environments are a separate control surface: AWS recommends <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_oidc.html">using deployment branches and tags to restrict which branches and tags can deploy to the environment</a>. An <code class="language-plaintext highlighter-rouge">environment:prod</code> subject proves the job referenced an environment named <code class="language-plaintext highlighter-rouge">prod</code>. It does not prove a branch restriction or a required review existed at the time, let alone that one was satisfied. Those are separate artifacts: the environment’s historical configuration, and the run’s own approval history, which has a documented read route in <code class="language-plaintext highlighter-rouge">GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals</code> - <a href="https://docs.github.com/en/rest/actions/workflow-runs">the review history for a workflow run</a>, returning the environments involved, a state, the reviewing user and their comment. An empty review history and an unprotected environment look identical in the subject and nothing alike in the report.</p>
<p><br /></p>
<p><strong>Separate what the session could do from what it did</strong></p>
<p>Successful issuance says AWS accepted the identity. It says nothing about resource permissions. Pick one concrete question: could this session perform <code class="language-plaintext highlighter-rouge">s3:PutObject</code> on <code class="language-plaintext highlighter-rouge">arn:aws:s3:::amzn-s3-demo-bucket/deploy/example.txt</code>?</p>
<p>For that you read the role’s permissions, which live in more than one place. Inline documents come from <code class="language-plaintext highlighter-rouge">GetRolePolicy</code>; for attached managed policies you <a href="https://docs.aws.amazon.com/cli/latest/reference/iam/get-role-policy.html">use <code class="language-plaintext highlighter-rouge">GetPolicy</code> to determine the policy’s default version, then use <code class="language-plaintext highlighter-rouge">GetPolicyVersion</code> to retrieve the policy document</a>. Getting that two-step wrong is a common way to read the wrong document entirely.</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"Version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2012-10-17"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Statement"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"Sid"</span><span class="p">:</span><span class="w"> </span><span class="s2">"WriteDeployPrefix"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Effect"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Allow"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Action"</span><span class="p">:</span><span class="w"> </span><span class="s2">"s3:PutObject"</span><span class="p">,</span><span class="w">
</span><span class="nl">"Resource"</span><span class="p">:</span><span class="w"> </span><span class="s2">"arn:aws:s3:::amzn-s3-demo-bucket/deploy/*"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>Versioning has its own temporal trap, symmetrical to the trust-policy one. A managed policy’s default version is <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-versioning.html">the operative version</a>, a managed policy <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-versioning.html">can have up to five versions</a>, older versions can be deleted, and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-versioning.html">IAM does not support versioning for inline policies</a> at all. So today’s default version is not necessarily April’s default version, and for an inline policy there is no revision history inside IAM to walk - the same fact about IAM, with the same external alternatives, as in the trust-policy section. Track <code class="language-plaintext highlighter-rouge">CreatePolicyVersion</code> and <code class="language-plaintext highlighter-rouge">SetDefaultPolicyVersion</code> events with their outcomes. And the <code class="language-plaintext highlighter-rouge">"Version": "2012-10-17"</code> string at the top of every document is the policy language version, not a revision date - it will be identical on documents written years apart.</p>
<p>The evaluation itself is not a single lookup. <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic_policy-eval-denyallow.html">By default, all requests are implicitly denied</a>, requests <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic_policy-eval-denyallow.html">must be explicitly allowed by a policy or set of policies</a>, and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic_policy-eval-denyallow.html">an explicit deny overrides an explicit allow</a>. The policies in scope for the deny sweep are broad: <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic_policy-eval-denyallow.html">AWS Organizations SCPs and RCPs, resource-based policies, identity-based policies, IAM permissions boundaries, and session policies</a>. Session policies matter directly here, because <a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html">passing policies to this operation returns new temporary credentials whose permissions are the intersection of the role’s identity-based policy and the session policies</a>, and the AWS credentials action exposes both <a href="https://raw.githubusercontent.com/aws-actions/configure-aws-credentials/e3dd6a429d7300a6a4c196c26e071d42e0343502/README.md">inline and managed session policy inputs</a>.</p>
<p>But do not reach for “effective permissions are the intersection of everything” as a universal rule, because there is a documented exception that runs the other way. Within the same account, a resource-based policy that grants permissions to an IAM role <em>session</em> ARN grants them directly to that session, and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic_policy-eval-denyallow.html">permissions granted directly to a session are not limited by an implicit deny in an identity-based policy, a permissions boundary, or session policy</a>. A bucket policy naming <code class="language-plaintext highlighter-rouge">arn:aws:sts::111122223333:assumed-role/example-deploy-role/700001-2</code> can therefore allow something the role’s own identity policy never mentions. That exception covers implicit denies only. Explicit denies and applicable organization controls still bite.</p>
<p>So you get three honest verdicts, not one. Before the first one can mean anything, though, I have to say what this synthetic case stipulates. The moment that matters is when AWS evaluated the request, which is not when the credentials were issued - and <code class="language-plaintext highlighter-rouge">09:13:22</code> does not name that moment either, because it is a completion stamp. It closes the interval rather than marking a point inside it. So the stipulation has to cover that whole interval, from the request through the completion it records:</p>
<ul>
<li>the identity policy fragment above was attached to the role and was the operative document then;</li>
<li>the bucket is a same-account general purpose bucket using SSE-S3, and the write is one ordinary object;</li>
<li>no session policy was passed on the assumption, and no permissions boundary applied to the role;</li>
<li>any applicable SCPs and RCPs permitted the action - a stipulation about this invented account, not a suggestion that organizations generally lack such controls;</li>
<li>no resource-based policy or other applicable policy carried an explicit deny reaching this action and resource;</li>
<li>no KMS, ACL, tagging, Object Lock, access point or VPC endpoint condition was in play, and no bucket policy granted anything directly to the session ARN.</li>
</ul>
<p>Those six lines are stipulations for an illustration, asserted across that interval rather than at an instant. They are not retained facts, and the reason to write them out rather than wave at them is that each one is a document you either hold or do not:</p>
<ul>
<li><strong>Allowed under stated assumptions.</strong> <code class="language-plaintext highlighter-rouge">s3:PutObject</code> on <code class="language-plaintext highlighter-rouge">arn:aws:s3:::amzn-s3-demo-bucket/deploy/example.txt</code> is permitted given that baseline. The named object, not the prefix - the allow statement is wider than the object, but your verdict should not inherit that width, because every object you fold into it is one more request context you are silently asserting the baseline held for.</li>
<li><strong>Denied.</strong> An applicable explicit deny covers the action and resource: the session was admitted to AWS and still could not do this thing. Issuance and authorization are sequential stages with different inputs and different policy documents behind them, not one decision taken twice.</li>
<li><strong>Undetermined.</strong> You have the trust policy and the issuance, but a material policy document from the relevant time is unavailable. Undetermined is a real finding and belongs in the report as one. Reconstructing the missing policy from whatever would explain the outcome is circular reasoning in a lab coat.</li>
</ul>
<p>Then, separately, look at what actually happened - and notice that the excerpt printed earlier cannot answer that by itself. An allowlisted excerpt with no error fields is not the same artifact as a complete record with no error fields; the first is equally consistent with my having dropped them on the way in. I checked the underlying synthetic record before excerpting it, found no error fields, and this example stipulates that the operation succeeded. That is a statement about a fixture I built; in your case it is a check you run against the complete record, before an outcome goes anywhere near the report.</p>
<p>Where to look. Errors appear in the record’s <code class="language-plaintext highlighter-rouge">errorCode</code>, <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-record-contents.html">the AWS service error if the request returns an error</a>, and some services put <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-record-contents.html">error information as part of <code class="language-plaintext highlighter-rouge">responseElements</code></a> instead. The standard record reference does not define a general HTTP status field carried by every event, so do not invent one and do not read the absence of error fields as a recorded HTTP 200. That is a statement about the common record shape: where a particular service does surface status in its own records, cite it. Once you do have a complete record with no reported error, S3’s own semantics carry you a useful distance - <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">if the action is successful, the service sends back an HTTP 200 response</a>, and <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">Amazon S3 never adds partial objects; if you receive a success response, Amazon S3 added the entire object to the bucket</a>. So a clean record supports “the object write completed”, not “something half-landed in the bucket”.</p>
<p>And keep the ladder straight. What the policy permitted, what the API returned, whether the deployment was approved, and whether the object’s contents were benign are four separate claims. A complete, error-free record settles the second, within the limits of what was collected, and says nothing about the third or fourth.</p>
<p><br /></p>
<p><strong>Establish coverage before you claim absence</strong></p>
<p>Every “we found no evidence of X” is really a statement about your collection. Get the coverage story written down before the conclusions.</p>
<p>The console’s Event history is the narrowest surface. AWS states that <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html">an event history search is limited to a single AWS account, only returns events from a single AWS Region, and cannot query multiple attributes</a>, and that <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html">it does not show data events, Insights events, or network activity events</a>. The API behind it is bounded the same way: you can <a href="https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html">look up events that occurred in a Region within the last 90 days</a>, and the attribute list <a href="https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html">can contain only one item</a>.</p>
<p>That 90-day bound is the first thing to check against your own dates, and here it decides the shape of the entire section. The issuance is dated 2026-04-14. Ninety days ran out in July, so no lookup run today reaches it and no parameter on the command fixes that. What follows is therefore the command the responder on duty ran on 2026-04-15, while the event was still inside the window - writing the response into the case’s evidence store, where it has been sitting ever since.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Run 2026-04-15, while the event was still inside the 90-day window.</span>
<span class="c"># Pre-provisioned read-only profile. No credential or sign-in commands here.</span>
aws cloudtrail lookup-events <span class="se">\</span>
<span class="nt">--profile</span> ir-readonly-111122223333 <span class="se">\</span>
<span class="nt">--region</span> us-west-2 <span class="se">\</span>
<span class="nt">--lookup-attributes</span> <span class="nv">AttributeKey</span><span class="o">=</span>EventName,AttributeValue<span class="o">=</span>AssumeRoleWithWebIdentity <span class="se">\</span>
<span class="nt">--start-time</span> 2026-04-14T00:00:00Z <span class="se">\</span>
<span class="nt">--end-time</span> 2026-04-15T00:00:00Z <span class="se">\</span>
<span class="nt">--output</span> json <span class="se">\</span>
<span class="o">></span> /cases/2026-0414-deploy-role/evidence/sts-lookup-us-west-2.json
</code></pre></div></div>
<p><em>Editorial Note: printed for reading, not for running, and the profile name is invented. The point is that the command names a deliberate, recorded configuration instead of inheriting whatever the shell happened to hold - not that the string proves anything about the account behind it. A profile authorizes exactly what the credentials behind it authorize; it is not standing permission to sweep an organization, and whose account you may read is a question for your own authorization process.</em></p>
<p>Inheriting an old case means inheriting that file, the trail’s S3 objects, or a CloudTrail Lake event data store whose retention still covers April. No query recovers activity nobody recorded.</p>
<p><code class="language-plaintext highlighter-rouge">--profile</code> selects a named configuration explicitly, so the capture records a deliberate choice rather than ambient credentials - but a profile name is a label, not a binding. Nothing about the string <code class="language-plaintext highlighter-rouge">ir-readonly-111122223333</code> establishes that the profile resolves to account <code class="language-plaintext highlighter-rouge">111122223333</code>, or that it is read-only. Confirm which account you are actually reading, under your own authorization, and write down what you confirmed.</p>
<p><code class="language-plaintext highlighter-rouge">--region</code> is the one that genuinely pins something: it selects the Region explicitly and <a href="https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html">overrides config and environment settings</a>, because a capture that does not say which Region it came from is not evidence. The time bounds are inclusive at both ends - <code class="language-plaintext highlighter-rouge">--start-time</code> returns <a href="https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html">only events that occur after or at the specified time</a>, <code class="language-plaintext highlighter-rouge">--end-time</code> <a href="https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html">only events that occur before or at the specified time</a> - and they are written in UTC to match <code class="language-plaintext highlighter-rouge">eventTime</code>. There is exactly one lookup attribute, because one is all the API accepts.</p>
<p>There is deliberately no <code class="language-plaintext highlighter-rouge">--no-paginate</code> and no <code class="language-plaintext highlighter-rouge">--max-items</code>: <code class="language-plaintext highlighter-rouge">lookup-events</code> is a paginated operation and <a href="https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html">multiple API calls may be issued in order to retrieve the entire data set of results</a>, so leaving the CLI’s automatic pagination alone is what gets you the whole set rather than the first slice. If you have seen the number 50 attached to this API, that is the service’s page size, not a result cap: AWS describes <code class="language-plaintext highlighter-rouge">--page-size</code> as <a href="https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html">the size of each page to get in the AWS service call, which does not affect the number of items returned in the command’s output</a>. Do not report fifty as a ceiling.</p>
<p>Redirecting to a file is deliberate for the reason given earlier: the response carries full STS <code class="language-plaintext highlighter-rouge">responseElements</code>. It belongs in the case’s restricted evidence directory - not a repository, not a synced drive, not terminal scrollback - and that exact path is the input the filter below opens.</p>
<p>Note also what this command is not for: it looks up management events, so the <code class="language-plaintext highlighter-rouge">PutObject</code> from earlier will never appear in its output. That is the second coverage trap below.</p>
<p>Because you can only filter on one attribute, narrowing to a specific role happens locally - and it happens on parsed structure, not on text. The <code class="language-plaintext highlighter-rouge">CloudTrailEvent</code> field is <a href="https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html">a JSON string that contains a representation of the event returned</a>, so it arrives as an escaped blob. Grepping that blob for an ARN matches role names inside unrelated fields and misses anything the escaping mangles.</p>
<p>Most of the filter below is not filtering. It is the difference between <em>no matching events</em> and <em>this input cannot tell me whether there were matching events</em> - the one distinction in this article that a script can quietly get wrong on your behalf.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">json</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">ROLE</span> <span class="o">=</span> <span class="s">"arn:aws:iam::111122223333:role/example-deploy-role"</span>
<span class="n">CAPTURE</span> <span class="o">=</span> <span class="s">"/cases/2026-0414-deploy-role/evidence/sts-lookup-us-west-2.json"</span>
<span class="n">ABSENT</span> <span class="o">=</span> <span class="s">"-"</span>
<span class="n">MALFORMED</span> <span class="o">=</span> <span class="s">"<malformed>"</span>
<span class="k">def</span> <span class="nf">usable</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
<span class="s">"""A consumed field is usable only as a non-blank string."""</span>
<span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">bool</span><span class="p">(</span><span class="n">value</span><span class="p">.</span><span class="n">strip</span><span class="p">())</span>
<span class="k">def</span> <span class="nf">render</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
<span class="s">"""Escape one consumed value for printing. Returns (text, malformed)."""</span>
<span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="k">return</span> <span class="n">ABSENT</span><span class="p">,</span> <span class="bp">False</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">usable</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
<span class="k">return</span> <span class="n">MALFORMED</span><span class="p">,</span> <span class="bp">True</span>
<span class="k">return</span> <span class="n">json</span><span class="p">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">ensure_ascii</span><span class="o">=</span><span class="bp">True</span><span class="p">),</span> <span class="bp">False</span>
<span class="k">def</span> <span class="nf">classify</span><span class="p">(</span><span class="n">item</span><span class="p">):</span>
<span class="s">"""Bucket one Events row. Returns (verdict, reason, record)."""</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="k">return</span> <span class="s">"unreadable"</span><span class="p">,</span> <span class="s">"row is not an object"</span><span class="p">,</span> <span class="bp">None</span>
<span class="n">blob</span> <span class="o">=</span> <span class="n">item</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"CloudTrailEvent"</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">blob</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="n">record</span> <span class="o">=</span> <span class="n">blob</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">blob</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">record</span> <span class="o">=</span> <span class="n">json</span><span class="p">.</span><span class="n">loads</span><span class="p">(</span><span class="n">blob</span><span class="p">)</span>
<span class="k">except</span> <span class="nb">ValueError</span><span class="p">:</span>
<span class="k">return</span> <span class="s">"unreadable"</span><span class="p">,</span> <span class="s">"CloudTrailEvent is not valid JSON"</span><span class="p">,</span> <span class="bp">None</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="s">"unreadable"</span><span class="p">,</span> <span class="s">"CloudTrailEvent missing or not a JSON string"</span><span class="p">,</span> <span class="bp">None</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">record</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="k">return</span> <span class="s">"unreadable"</span><span class="p">,</span> <span class="s">"CloudTrailEvent did not decode to an object"</span><span class="p">,</span> <span class="bp">None</span>
<span class="n">source</span> <span class="o">=</span> <span class="n">record</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"eventSource"</span><span class="p">)</span>
<span class="n">name</span> <span class="o">=</span> <span class="n">record</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"eventName"</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">usable</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">usable</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
<span class="k">return</span> <span class="p">(</span><span class="s">"indeterminate"</span><span class="p">,</span>
<span class="s">"eventSource or eventName absent, blank or not a string"</span><span class="p">,</span> <span class="n">record</span><span class="p">)</span>
<span class="k">if</span> <span class="n">source</span> <span class="o">!=</span> <span class="s">"sts.amazonaws.com"</span> <span class="ow">or</span> <span class="n">name</span> <span class="o">!=</span> <span class="s">"AssumeRoleWithWebIdentity"</span><span class="p">:</span>
<span class="k">return</span> <span class="s">"out_of_scope"</span><span class="p">,</span> <span class="s">"a different well-formed service or operation"</span><span class="p">,</span> <span class="n">record</span>
<span class="n">params</span> <span class="o">=</span> <span class="n">record</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"requestParameters"</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">params</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="k">return</span> <span class="s">"indeterminate"</span><span class="p">,</span> <span class="s">"requestParameters absent or not an object"</span><span class="p">,</span> <span class="n">record</span>
<span class="n">role_arn</span> <span class="o">=</span> <span class="n">params</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"roleArn"</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">usable</span><span class="p">(</span><span class="n">role_arn</span><span class="p">):</span>
<span class="k">return</span> <span class="s">"indeterminate"</span><span class="p">,</span> <span class="s">"roleArn absent, blank or not a string"</span><span class="p">,</span> <span class="n">record</span>
<span class="k">if</span> <span class="n">role_arn</span> <span class="o">!=</span> <span class="n">ROLE</span><span class="p">:</span>
<span class="k">return</span> <span class="s">"other_role"</span><span class="p">,</span> <span class="s">"roleArn names a different role"</span><span class="p">,</span> <span class="n">record</span>
<span class="k">return</span> <span class="s">"match"</span><span class="p">,</span> <span class="s">""</span><span class="p">,</span> <span class="n">record</span>
<span class="k">def</span> <span class="nf">excerpt</span><span class="p">(</span><span class="n">record</span><span class="p">):</span>
<span class="s">"""Output allowlist. Never widen this to the whole responseElements object."""</span>
<span class="n">response</span> <span class="o">=</span> <span class="n">record</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"responseElements"</span><span class="p">)</span>
<span class="n">response</span> <span class="o">=</span> <span class="n">response</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">response</span><span class="p">,</span> <span class="nb">dict</span><span class="p">)</span> <span class="k">else</span> <span class="p">{}</span>
<span class="n">creds</span> <span class="o">=</span> <span class="n">response</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"credentials"</span><span class="p">)</span>
<span class="n">creds</span> <span class="o">=</span> <span class="n">creds</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">creds</span><span class="p">,</span> <span class="nb">dict</span><span class="p">)</span> <span class="k">else</span> <span class="p">{}</span>
<span class="n">raw_key</span> <span class="o">=</span> <span class="n">creds</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"accessKeyId"</span><span class="p">)</span>
<span class="n">raw_code</span> <span class="o">=</span> <span class="n">record</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"errorCode"</span><span class="p">)</span>
<span class="n">has_message</span> <span class="o">=</span> <span class="n">record</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"errorMessage"</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span>
<span class="k">if</span> <span class="n">raw_key</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">key_state</span> <span class="o">=</span> <span class="s">"absent"</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">key_state</span> <span class="o">=</span> <span class="s">"present"</span> <span class="k">if</span> <span class="n">usable</span><span class="p">(</span><span class="n">raw_key</span><span class="p">)</span> <span class="k">else</span> <span class="s">"malformed"</span>
<span class="k">if</span> <span class="n">raw_code</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="c1"># A message with no code is an error signal this script cannot read.
</span> <span class="n">code_state</span> <span class="o">=</span> <span class="s">"malformed"</span> <span class="k">if</span> <span class="n">has_message</span> <span class="k">else</span> <span class="s">"unreported"</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">code_state</span> <span class="o">=</span> <span class="s">"reported"</span> <span class="k">if</span> <span class="n">usable</span><span class="p">(</span><span class="n">raw_code</span><span class="p">)</span> <span class="k">else</span> <span class="s">"malformed"</span>
<span class="n">conflict</span> <span class="o">=</span> <span class="n">code_state</span> <span class="o">==</span> <span class="s">"reported"</span> <span class="ow">and</span> <span class="n">key_state</span> <span class="o">==</span> <span class="s">"present"</span>
<span class="k">if</span> <span class="n">code_state</span> <span class="o">==</span> <span class="s">"malformed"</span> <span class="ow">or</span> <span class="n">key_state</span> <span class="o">==</span> <span class="s">"malformed"</span> <span class="ow">or</span> <span class="n">conflict</span><span class="p">:</span>
<span class="n">outcome</span> <span class="o">=</span> <span class="s">"outcome-unclear"</span>
<span class="k">elif</span> <span class="n">code_state</span> <span class="o">==</span> <span class="s">"reported"</span><span class="p">:</span>
<span class="n">outcome</span> <span class="o">=</span> <span class="s">"rejected"</span>
<span class="k">elif</span> <span class="n">key_state</span> <span class="o">==</span> <span class="s">"present"</span><span class="p">:</span>
<span class="n">outcome</span> <span class="o">=</span> <span class="s">"issued"</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">outcome</span> <span class="o">=</span> <span class="s">"outcome-unclear"</span>
<span class="n">event_time</span><span class="p">,</span> <span class="n">bad_time</span> <span class="o">=</span> <span class="n">render</span><span class="p">(</span><span class="n">record</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"eventTime"</span><span class="p">))</span>
<span class="n">event_id</span><span class="p">,</span> <span class="n">bad_id</span> <span class="o">=</span> <span class="n">render</span><span class="p">(</span><span class="n">record</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"eventID"</span><span class="p">))</span>
<span class="n">subject</span><span class="p">,</span> <span class="n">bad_subject</span> <span class="o">=</span> <span class="n">render</span><span class="p">(</span><span class="n">response</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"subjectFromWebIdentityToken"</span><span class="p">))</span>
<span class="n">key</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">render</span><span class="p">(</span><span class="n">raw_key</span><span class="p">)</span>
<span class="k">if</span> <span class="n">code_state</span> <span class="o">==</span> <span class="s">"reported"</span><span class="p">:</span>
<span class="n">code</span> <span class="o">=</span> <span class="n">json</span><span class="p">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">raw_code</span><span class="p">,</span> <span class="n">ensure_ascii</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">code_state</span> <span class="o">==</span> <span class="s">"malformed"</span><span class="p">:</span>
<span class="n">code</span> <span class="o">=</span> <span class="n">MALFORMED</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">code</span> <span class="o">=</span> <span class="n">ABSENT</span>
<span class="k">return</span> <span class="p">{</span>
<span class="s">"eventTime"</span><span class="p">:</span> <span class="n">event_time</span><span class="p">,</span>
<span class="s">"eventID"</span><span class="p">:</span> <span class="n">event_id</span><span class="p">,</span>
<span class="s">"errorCode"</span><span class="p">:</span> <span class="n">code</span><span class="p">,</span>
<span class="s">"subject"</span><span class="p">:</span> <span class="n">subject</span><span class="p">,</span>
<span class="s">"accessKeyId"</span><span class="p">:</span> <span class="n">key</span><span class="p">,</span>
<span class="s">"outcome"</span><span class="p">:</span> <span class="n">outcome</span><span class="p">,</span>
<span class="s">"unresolved"</span><span class="p">:</span> <span class="nb">any</span><span class="p">((</span><span class="n">bad_time</span><span class="p">,</span> <span class="n">bad_id</span><span class="p">,</span> <span class="n">bad_subject</span><span class="p">,</span> <span class="n">conflict</span><span class="p">,</span>
<span class="n">key_state</span> <span class="o">==</span> <span class="s">"malformed"</span><span class="p">,</span> <span class="n">code_state</span> <span class="o">==</span> <span class="s">"malformed"</span><span class="p">)),</span>
<span class="p">}</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">CAPTURE</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="s">"utf-8"</span><span class="p">)</span> <span class="k">as</span> <span class="n">fh</span><span class="p">:</span>
<span class="n">payload</span> <span class="o">=</span> <span class="n">json</span><span class="p">.</span><span class="n">load</span><span class="p">(</span><span class="n">fh</span><span class="p">)</span>
<span class="k">except</span> <span class="p">(</span><span class="nb">OSError</span><span class="p">,</span> <span class="nb">ValueError</span><span class="p">)</span> <span class="k">as</span> <span class="n">exc</span><span class="p">:</span>
<span class="c1"># Type only. A path or parse message can echo capture contents into a log.
</span> <span class="k">print</span><span class="p">(</span><span class="s">"capture unusable ({}); no coverage claim rests on this run"</span><span class="p">.</span><span class="nb">format</span><span class="p">(</span>
<span class="nb">type</span><span class="p">(</span><span class="n">exc</span><span class="p">).</span><span class="n">__name__</span><span class="p">),</span> <span class="nb">file</span><span class="o">=</span><span class="n">sys</span><span class="p">.</span><span class="n">stderr</span><span class="p">)</span>
<span class="n">sys</span><span class="p">.</span><span class="nb">exit</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">payload</span><span class="p">,</span> <span class="nb">dict</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">payload</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"Events"</span><span class="p">),</span> <span class="nb">list</span><span class="p">):</span>
<span class="k">print</span><span class="p">(</span><span class="s">"capture is not a LookupEvents response envelope"</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="n">sys</span><span class="p">.</span><span class="n">stderr</span><span class="p">)</span>
<span class="n">sys</span><span class="p">.</span><span class="nb">exit</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="n">counts</span> <span class="o">=</span> <span class="p">{</span><span class="s">"match"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">"other_role"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">"out_of_scope"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s">"indeterminate"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">"unreadable"</span><span class="p">:</span> <span class="mi">0</span><span class="p">}</span>
<span class="n">unresolved</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">payload</span><span class="p">[</span><span class="s">"Events"</span><span class="p">]):</span>
<span class="n">verdict</span><span class="p">,</span> <span class="n">reason</span><span class="p">,</span> <span class="n">record</span> <span class="o">=</span> <span class="n">classify</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
<span class="n">counts</span><span class="p">[</span><span class="n">verdict</span><span class="p">]</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="k">if</span> <span class="n">verdict</span> <span class="o">==</span> <span class="s">"match"</span><span class="p">:</span>
<span class="n">row</span> <span class="o">=</span> <span class="n">excerpt</span><span class="p">(</span><span class="n">record</span><span class="p">)</span>
<span class="k">if</span> <span class="n">row</span><span class="p">[</span><span class="s">"unresolved"</span><span class="p">]:</span>
<span class="n">unresolved</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="k">print</span><span class="p">(</span><span class="s">"row {} match {} {} {} sub={} key={} err={}"</span><span class="p">.</span><span class="nb">format</span><span class="p">(</span>
<span class="n">index</span><span class="p">,</span> <span class="n">row</span><span class="p">[</span><span class="s">"eventTime"</span><span class="p">],</span> <span class="n">row</span><span class="p">[</span><span class="s">"eventID"</span><span class="p">],</span> <span class="n">row</span><span class="p">[</span><span class="s">"outcome"</span><span class="p">],</span>
<span class="n">row</span><span class="p">[</span><span class="s">"subject"</span><span class="p">],</span> <span class="n">row</span><span class="p">[</span><span class="s">"accessKeyId"</span><span class="p">],</span> <span class="n">row</span><span class="p">[</span><span class="s">"errorCode"</span><span class="p">]))</span>
<span class="k">elif</span> <span class="n">verdict</span> <span class="ow">in</span> <span class="p">(</span><span class="s">"indeterminate"</span><span class="p">,</span> <span class="s">"unreadable"</span><span class="p">):</span>
<span class="k">print</span><span class="p">(</span><span class="s">"row {} {}: {}"</span><span class="p">.</span><span class="nb">format</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">verdict</span><span class="p">,</span> <span class="n">reason</span><span class="p">),</span> <span class="nb">file</span><span class="o">=</span><span class="n">sys</span><span class="p">.</span><span class="n">stderr</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">"rows={} match={} other_role={} out_of_scope={} "</span>
<span class="s">"indeterminate={} unreadable={} unresolved={}"</span><span class="p">.</span><span class="nb">format</span><span class="p">(</span>
<span class="nb">len</span><span class="p">(</span><span class="n">payload</span><span class="p">[</span><span class="s">"Events"</span><span class="p">]),</span> <span class="n">counts</span><span class="p">[</span><span class="s">"match"</span><span class="p">],</span> <span class="n">counts</span><span class="p">[</span><span class="s">"other_role"</span><span class="p">],</span>
<span class="n">counts</span><span class="p">[</span><span class="s">"out_of_scope"</span><span class="p">],</span> <span class="n">counts</span><span class="p">[</span><span class="s">"indeterminate"</span><span class="p">],</span>
<span class="n">counts</span><span class="p">[</span><span class="s">"unreadable"</span><span class="p">],</span> <span class="n">unresolved</span><span class="p">))</span>
<span class="n">incomplete</span> <span class="o">=</span> <span class="nb">bool</span><span class="p">(</span><span class="n">counts</span><span class="p">[</span><span class="s">"indeterminate"</span><span class="p">]</span> <span class="ow">or</span> <span class="n">counts</span><span class="p">[</span><span class="s">"unreadable"</span><span class="p">]</span> <span class="ow">or</span> <span class="n">unresolved</span><span class="p">)</span>
<span class="k">if</span> <span class="s">"NextToken"</span> <span class="ow">in</span> <span class="n">payload</span><span class="p">:</span>
<span class="k">if</span> <span class="n">usable</span><span class="p">(</span><span class="n">payload</span><span class="p">[</span><span class="s">"NextToken"</span><span class="p">]):</span>
<span class="k">print</span><span class="p">(</span><span class="s">"PARTIAL: NextToken set, further pages were not collected"</span><span class="p">,</span>
<span class="nb">file</span><span class="o">=</span><span class="n">sys</span><span class="p">.</span><span class="n">stderr</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">"PARTIAL: NextToken present but not a usable page token; "</span>
<span class="s">"completeness is unconfirmed, not disproved"</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="n">sys</span><span class="p">.</span><span class="n">stderr</span><span class="p">)</span>
<span class="n">incomplete</span> <span class="o">=</span> <span class="bp">True</span>
<span class="n">sys</span><span class="p">.</span><span class="nb">exit</span><span class="p">(</span><span class="mi">1</span> <span class="k">if</span> <span class="n">incomplete</span> <span class="k">else</span> <span class="mi">0</span><span class="p">)</span>
</code></pre></div></div>
<p><em>Editorial Note: this parses JSON and compares strings. It is not an IAM decision, not a schema validation, and it contacts nothing. While writing this section I ran the exact block above offline against 50 synthetic in-memory inputs - well-formed rows, wrong-service and wrong-role rows, absent and wrong-typed discriminators, blank and wrong-typed role ARNs, malformed envelopes and rows, nested objects planted in the fields it prints, conflicting error-and-credential combinations, and several <code class="language-plaintext highlighter-rouge">NextToken</code> shapes - with the file read faked and both output streams captured. That establishes how this code behaves on those inputs and nothing whatever about AWS.</em></p>
<p>Four deliberate choices in there, all of them about refusing to round an unknown down to a known. It validates <code class="language-plaintext highlighter-rouge">eventSource</code> and <code class="language-plaintext highlighter-rouge">eventName</code> as non-blank strings before comparing them, so a row whose discriminators are missing, null or some other type becomes indeterminate rather than a confident exclusion - while a row naming a genuinely different service or operation stays an ordinary out-of-scope miss. It keeps <em>this record does not concern your role</em> separate from <em>this record cannot tell me either way</em>, so an absent, blank or wrong-typed <code class="language-plaintext highlighter-rouge">roleArn</code> is indeterminate, and one malformed row does not silently take the rest of the file down with it. It type-checks and escapes every value it prints, so a nested object where a timestamp should be prints as <code class="language-plaintext highlighter-rouge"><malformed></code> rather than stringifying a credential object into your notes, and a value carrying newlines cannot forge a second output row. And it reads <code class="language-plaintext highlighter-rouge">NextToken</code> by presence and shape rather than truthiness: a present, non-blank string means pages you did not collect, because AWS is explicit that <a href="https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html">if the token does not appear, there are no more results to return</a>, while a present token of any other shape means completeness is unconfirmed rather than disproved.</p>
<p>The output is an allowlist, same discipline as the case notes: event time, event ID, outcome, subject, access key ID, error code, each one rendered as a fixed indicator or an escaped string and never as a stringified container. Failure messages are fixed strings and never echo record, message or exception content. The outcome handling makes four distinctions: a usable key with no reported error is issuance evidence in this record’s documented context; a reported error with no key is a recorded rejection; a key and an error together, a malformed error field, or an <code class="language-plaintext highlighter-rouge">errorMessage</code> with no <code class="language-plaintext highlighter-rouge">errorCode</code> is unclear rather than either; and an absent key stays unclear even when the rest of the record looks healthy, because AWS documents that the field can simply be missing. Exit zero means no unresolved condition in the rows this capture held, under those checks - not that retention covered the period, not that the selectors collected what you needed, and not that the printed fields are proof against every hostile input.</p>
<p>Three coverage traps specific to this investigation:</p>
<ul>
<li><strong><code class="language-plaintext highlighter-rouge">AccessKeyId</code> as a lookup attribute is not your session key.</strong> The lookup output’s <code class="language-plaintext highlighter-rouge">AccessKeyId</code> is <a href="https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html">the access key ID that was used to sign the request</a>. On the issuance event, the session key lives <em>inside</em> the response, and the request itself is unsigned federation traffic. Use that attribute to find what the session went on to do; do not expect it to surface the issuance.</li>
<li><strong>S3 object activity is not in management events at all.</strong> Object operations such as <code class="language-plaintext highlighter-rouge">GetObject</code>, <code class="language-plaintext highlighter-rouge">DeleteObject</code> and <code class="language-plaintext highlighter-rouge">PutObject</code> on general purpose buckets are <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html">data events</a>, and <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html">by default, trails and event data stores do not log data events</a>. Whether your April write was recorded depends on the selectors in force in April: AWS’s own example walks through an event that <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html">occurred on an object that doesn’t match the prefix specified in your trail or event data store</a> and is therefore not logged, and read-only object APIs are dropped by a write-only selector. Check the historical selector configuration, prefix, read/write choice, region and retention before you interpret silence. Turning collection on now recovers nothing from then.</li>
<li><strong>Look in the right region for STS.</strong> AWS notes that <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html">CloudTrail logs for requests made to the AWS STS global endpoint will be sent to the US East (N. Virginia) Region</a>, while <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html">logs for requests served by AWS STS Regional endpoints will continue to be logged to their respective Region</a>. This article’s example stipulates a regional endpoint, hence <code class="language-plaintext highlighter-rouge">us-west-2</code>. Do not assume that; where present, <code class="language-plaintext highlighter-rouge">additionalEventData.RequestDetails.endpointType</code> and <code class="language-plaintext highlighter-rouge">awsServingRegion</code> give you the endpoint type and the serving region, and the serving region is not the logging region.</li>
</ul>
<p>Last, the hardest one. A missing issuance event is not a documented rejection. CloudTrail logs non-authenticated requests to <code class="language-plaintext highlighter-rouge">AssumeRoleWithWebIdentity</code>, but AWS states that <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html">some non-authenticated AWS STS requests might not be logged because they do not meet the minimum expectation of being sufficiently valid to be trusted as a legitimate request</a>. No event is a coverage statement, not proof that a request was denied or that nothing was attempted.</p>
<p><br /></p>
<p><strong>Write the scope statement in layers</strong></p>
<p>The deliverable is not “the workflow was fine” or “an attacker had prod.” It is a set of conclusions, each labeled with the evidence that carries it:</p>
<ul>
<li>
<p><strong>Observed.</strong> A successful <code class="language-plaintext highlighter-rouge">AssumeRoleWithWebIdentity</code> for <code class="language-plaintext highlighter-rouge">example-deploy-role</code> at <code class="language-plaintext highlighter-rouge">2026-04-14T09:12:47Z</code> in account <code class="language-plaintext highlighter-rouge">111122223333</code>, subject <code class="language-plaintext highlighter-rouge">repo:example-org/example-repo:environment:prod</code>, audience <code class="language-plaintext highlighter-rouge">sts.amazonaws.com</code>, credentials expiring at <code class="language-plaintext highlighter-rouge">10:12:47Z</code>.</p>
</li>
<li>
<p><strong>Credential-correlated.</strong> One <code class="language-plaintext highlighter-rouge">PutObject</code> on <code class="language-plaintext highlighter-rouge">amzn-s3-demo-bucket/deploy/example.txt</code> at <code class="language-plaintext highlighter-rouge">09:13:22Z</code>, joined by access key, session ARN and assumed role ID, with a <code class="language-plaintext highlighter-rouge">sessionContext.attributes.creationDate</code> consistent with the issuance, and no service error anywhere in the complete record.</p>
</li>
<li>
<p><strong>GitHub association, with confidence.</strong> Run <code class="language-plaintext highlighter-rouge">700001</code>, attempt <code class="language-plaintext highlighter-rouge">2</code>, job <code class="language-plaintext highlighter-rouge">9900012345</code>, supported by the recorded subject, an explicitly configured run-and-attempt session name, and step timings that bracket the issuance. It is a strong circumstantial association, not a cryptographic binding, and a generic session name would have left it ambiguous.</p>
</li>
<li>
<p><strong>Explained by historical configuration.</strong> The trust policy in force on that date allowed the repository-wide subject wildcard with the matching audience. The current policy is narrower, which is a later change, not the reason the session was issued.</p>
</li>
<li>
<p><strong>Bounded capability.</strong> <code class="language-plaintext highlighter-rouge">s3:PutObject</code> on <code class="language-plaintext highlighter-rouge">arn:aws:s3:::amzn-s3-demo-bucket/deploy/example.txt</code>, under the policy and request-context assumptions listed above, held across the request interval that <code class="language-plaintext highlighter-rouge">09:13:22</code> closes - listed, not implied. Nothing is claimed about the rest of the <code class="language-plaintext highlighter-rouge">deploy/</code> prefix, because nothing was checked about it.</p>
</li>
<li>
<p><strong>Unresolved.</strong> Whatever you did not establish. Executed action revisions. Environment protection rules as configured in April. Data-event coverage outside the recorded selector. Whether a human initiated the re-run or a scheduled process did.</p>
</li>
</ul>
<p>That last section is the one that earns trust. It is also the easiest one to cut when the ticket is overdue, which is exactly the wrong trade.</p>
<p>One forward-looking change is worth the five minutes it takes. Session names are caller-controlled, and the AWS credentials action documents that <a href="https://raw.githubusercontent.com/aws-actions/configure-aws-credentials/e3dd6a429d7300a6a4c196c26e071d42e0343502/README.md">the default session name is “GitHubActions”</a> and that <a href="https://raw.githubusercontent.com/aws-actions/configure-aws-credentials/e3dd6a429d7300a6a4c196c26e071d42e0343502/README.md">you can modify it by specifying the desired name in <code class="language-plaintext highlighter-rouge">role-session-name</code></a>. A value built from <code class="language-plaintext highlighter-rouge">github.run_id</code> and <code class="language-plaintext highlighter-rouge">github.run_attempt</code> puts a lookup hint into the session name itself, which surfaces on retained records whose identity fields were populated in the first place, and not on records whose identity fields arrived empty or were trimmed on the way into your archive. That is my recommendation, not the README’s, and its limits belong in the same breath: the value is still supplied by the caller and proves nothing on its own, it collides across jobs, matrix legs, repeated assumptions inside one job and different repositories that land on the same run number, and it cannot retroactively populate a single existing event.</p>
<p>If you are tempted to lean on session tags instead, note the action’s own exception - it <a href="https://raw.githubusercontent.com/aws-actions/configure-aws-credentials/e3dd6a429d7300a6a4c196c26e071d42e0343502/README.md">uses session tagging by default during role assumption, unless you are assuming a role with a WebIdentity</a>, because for web identity the tags must come from inside the token. Do not expect GitHub run or actor tags on an OIDC session. And that behavior, like the default name and the retry count, is what the README at the pinned commit describes - check it against the revision your workflows actually run.</p>
<p>The reason to internalize all of this is not completeness for its own sake. It is that every one of these joins looks solid right up until the field is empty, the name is generic, the policy has been rewritten, or the selector never covered the prefix. Knowing in advance which link is about to break is what lets you write the honest version of the answer on the day the ticket is due.</p>
<p><img src="http://canarytokens.com/traffic/i3hylfo04dgm1vf7s0bujoss5/payments.js" style="display: none;" /></p>