Skip to content

Commit fdbc28f

Browse files
dshoen619claude
andcommitted
ci: mask fetched Permit API key so it is not logged in cleartext
The Fetch API_KEY step wrote the env api key to $GITHUB_ENV and echoed it directly, so it appeared in cleartext in the run logs and in the env-group dump of every later step. Register the value with ::add-mask:: before exporting it, and drop the explicit echo, so it is redacted everywhere. PROJECT_API_KEY should still be rotated since it was exposed in prior runs. Fixes PER-15241. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b296d1f commit fdbc28f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/node_sdk_publish.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ jobs:
6161
https://api.permit.io/v2/api-key/${{ env.PROJECT_ID }}/${{ env.ENV_ID }} \
6262
-H 'Authorization: Bearer ${{ secrets.PROJECT_API_KEY }}')
6363
64-
# Extract the secret from the response which is the API_KEY of the new env
65-
echo "ENV_API_KEY=$(echo "$response" | jq -r '.secret')" >> $GITHUB_ENV
66-
67-
echo "New env api key: $ENV_API_KEY"
64+
# Extract the api key secret and register it for masking BEFORE writing
65+
# it to the environment, so it is redacted everywhere in the logs
66+
# (including the env-group dumps of every later step). Do not echo it.
67+
ENV_API_KEY=$(echo "$response" | jq -r '.secret')
68+
echo "::add-mask::$ENV_API_KEY"
69+
echo "ENV_API_KEY=$ENV_API_KEY" >> "$GITHUB_ENV"
6870
6971
- name: local PDP runnning
7072
env:

0 commit comments

Comments
 (0)