Add registry redirected urls to registryRedirectHosts in egress allowlist derivation - #288
Merged
v-abhishekbhaskar merged 2 commits intoOct 2, 2026
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The narrowly scoped derivation is exact, safely normalized, and comprehensively tested.
Review effort: Balanced
Findings: None
What changed in this PR
Adds per-job egress derivation for packagecloud and Gemfury redirect storage hosts without globally exposing multi-tenant storage.
Changes:
- Adds fixed redirect-host derivation with hostname normalization.
- Adds positive and security-boundary regression tests.
| File | Description |
|---|---|
internal/handlers/egress_dynamic_hosts.go |
Derives provider redirect hosts from matching credentials. |
internal/handlers/egress_dynamic_hosts_test.go |
Tests allowed redirects and blocked lookalikes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
v-sachin-sandhu
previously approved these changes
Oct 2, 2026
|
@v-abhishekbhaskar Seems like we are doing this multiple times, it possible to make this an option in out allowlist yaml? |
This was referenced Oct 2, 2026
v-sachin-sandhu
approved these changes
Oct 2, 2026
Contributor
Author
|
@v-robaiken I've added
|
v-abhishekbhaskar
deleted the
abhishekbhaskar/add-redirect-derivations-allowlist
branch
October 2, 2026 20:33
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?
Since
proxy-egress-enforcewas enabled, jobs using a packagecloud.io or Gemfury registry fail withprivate_source_authentication_failure. The authenticated registry request succeeds, but both providers 302-redirect the actual file download to a signed URL on a storage host that appears in no credential field, socredentialHostsnever allows it:packagecloud.io→d3fo0g5hm7lbuv.cloudfront.net*.fury.io→gemfury.s3-accelerate.dualstack.amazonaws.comandgemfury.s3-accelerate.amazonaws.comThis derives those hosts per job in
registryRedirectHosts, alongside the existing ECR starport bucket, and replaces the stackedifs there with a{credentialHost, derived}table.Anything you want to highlight for special attention from reviewers?
Why not the static defaults: each target is one bucket shared by all of that provider's tenants, with the tenant in the URL path. Per
add-egress-allowlist-domain, allowing such a host globally would expose every tenant's content to every job. Deriving per job keeps it closed for everyone who doesn't already use the registry.Why the derivation is safe: every derived host is a constant — nothing from the credential is interpolated — and dynamic hosts are matched exactly, so a crafted credential can at worst open that one provider bucket for its own job. ECR stays outside the table because it is the only case that interpolates a credential-derived region, so it keeps its anchored regex.
Trailing dot: credential hosts are now normalised before matching, so
pypi.fury.io.derives likepypi.fury.io.How will you know you've accomplished your goal?
Reproduction of the redirect (packagecloud, public URL):
The target serves
403to anything unsigned.New tests in
internal/handlers/egress_dynamic_hosts_test.go:evil.<host>), lookalikes (gemfuryx…,<host>.attacker.com), the non-accelerate bucket (gemfury.s3.amazonaws.com), sibling tenants (d1ii4ma7ymllif.cloudfront.net), and the shared parents (cloudfront.net,attacker.s3-accelerate…).fury.io,pypi.fury.io.evil.com,pypifury.io,evil.packagecloud.ioorpackagecloud.io.attacker.com.Checklist