Repository navigation
ci: prepare protected Depot PR runners #1302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ea6ad27
ci: prepare protected Depot PR runners
ndizazzo c8a7b9b
ci: fail closed on missing PR head identity
ndizazzo eed3bad
style: format CI workflow contract
ndizazzo 8903086
ci: add negative Depot credential canary
ndizazzo 72a2c23
ci: address Depot rollout review findings
ndizazzo e0dd458
ci: keep Depot audit portable across platforms
ndizazzo bc25b0b
ci: pin protected Depot audit action
ndizazzo 4f9899c
ci: close Depot audit authority bypasses
ndizazzo 49c6333
ci: repin hardened Depot audit action
ndizazzo d72791f
ci: execute canary Docker isolation probes
ndizazzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: Audit Depot PR isolation | ||
| description: Fail closed when a PR build receives Depot cache, registry, or compiler-cache authority. | ||
|
|
||
| inputs: | ||
| original_event_name: | ||
| description: Original event used to derive the trust boundary. | ||
| required: false | ||
| default: '' | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Verify PR runner has no privileged Depot credentials | ||
| shell: bash | ||
| env: | ||
| INPUT_ORIGINAL_EVENT_NAME: ${{ inputs.original_event_name }} | ||
| run: | | ||
| set -euo pipefail | ||
| original_event="${INPUT_ORIGINAL_EVENT_NAME:-${GITHUB_EVENT_NAME:-}}" | ||
| if [[ "$original_event" != "pull_request" && | ||
| "$original_event" != "pull_request_target" ]]; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| forbidden_names=( | ||
| DEPOT_CACHE_TOKEN | ||
| DEPOT_TOKEN | ||
| DEPOT_REGISTRY_PULL_TOKEN | ||
| DEPOT_REGISTRY_TOKEN | ||
| DEPOT_CACHE_URL | ||
| DEPOT_CACHE_API_URL | ||
| DEPOT_REGISTRY_URL | ||
| DEPOT_REGISTRY_HOST | ||
| SCCACHE_WEBDAV_ENDPOINT | ||
| SCCACHE_WEBDAV_TOKEN | ||
| SCCACHE_WEBDAV_USERNAME | ||
| SCCACHE_WEBDAV_PASSWORD | ||
| TURBO_TOKEN | ||
| TURBO_API | ||
| TURBO_TEAM | ||
| GOCACHEPROG | ||
| ) | ||
| for name in "${forbidden_names[@]}"; do | ||
| if [[ -n "${!name:-}" ]]; then | ||
| echo "PR runner received forbidden credential/cache authority: $name" >&2 | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| for endpoint_name in ACTIONS_CACHE_URL ACTIONS_RESULTS_URL; do | ||
| endpoint="${!endpoint_name:-}" | ||
| endpoint_lower="$(printf '%s' "$endpoint" | tr '[:upper:]' '[:lower:]')" | ||
| if [[ ! "$endpoint_lower" =~ ^https://([a-z0-9-]+\.)*actions\.githubusercontent\.com([/:]|$) ]]; then | ||
| echo "PR runner received a non-GitHub Actions endpoint: $endpoint_name" >&2 | ||
| exit 1 | ||
| fi | ||
| done | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| docker_config="${DOCKER_CONFIG:-${HOME:-}/.docker}/config.json" | ||
| if [[ -f "$docker_config" ]] && grep -Eiq 'depot\.dev' "$docker_config"; then | ||
| echo "PR runner has Depot registry authentication configured" >&2 | ||
| exit 1 | ||
| fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.