Skip to content

Add --trust-proxy flag for opt-in X-Forwarded-For trust#136

Merged
ganto merged 6 commits into
mainfrom
feature/refactor-default-args
May 16, 2026
Merged

Add --trust-proxy flag for opt-in X-Forwarded-For trust#136
ganto merged 6 commits into
mainfrom
feature/refactor-default-args

Conversation

@ganto
Copy link
Copy Markdown
Owner

@ganto ganto commented May 16, 2026

No description provided.

ganto and others added 6 commits May 16, 2026 19:06
Replace the injectServeDefault() shim that prepended "serve" to
os.Args with a pure defaultArgs() function and cobra.SetArgs(),
eliminating global state mutation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace implicit echo XFF trust (loopback/link-local/private by default)
with an explicit opt-in via --trust-proxy / PKGPROXY_TRUST_PROXY. When
unset, ExtractIPDirect() is used and XFF is ignored entirely. Accepted
values: none, loopback, private, CIDR, or bare IP (promoted to /32 or
/128). Invalid or mixed-with-none entries fail startup with a clear error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Prevents duplicate entries (e.g. 'none,none' or a repeated IP) from
triggering a spurious 'cannot be combined' error. Adds test cases for
both duplicate 'none' and duplicate IP inputs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ganto ganto merged commit b754fdf into main May 16, 2026
21 checks passed
@ganto ganto deleted the feature/refactor-default-args branch May 16, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant