Add egress control through allowlist to prevent source code exfiltration - #230
Draft
AbhishekBhaskar wants to merge 2 commits into
Draft
Add egress control through allowlist to prevent source code exfiltration#230AbhishekBhaskar wants to merge 2 commits into
AbhishekBhaskar wants to merge 2 commits into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What are you trying to accomplish?
Add domain-based egress control to the proxy to help prevent source-code exfiltration during Dependabot update jobs. Even when an attacker abuses a legitimately-configured registry token (e.g. Artifactory/Nexus), traffic to unknown hosts like
evil.comshould be visible and, eventually, blockable — something the earlier Method-header approach could not address.This PR lands the observe (log-only) foundation: it builds a per-job allowlist and logs any request to a host not on it, without changing traffic behavior by default.
Anything you want to highlight for special attention from reviewers?
egress_allowlistconfig block:observe(log non-allowlisted requests, still allow) andenforce(drop with 403, matching the existingblockMetadataAPIHostsresponse). Both defaultfalse⇒ fail-open, so existing jobs and GHES are unaffected.PACKAGE_MANAGER. Credential-derived, OIDC-derived, and backend-supplieddomainsare deliberately deferred.helpers.HostMatchesDomainuses a leading-dot suffix check so one entry covers subdomains (npmjs.org→registry.npmjs.org) while lookalikes likeevilnpmjs.orgare rejected.proxy.goright after request logging and before all credential-injecting handlers, so drops/logs happen before any auth is added. Works for HTTP and MITM'd HTTPS.enforceis wired but off by default; the intended rollout isobservefirst, then flipenforceper-ecosystem.How will you know you've accomplished your goal?
HostMatchesDomainboundary matrix (subdomains, case/trailing-dot normalization, lookalike negatives); handler flag matrix (fail-open, observe-logs-allows, enforce-403, observe+enforce), GitHub-infra always allowed, per-ecosystem defaults applied and cross-ecosystem defaults rejected.proxy_test.go): end-to-end through MITM — non-allowlisted host returns 403 underenforceand 200 +* egress not allowlisted <host>log underobserve.go build ./...andgo test ./...pass across all packages.Checklist