Skip to content

SSRF-aware SSO domain provisioning (on top of #6521)#6522

Open
aerosol wants to merge 4 commits into
ip-tools-ssrf-clientfrom
ip-tools-ssrf-client-sso
Open

SSRF-aware SSO domain provisioning (on top of #6521)#6522
aerosol wants to merge 4 commits into
ip-tools-ssrf-clientfrom
ip-tools-ssrf-client-sso

Conversation

@aerosol

@aerosol aerosol commented Jul 21, 2026

Copy link
Copy Markdown
Member

Changes

Base branch: ip-tools-ssrf-client (#6521)

SSRF-aware SSO domain provsioning verification

@aerosol
aerosol requested review from a team and cnkk July 21, 2026 06:30
@aerosol
aerosol marked this pull request as ready for review July 21, 2026 06:30
Comment thread config/runtime.exs
Comment on lines +1105 to +1107
allow_reserved_ips?:
config_env() in [:dev, :ce_dev] and
get_bool_from_path_or_env(config_dir, "ALLOW_RESERVED_IPS", false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion, non-blocking: Rather than an on-off switch, I suggest we configure a whitelist of reserved IPs. That way, we still exercise the feature in dev

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My network setup is different than yours, someone's docker is different than those, I don't want to deal with that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, needing to adjust the whitelist for my particular dev env is the lesser evil here, compared to disabling the logic completely in dev. To be able to disable it, we create code paths around the feature which may become exploitable in prod.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you exploit that on prod?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that's a valid question, but more appropriate if this were already deployed to prod and we were discussing whether it needs to be patched, and how urgently.

It's not yet, so IMO the matter to resolve is whether a whitelist config is sufficiently better than an on-off config to justify refactoring this PR.

My arguments are that a whitelist keeps exercising the feature even in dev (good for parity) and that having a code path to toggle it off is riskier for us (we mustn't forget to use the toggled-on path when working on XYZ) than having it always on but respecting a whitelist. The counterargument is that a whitelist may cause dev frustration when setting up a non-standard dev env.

@zoldar zoldar Jul 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guarding that switch with config_env is strong enough measure to make it unexploitable in production. The same way it is for test routes in the router or other parts of logic guarded in a similar fashion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zoldar But the true/false config value isn't the guard. skip_checks? propagating through the application code is.

By going the whitelist route, there's no need for skip_checks? code path: in every env - dev, test, prod - we will go through the all the motions to guard against SSRF, with one of the checks being the whitelist.

In some envs, the whitelist will have a few values. In prod, no values.

It's common practice in this repo to have these separate code paths, that's why I'm not requesting changes here, just trying to highlight how there's other ways as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still applies a safe default, like in many other similar cases.

The whitelist will IMHO be a PITA to manage, adding complexity for little benefit.

Comment thread lib/ip/tools.ex

def allowed?(ip) when is_tuple(ip) and tuple_size(ip) in [4, 8] do
not reserved?(ip)
case allow_reserved_ips?() do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if should be fine here?

Comment thread config/runtime.exs
Comment on lines +1105 to +1107
allow_reserved_ips?:
config_env() in [:dev, :ce_dev] and
get_bool_from_path_or_env(config_dir, "ALLOW_RESERVED_IPS", false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still applies a safe default, like in many other similar cases.

The whitelist will IMHO be a PITA to manage, adding complexity for little benefit.

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.

3 participants