|
72 | 72 | const claims = JSON.parse(Buffer.from(encodedClaims, 'base64url').toString()); |
73 | 73 | // Log only identity metadata, never the signed token or exchanged credential. |
74 | 74 | const claimNames = [ |
75 | | - 'iss', 'aud', 'sub', 'issuer_scope', 'repository', 'repository_id', 'repository_owner', |
76 | | - 'repository_owner_id', 'repository_visibility', 'workflow', 'workflow_ref', |
77 | | - 'workflow_sha', 'job_workflow_ref', 'job_workflow_sha', 'ref', 'ref_type', 'sha', |
78 | | - 'head_ref', 'base_ref', 'ref_protected', 'environment', 'environment_node_id', |
79 | | - 'enterprise', 'enterprise_id', 'runner_environment', 'event_name', 'check_run_id', |
80 | | - 'actor', 'actor_id', 'run_id', 'run_number', 'run_attempt', 'iat', 'nbf', 'exp', |
| 75 | + 'iss', 'aud', 'sub', 'repository', 'workflow_ref', 'job_workflow_ref', |
| 76 | + 'environment', 'runner_environment', 'event_name', |
81 | 77 | ]; |
82 | 78 | const identity = Object.fromEntries(claimNames.map((name) => [name, claims[name] ?? null])); |
83 | 79 | core.info(JSON.stringify({alg: header.alg, kid: header.kid, claims: identity}, null, 2)); |
|
93 | 89 | const value = response.headers.get(name); |
94 | 90 | if (value) core.info(`${name}: ${value}`); |
95 | 91 | } |
96 | | - if (response.ok) { |
97 | | - await response.body?.cancel(); |
98 | | - } else { |
99 | | - const body = await response.json(); |
100 | | - core.warning(typeof body.message === 'string' ? body.message : 'npm rejected the token exchange'); |
101 | | - } |
| 92 | + // The response can contain an npm credential; never read or log its body. |
| 93 | + await response.body?.cancel(); |
102 | 94 | - name: Force snapshot changeset |
103 | 95 | if: ${{ github.event.comment.body == '/snapit' }} |
104 | 96 | run: "mv .changeset/force-snapshot-build.md.ignore .changeset/force-snapshot-build.md" |
|
0 commit comments