Skip to content

feat(hostmatch): match rules by source IP / CIDR#191

Open
drewstone wants to merge 1 commit into
ironsh:mainfrom
drewstone:tangle/0001-source-ip-rules
Open

feat(hostmatch): match rules by source IP / CIDR#191
drewstone wants to merge 1 commit into
ironsh:mainfrom
drewstone:tangle/0001-source-ip-rules

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What

Adds an optional source_ip field to a rule's config so a rule can match on the client source address (a CIDR or single IP) in addition to host. Adds Matcher.MatchesIP and a SourceMatcher on the compiled Rule.

Why

We run iron-proxy as the egress filter in front of many mutually-isolated sandbox containers. Matching on source IP lets a single proxy apply a different allowlist / secret-injection transform per source, instead of one proxy process per client — the routing primitive for a shared, multi-tenant egress proxy. We've carried this as a local patch in production; upstreaming so we can drop it.

Compatibility

Behaviour is unchanged when source_ip is unset — existing host-only rules match exactly as before.

Tests

This patch is production-proven in our fork but does not yet add unit tests for the source-IP path. Happy to add hostmatch table tests for MatchesIP + the combined host/source matching if you'd like them in this PR.

Add an optional `source_ip` field to rule config so a rule can match on
the client source address (CIDR or single IP) in addition to host. This
lets a single proxy apply different allowlists/transforms per source —
the routing primitive for a shared, multi-tenant egress proxy fronting
many isolated clients. Adds Matcher.MatchesIP and a SourceMatcher on the
compiled rule; behaviour is unchanged when source_ip is unset.
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