Validate issuer/URL by scheme and host instead of string prefix#62
Merged
Merged
Conversation
is_issuer_known accepted any issuer that started with the expected string "https://ci.eclipse.org". A string-prefix check treats the issuer as opaque text, so URLs that only begin with those characters but resolve to a different host were accepted -- e.g. a userinfo form ("https://ci.eclipse.org@other.host") or a suffix form ("https://ci.eclipse.org.other.host"). The issuer is then used for OIDC discovery, so it must genuinely point at the expected host. Match issuers/URLs on their parsed scheme and host (f"{scheme}://{hostname}") against a base-URL constant: - models.is_issuer_known: compare against JENKINS_ISSUER_BASE_URL, mirroring how the GitHub issuer is matched against GITHUB_ISSUER. - cli add-workload: apply the same scheme+host comparison to both the GitHub (GITHUB_BASE_URL) and Jenkins (JENKINS_ISSUER_BASE_URL) cases, replacing the bare netloc equality and startswith checks. This also enforces the https scheme on the GitHub repo URL. Rename the constant JENKINS_ISSUER_PREFIX to JENKINS_ISSUER_BASE_URL and add GITHUB_BASE_URL. Add tests for the userinfo/suffix host constructions, non-https and malformed issuers, and the disguised/non-https URLs in the CLI (asserting no network call or DB write happens for a rejected URL). Update the authentication flow in DESIGN.md to describe host-based validation. Signed-off-by: Lukas Puehringer <lukas.puehringer@eclipse-foundation.org> Assisted-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mbarbero
approved these changes
Jul 1, 2026
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.
is_issuer_knownaccepted any issuer that started with the expected string "https://ci.eclipse.org". A string-prefix check treats the issuer as opaque text, so URLs that only begin with those characters but resolve to a different host were accepted -- e.g. a userinfo form ("https://ci.eclipse.org@other.host") or a suffix form ("https://ci.eclipse.org.other.host"). The issuer is then used for OIDC discovery, so it must genuinely point at the expected host.Match issuers/URLs on their parsed scheme and host (
f"{scheme}://{hostname}") against a base-URL constant:models.is_issuer_known: compare againstJENKINS_ISSUER_BASE_URL, mirroring how the GitHub issuer is matched againstGITHUB_ISSUER.cli add-workload: apply the same scheme+host comparison to both the GitHub (GITHUB_BASE_URL) and Jenkins (JENKINS_ISSUER_BASE_URL) cases, replacing the bare netloc equality and startswith checks. This also enforces the https scheme on the GitHub repo URL in the cli. The input to the cli is trustworthy, but it doesn't hurt to check to avoid foot-guns.Rename the constant
JENKINS_ISSUER_PREFIXtoJENKINS_ISSUER_BASE_URLand addGITHUB_BASE_URL.Add tests for the userinfo/suffix host constructions, non-https and malformed issuers, and the disguised/non-https URLs in the CLI (asserting no network call or DB write happens for a rejected URL). Update the authentication flow in DESIGN.md to describe host-based validation.
Assisted-by: Claude Opus 4.8 (1M context) noreply@anthropic.com (reviewed, edited, and signed off by me)