Skip to content

fix: reject an external IP that cannot be an IP address - #75

Open
bsinou wants to merge 1 commit into
devfrom
fix/external-ip-sed-injection-dev
Open

bsinou wants to merge 1 commit into
devfrom
fix/external-ip-sed-injection-dev

Conversation

@bsinou

@bsinou bsinou commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Port of #64 to dev. The commit is cherry-picked from #64 unchanged and applies cleanly.

The main container puts the external IP into a sed expression delimited by ;. A value from the free-form wire.com/external-ip node annotation that contains ; breaks the expression, and the container stops with an error that doesn't name the cause. The init container now rejects any value with a character an IP address can't hold (allowed: 0-9a-fA-F.:%) and logs the node and the value.

See #64 for the full analysis and the manual test matrix.

@bsinou
bsinou requested a review from a team as a code owner November 11, 2026 07:41
The main container puts the discovered external IP into a sed expression to fill
the config template. The expression uses ";" as its delimiter. An address that
contains ";" therefore becomes part of the expression instead of data. sed then
fails and set -e stops the container, with an error that does not name the
cause.

The node ExternalIP field cannot hold such a value. The on-prem fallback
annotation wire.com/external-ip is free-form and can.

Check the value in the init container, where it first arrives, and reject it if
it holds a character that an IP address cannot hold. The message names the node
and the value. The allowed set is 0-9, a-f, A-F, ".", ":" and "%", so IPv4,
IPv6, and an IPv6 zone index all pass. The set also excludes "&" and "\", which
are the other two characters with a meaning in a sed replacement.

Render-time substitution is not an option here, unlike in the sftd chart. The
values are only known at run time, and they go into a config file.

(cherry picked from commit 029956f)
@bsinou
bsinou force-pushed the fix/external-ip-sed-injection-dev branch from 1700019 to d34166f Compare November 11, 2026 12:11

This branch has not been deployed

No deployments
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.

2 participants