feat(console): let a deployment name extra sandbox entitlements hosts - #1551
Open
0xAlcibiades wants to merge 2 commits into
Open
feat(console): let a deployment name extra sandbox entitlements hosts#15510xAlcibiades wants to merge 2 commits into
0xAlcibiades wants to merge 2 commits into
Conversation
sandbox_entitlements_hosts is the Console's own CENTAUR_CONSOLE_URL and nothing else, so the proxy injects the sandbox entitlements credential for exactly one host: the in-cluster address. That is unreachable for a deployment whose sandboxes are denied the cluster service range -- which the proxy's own upstream_deny_cidrs exists to do, so sandboxes cannot reach arbitrary in-cluster services. Such a deployment has to front the Console on another address, and then the request arrives with no credential and is refused, because no injection rule matches the host it actually used. Reaching the Console needs a host outside the range; getting a credential needs the host to be inside it. The two are mutually exclusive as shipped, and the deny list cannot be relaxed without opening every in-cluster service to every sandbox. CENTAUR_CONSOLE_ENTITLEMENTS_HOSTS names additional hosts for the same credential. It adds to the default rather than replacing it, so the in-cluster address keeps working for the sync path that already uses it, and it accepts a URL or a bare host because the value is usually copied from whatever CENTAUR_CONSOLE_URL is set to. Hosts are normalized and de-duplicated through the existing helper, so rule matching does not hinge on case or a trailing dot.
The schema entry landed as a member of the allowedHosts object instead of a sibling of it, so console.entitlementsHosts -- the value the template actually reads -- was not what the schema validated, and allowedHosts grew a spurious array member of its own.
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.
Closes #1558.
Part of #1486 — the auth half, direction 2 of the three that issue's thread lists.
The bind
upstream_deny_cidrsblocks the cluster service range by design, so sandboxescannot reach arbitrary in-cluster services. That also blocks the Console, and it
cannot be relaxed without opening everything else.
Fronting the Console on an address outside the range gets past the network
block, and then 403s.
sandbox_entitlements_hostsis:One host, from the Console's own env, with no config, admin API or DB row
overriding it. So the injection rule only ever matches the in-cluster address —
the one the sandbox cannot use. Reaching the Console needs a host outside the
range; getting a credential needs the host inside it. As shipped those are
mutually exclusive, which is why this is not solvable in a deployment's own
values.
Change
CENTAUR_CONSOLE_ENTITLEMENTS_HOSTS(chart:console.entitlementsHosts) names additional hosts for the same credential.for the sync path that already uses it.
whatever
CENTAUR_CONSOLE_URLis set to, and a URL silently producing anon-matching rule is the failure this is meant to remove.
Principal.normalize_hosts, so matchingdoes not hinge on case, whitespace or a trailing dot, and a host that
duplicates the default collapses.
Unset, nothing changes.
Why this direction
The issue lists three shapes. Exempting the control plane from the forwarded
deny is the narrowest, but the deny is enforced by the proxy binary rather than
by this repo, so it is not a change that can be made here. Exposing
console.extraEnvis the broadest and least targeted. This one is the smallestchange inside centaur that actually unblocks the pair.
It is the auth half only. A deployment still has to front the Console on a
reachable address; this makes that address work instead of 403ing.
Testing
Four new model tests: the default is the console URL alone; a configured host
adds to it rather than replacing it; a URL and a bare host are both accepted;
and values are normalized and de-duplicated.
I could not run them. The console suite needs
bundle installand aprepared database, and this machine has Ruby 2.6 against a Gemfile.lock wanting
bundler 4.0.10, so neither
bin/rails testnorbin/rubocopwould start. Bothfiles pass
ruby -c, andfilter_map/index_withare already used elsewherein this app, but the tests themselves rest on CI. Flagging that rather than
implying otherwise.
helm lintpasses, the values schema stays valid, andhelm templaterendersCENTAUR_CONSOLE_ENTITLEMENTS_HOSTSonly when the value is set.