Repository navigation
Allow Gemfury's path-style S3 downloads for Gemfury jobs - #312
Open
v-robaiken wants to merge 1 commit into
Open
v-robaiken wants to merge 1 commit into
v-robaiken wants to merge 1 commit into
Conversation
Gemfury redirects some downloads to its bucket as a path-style URL on the shared S3 endpoint (s3.amazonaws.com/gemfury/...), which #288's accelerate hosts don't cover. Allowing s3.amazonaws.com as a host would expose every bucket, so add path-scoped redirect derivations: an exact host plus a literal path prefix, allowed for GET/HEAD only, and only for jobs holding a matching registry credential. Fixes #308 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 817c1703-3814-47a6-a9ea-41092ac242af
There was a problem hiding this comment.
🟡 Changes recommended
Startup validation currently accepts host and path-prefix configurations that can never match requests.
2 open findings
What changed in this PR
Adds credential-derived, path-scoped egress rules for secure Gemfury downloads through shared S3 endpoints.
Changes:
- Adds exact host/path-prefix matching for GET and HEAD requests.
- Configures
/gemfury/access ons3.amazonaws.com. - Adds security, validation, and regression tests.
| File | Description |
|---|---|
internal/handlers/egress_dynamic_hosts.go |
Implements credential-derived path rules. |
internal/handlers/egress_dynamic_hosts_test.go |
Tests matching and security boundaries. |
internal/handlers/egress_allowlist.go |
Integrates path-scoped request authorization. |
internal/handlers/egress_allowlist_defaults.yaml |
Adds the Gemfury S3 path rule. |
internal/handlers/egress_allowlist_defaults.go |
Validates path derivation configuration. |
.github/skills/add-egress-allowlist-domain/SKILL.md |
Documents path-scoped derivations. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+111
to
+112
| if p.Host == "" || isGlobPattern(p.Host) || strings.HasPrefix(p.Host, ".") { | ||
| return fmt.Errorf("derived_paths host %q (credential_host %q) must be an exact host", p.Host, d.CredentialHost) |
Comment on lines
+129
to
+130
| if strings.ContainsAny(prefix, "%\\?#*[") || strings.Contains(prefix, "//") { | ||
| return fmt.Errorf("must be a literal, normalized path") |
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.

Fixes #308
Problem
#288 lets jobs with a
*.fury.iocredential reach Gemfury's bucket through its Transfer Acceleration hosts. Some Gemfury accounts are redirected to the same bucket as a path-style URL on the shared S3 endpoint instead:Allowing
s3.amazonaws.comas a host is not an option. With path-style addressing, every bucket in S3 lives on that host, so the job could send data to any bucket.Fix
Add an optional
derived_pathslist toregistry_redirect_derivations. Each entry is an exact host plus a literal path prefix. It is allowed only when:derived;%2Fand%2etricks can't move the request into another bucket;.or..segments and no backslashes.At startup, prefixes must be a literal, normalized
/segment/ending in a slash, so/gemfurycan't also match/gemfury-attacker.Gemfury now uses this rule:
The existing host-only matching is unchanged; this adds one more way for a request to be allowed. I've updated the allowlist skill doc with when to use
derived_paths.Tests
+, and HEAD.gemfuryx,gemfury-attacker,GEMFURY);%2e%2e;%2F) and backslashes (%5C);