-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(proxy): bind static credentials to provider endpoints #2510
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
Open
johntmyers
wants to merge
32
commits into
main
Choose a base branch
from
fix/static-credential-endpoint-binding
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7,486
−827
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
9159d64
feat(proxy): bind static credentials to provider endpoints
johntmyers f88cb6a
test(e2e): verify static credential endpoint isolation
johntmyers eea4a8f
docs(provider): explain static credential endpoint binding
johntmyers 15c4318
fix(e2e): use valid endpoint isolation fixtures
johntmyers 29397ac
docs(provider): explain static credential endpoint binding
johntmyers b369444
fix(credentials): preserve binding identity across rotations
johntmyers 1e9b2f9
fix(proxy): enforce bindings across request lifecycle
johntmyers da55766
fix(proxy): close credential relay gaps
johntmyers 30ed029
docs(credentials): clarify binding failure behavior
johntmyers d6bf3b3
fix(credentials): hash selected provider profile scope
johntmyers ae41043
fix(proxy): resolve credentials after request admission
johntmyers 340330a
docs(credentials): clarify binding failure diagnostics
johntmyers d88eb41
fix(proxy): align single-route credential denials
johntmyers b80d802
fix(credentials): harden endpoint-bound rotation
johntmyers 1364019
fix(credentials): enforce identity and authority binding
johntmyers 2b40ebb
fix(credentials): snapshot provider environment atomically
johntmyers 795430f
test(e2e): include authority port in query proxy requests
johntmyers dc83a25
fix(credentials): close credential revocation gaps
johntmyers 5259626
docs(proxy): explain authority mismatch diagnostics
johntmyers 80e1940
fix(credentials): enforce binding lifecycle invariants
johntmyers 7365c5c
fix(provider): reject credential config collisions
johntmyers b67ff11
fix(network): capture credential scope atomically
johntmyers 6e3d5fc
fix(network): distinguish origin and absolute targets
johntmyers 08becd9
fix(provider): isolate endpointless profile credentials
johntmyers 3e2a0a0
fix(network): normalize IPv6 request authorities
johntmyers aeb5238
docs(credentials): clarify endpointless profile isolation
johntmyers e02c5c8
feat(policy): bind endpointless provider credentials
johntmyers b8d754c
fix(credentials): use current GCP placeholder revision
johntmyers ed48716
docs(providers): explain policy credential bindings
johntmyers 85db9dc
test(credentials): cover endpointless fail-closed invariant
johntmyers c126cf9
test(policy): expect ambiguity rejection at creation
johntmyers b42e2a6
test(server): authenticate rebased policy requests
johntmyers 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
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,39 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| //! Canonical provider endpoint path matching shared by policy and runtime code. | ||
|
|
||
| /// Return whether `path` is selected by a provider endpoint path pattern. | ||
| /// | ||
| /// Empty paths and `**` match every request path. A trailing `/**` matches the | ||
| /// named path itself and every descendant. Other patterns use glob semantics. | ||
| #[must_use] | ||
| pub fn matches(pattern: &str, path: &str) -> bool { | ||
| if pattern.is_empty() || pattern == "**" || pattern == "/**" { | ||
| return true; | ||
| } | ||
| if pattern == path { | ||
| return true; | ||
| } | ||
| if let Some(prefix) = pattern.strip_suffix("/**") { | ||
| return path == prefix || path.starts_with(&format!("{prefix}/")); | ||
| } | ||
| glob::Pattern::new(pattern).is_ok_and(|glob| glob.matches(path)) | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::matches; | ||
|
|
||
| #[test] | ||
| fn matches_canonical_endpoint_patterns() { | ||
| assert!(matches("", "/v1/messages")); | ||
| assert!(matches("/**", "/v1/messages")); | ||
| assert!(matches("/v1/**", "/v1")); | ||
| assert!(matches("/v1/**", "/v1/messages")); | ||
| assert!(matches("/v*/messages", "/v1/messages")); | ||
| assert!(matches("/v1/*", "/v1/chat/messages")); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That actually check the same behaviour as for |
||
| assert!(!matches("/v1/**", "/v2/messages")); | ||
| assert!(!matches("/v1/*/messages", "/v1/chat/completions")); | ||
| } | ||
| } | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
glob::Pattern::matches()call here uses defaultMatchOptionswhererequire_literal_separatorisfalse, so*matches across/path separators. The test at line 35 confirms this is intentional:matches("/v1/*", "/v1/chat/messages")returnstrue.This makes
*and/**functionally equivalent for credential binding, which reduces the pattern language's expressiveness. Operators familiar with HTTP routing conventions (where*matches a single path segment) may be surprised.Have you considered using
glob::MatchOptions { require_literal_separator: true, ..Default::default() }so that*matches a single path component and**matches across separators? That would give profile authors two distinct tools:/v1/*matches/v1/chatbut not/v1/chat/completions(single segment)/v1/**matches/v1/chat,/v1/chat/completions,/v1/admin/secrets(all descendants)This is more flexible for fine-grained credential binding, for example binding to
/v1/*/completionswithout inadvertently covering/v1/admin/keys. It also aligns with the semantics already used in the network policyrulespath globs, which would keep operator mental models consistent.If the current catch-all behavior for
*is preferred, a comment here explaining the deliberate choice would help future readers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also https://github.com/NVIDIA/OpenShell/pull/2510/changes#diff-218f32b3113bf219a24d7d6726fd7401d9593bac7bb4a449845661dfb3fa2e23R35