Repository navigation
Fix OIDC JWKS URL allowlisting #312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6e92acb
fix: validate oidc jwks hosts
seonghobae 3d145d1
fix: enforce dav owner scope
seonghobae f62e5e8
fix: fail closed on strix provider signals
seonghobae 35edd5f
test: make strix provider-signal mode explicit
seonghobae edb3a56
fix: run strix privileged steps from trusted workspace
seonghobae 49cf0e7
ci: bound strix pr scan batches
seonghobae 64c62dc
fix: pin llm provider dns connections
seonghobae 5896902
fix: sanitize email display responses
seonghobae 469785e
fix: harden oidc and pr scan inputs
seonghobae 692e2cc
fix: make strix pr scope explicit
seonghobae 34b8e35
fix: disable strix pr lifecycle scripts
seonghobae 2447daf
fix: keep strix workflow env keys unique
seonghobae 69421c4
fix: validate strix pr sha inputs
seonghobae 24cc2a5
fix: derive session verifier server side
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import ipaddress | ||
| from urllib.parse import urlsplit | ||
|
|
||
|
|
||
| def parse_allowed_hosts(raw_hosts: str) -> frozenset[str]: | ||
| hosts: set[str] = set() | ||
| for raw_host in raw_hosts.split(","): | ||
| host = _normalize_host(raw_host) | ||
| if host: | ||
| hosts.add(host) | ||
| return frozenset(hosts) | ||
|
|
||
|
|
||
| def validate_https_url_host( | ||
| setting_name: str, | ||
| url_value: str, | ||
| allowed_hosts: frozenset[str], | ||
| allowed_hosts_setting_name: str, | ||
| ) -> None: | ||
| parsed = urlsplit(url_value) | ||
| if parsed.scheme.lower() != "https": | ||
| raise ValueError(f"{setting_name} must use https") | ||
| if parsed.username or parsed.password: | ||
| raise ValueError(f"{setting_name} must not include userinfo") | ||
| if parsed.fragment: | ||
| raise ValueError(f"{setting_name} must not include a fragment") | ||
| if not parsed.hostname: | ||
| raise ValueError(f"{setting_name} must include a host") | ||
|
|
||
| host = _normalize_host(parsed.hostname) | ||
| if host not in allowed_hosts: | ||
| raise ValueError( | ||
| f"{setting_name} host must be listed in {allowed_hosts_setting_name}" | ||
| ) | ||
| _reject_unsafe_ip_literal(setting_name, host) | ||
|
|
||
|
|
||
| def _normalize_host(raw_host: str) -> str: | ||
| host = raw_host.strip().lower().rstrip(".") | ||
| if host.startswith("[") and host.endswith("]"): | ||
| host = host[1:-1] | ||
| return host | ||
|
|
||
|
|
||
| def _reject_unsafe_ip_literal(setting_name: str, host: str) -> None: | ||
| try: | ||
| ip_address = ipaddress.ip_address(host) | ||
| except ValueError: | ||
| if host == "localhost" or host.endswith(".localhost"): | ||
| raise ValueError(f"{setting_name} host must not be localhost") | ||
| return | ||
|
|
||
| if not ip_address.is_global: | ||
| raise ValueError(f"{setting_name} IP host must be globally routable") |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.