Skip to content

Commit 61fcd48

Browse files
committed
ci: mask extracted license keys in CI logs
GitHub only auto-masks the exact TEST_SECRETS secret, not the license key jq-extracted from it. Register the extracted key via ::add-mask:: in report-flaky-retry.sh and report-payload-metrics.sh, and mask the perf-test license key inside the run-perf-test composite action (masks are job-scoped, so masking upstream would not reach the perf-run jobs).
1 parent e9584c6 commit 61fcd48

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

.github/actions/run-perf-test/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ inputs:
5353
runs:
5454
using: composite
5555
steps:
56+
- name: Mask license key in logs
57+
if: inputs.attach-agent == 'true' && inputs.license-key != ''
58+
shell: bash
59+
env:
60+
LICENSE_KEY: ${{ inputs.license-key }}
61+
run: echo "::add-mask::$LICENSE_KEY"
62+
5663
- name: Create agent-home directory
5764
shell: bash
5865
run: mkdir -p "${{ github.workspace }}/${{ env.PERF_TEST_DIR }}/agent-home"

build/Scripts/report-flaky-retry.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ if [ -n "${NR_TEST_SECRETS:-}" ]; then
6767
LICENSE_KEY="$(printf '%s' "$CLEAN_SECRETS" | jq -r '.IntegrationTestConfiguration.DefaultSetting.LicenseKey // empty' 2>/dev/null)"
6868
ACCOUNT_ID="$(printf '%s' "$CLEAN_SECRETS" | jq -r '.IntegrationTestConfiguration.DefaultSetting.NewRelicAccountId // empty' 2>/dev/null)"
6969
fi
70+
71+
# Mask the extracted license key in CI logs. GitHub Actions only auto-masks the
72+
# exact TEST_SECRETS blob, not this jq-extracted substring. No-op outside Actions.
73+
[ -n "$LICENSE_KEY" ] && echo "::add-mask::$LICENSE_KEY"
74+
7075
if [ -z "$LICENSE_KEY" ] || [ -z "$ACCOUNT_ID" ]; then
7176
echo "WARNING: no New Relic license key / account id available; skipping flaky-retry event." >&2
7277
exit 0

build/Scripts/report-payload-metrics.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ if [ -n "${NR_TEST_SECRETS:-}" ]; then
8989
LICENSE_KEY="$(printf '%s' "$NR_TEST_SECRETS" | sed '1s/^\xEF\xBB\xBF//' \
9090
| jq -r '.IntegrationTestConfiguration.DefaultSetting.LicenseKey // empty')"
9191
fi
92+
93+
# Mask the extracted license key in CI logs. GitHub Actions only auto-masks the
94+
# exact TEST_SECRETS blob, not this jq-extracted substring. No-op outside Actions.
95+
[ -n "$LICENSE_KEY" ] && echo "::add-mask::$LICENSE_KEY"
96+
9297
if [ -z "$LICENSE_KEY" ]; then
9398
echo "WARNING: no New Relic license key available; skipping." >&2
9499
exit 0

0 commit comments

Comments
 (0)