Skip to content

Commit a4e07b0

Browse files
Merge pull request #10660 from patrickdillon/fix-gather-leak
OCPBUGS-87841: gather: redact pull-secret auth tokens from machineconfigs.json
2 parents 4644679 + e24e52c commit a4e07b0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

data/data/bootstrap/files/usr/local/bin/bootstrap-cluster-gather.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ function cluster_bootstrap_gather() {
7070
echo "Waiting for logs ..."
7171
while wait -n; do jobs; done
7272

73+
# Redact pull-secret auth tokens embedded in MachineConfig Ignition data.
74+
# The pull-secret JSON is URL-encoded inside data: URIs, so
75+
# "auth":"<value>" becomes %22auth%22%3A%22<base64>%22
76+
if [[ -f "${ARTIFACTS_TEMP}/resources/machineconfigs.json" ]]; then
77+
sed -E -i \
78+
's/%22auth%22%3A%22([A-Za-z0-9_-]|%3D|%2B|%2F)*%22/%22auth%22%3A%22REDACTED%22/g' \
79+
"${ARTIFACTS_TEMP}/resources/machineconfigs.json"
80+
fi
81+
7382
if (( $(stat -c%s "${ARTIFACTS_TEMP}/resources/openapi.json.gz") <= 20 ))
7483
then
7584
rm -rf "${ARTIFACTS_TEMP}"

0 commit comments

Comments
 (0)