Repository navigation
Allowlist registry redirect targets for private registries - #341
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Redirect learning trusts plaintext source responses and misses redirects returned by later authentication retries.
2 open issues
What changed in this PR
This PR extends the proxy’s egress allowlist to support private registries that redirect downloads to customer-specific storage hosts, without adding broad static allowlist entries.
Changes:
- Learn exact HTTPS destination hostnames from eligible registry redirects.
- Protect learned hosts with a mutex and register a response hook.
- Add unit and end-to-end coverage for redirect learning and rejected destinations.
| File | Description |
|---|---|
proxy.go |
Registers the egress allowlist response hook. |
proxy_test.go |
Tests redirected downloads, credential isolation, and continued blocking of unrelated hosts. |
internal/handlers/egress_allowlist.go |
Adds redirect-source filtering and synchronized destination learning. |
internal/handlers/egress_allowlist_test.go |
Tests exact-host learning and rejection cases. |
Review effort: Balanced
2b80dfd to
bb8f9bb
Compare
|
For reference Reviewed PR: , no serious privacy or security issues. It only learns exact HTTPS hostnames from non-public private-registry redirects, never IPs, sends no credentials to learned hosts, and logs only the host. |


What are you trying to accomplish?
Self-hosted JFrog Artifactory instances redirect package downloads to presigned URLs on the customer's own S3 bucket (
jfrog-prod-<id>.s3.amazonaws.com). The egress allowlist covers JFrog's shared regional buckets but not these per-instance ones, and the bucket name can't be derived from the registry host. So with egress enforcement on, downloads fail even though the index lookups work.This PR adds
EgressAllowlistHandler.HandleResponse. When one of the job's private registries returns a redirect, the proxy allows the redirect's exact HTTPS destination host for the rest of the job.Anything you want to highlight for special attention from reviewers?
httpstarget. IP addresses are never learned, and sibling or parent hosts stay blocked.jfrog-prod-*.s3.amazonaws.comwildcard is unsafe because anyone can register a bucket with a matching name. Following the actual redirect relies on a registry the job already trusts.RWMutex.How will you know you've accomplished your goal?
TestProxyEgressAllowlistEnforceAllowsPrivateRegistryRedirectTarget: the bucket returns 403 before the redirect. A download from the registry then follows the redirect and gets 200, with no credential sent to the bucket. Other hosts stay blocked.httptargets, IP addresses, and a missingLocation).go test -race -count=1 ./...: passed.golangci-lint: not run; it isn't installed locally.Checklist