Grid credential inject#386
Draft
nerdalert wants to merge 4 commits into
Draft
Conversation
nerdalert
force-pushed
the
grid-credential-inject
branch
from
July 16, 2026 02:47
1ad1e9f to
37fe9b5
Compare
praxis-bot
reviewed
Jul 23, 2026
praxis-bot
left a comment
Collaborator
There was a problem hiding this comment.
Review: Grid credential inject
Well-structured PR. The two-filter design (grid_route writes credential reference metadata, grid_credential_inject reads it and injects the bearer token) is clean separation of concerns. Security properties are solid: tokens stored in Zeroizing<String>, never written to metadata/traces/error bodies, fail-closed on mismatch. Config validation is thorough with deny_unknown_fields on all structs and bounded field lengths.
Findings
| Severity | Count |
|---|---|
| Critical | 0 |
| Large | 0 |
| Medium | 4 |
See inline comments for details. Summary:
- [Medium] Doc table uses
secret_ref(snake_case) but YAML config requiressecretRef(camelCase) due to#[serde(rename_all = "camelCase")]onCandidateCredential. Will cause config parsing errors for users following the docs. - [Medium] No functional integration test for
grid-route-mcp.yamlexample config. Only inference routing has an integration test intests/schema/tests/suite/examples/ai/grid_route.rs. Project conventions require functional integration tests for all example configs. - [Medium] No example config or functional integration test for
grid_credential_inject. Unit tests are thorough, but project conventions require an example config inexamples/configs/and a corresponding integration test for new capabilities. - [Medium] Test
credential_not_written_to_route_metadatahas a misleading name and checks keys that would never be written. Credential references ARE written to route metadata byrecord_route_decision(undergrid.route.credential.*). The test only checks non-existent key patterns (grid.route.credential,grid.route.strategy,grid.route.secret_ref,grid.route.token), which pass trivially. The companion testcredential_reference_written_to_route_metadatadoes the meaningful positive assertion.
Add AI-owned grid_route inference and MCP tool routing under praxis-ai-filters and register it from praxis-ai-proxy. The filter selects ctx.cluster from static candidates, prefers fresh candidates over stale, applies local-site preference on equal freshness, and routes MCP tools/call by mcp metadata with precedence over model-header routing. Add docs, examples, and schema coverage for the new filter. Signed-off-by: Brent Salisbury <bsalisbu@redhat.com>
Add an end-to-end schema test for the MCP grid_route example. The test runs the mcp filter, routes a tools/call request through grid_route, and verifies the selected tool-owning backend responds. Signed-off-by: Brent Salisbury <bsalisbu@redhat.com>
nerdalert
force-pushed
the
grid-credential-inject
branch
from
July 24, 2026 03:10
37fe9b5 to
19f63a1
Compare
Address PR review feedback for Grid credential injection. Document the camelCase secretRef route credential key, replace a misleading route metadata test with a token-value absence check, and add a proxy-level example test for grid_route followed by grid_credential_inject. Signed-off-by: Brent Salisbury <bsalisbu@redhat.com>
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.
Dependency
grid_route).It is intentionally stacked on top of the
grid_routework becausegrid_credential_injectconsumes route metadata written bygrid_routeafter candidate selection. This PR will remain a draft until #339 merges.Summary
Adds native AI Grid per-candidate credential injection to the AI gateway.
This PR teaches the AI data plane how to carry a credential reference from
grid_routeand inject the correct outbound provider credential after route selection. The Grid overlay still contains only safe Secret locating information, never token bytes.The request-time chain is:
Why
AI Grid needs to support API-backed and cloud-backed providers without requiring workloads to know or carry provider credentials.
A workload should authenticate to its local gateway with enterprise auth. The gateway should then:
authorize the workload,
route to the selected provider/capability,
inject the provider-side credential required for that upstream.
This keeps provider API keys out of clients, route overlays, route metadata, and logs.
• AI Grid needs to support API-backed and cloud-backed providers without requiring workloads to know or carry provider credentials.
A workload should authenticate to its local ingress gateway with enterprise auth. The Grid/Praxis path should then:
This keeps provider credential values out of clients, routing overlays, route metadata, ConfigMaps, and logs.
What changed
grid_route
grid_route now accepts an optional candidate credential reference:
The credential reference is carried through candidate validation and route selection.
When a credential-bearing candidate is selected, grid_route writes these in-process metadata keys:
These values contain only the credential reference, never the token.
New grid_credential_inject filter
Adds a new AI Grid filter:
Supported token sources:
Exactly one source must be configured per credential entry.
The file source is the production-oriented Kubernetes path: mount a Secret into the gateway pod and point file at the mounted token file. This keeps token bytes out of Praxis ConfigMaps.
Registry
Registers both Grid filters in the AI server registry:
Adds a registry smoke test to ensure the full registry includes both filters and does not hit duplicate grid_route registration.
Security properties
Token bytes do not appear in:
Token bytes may exist only in:
The filter fails closed with HTTP 503 when:
Validation
This PR adds validation for credential-bearing candidates:
Relationship to future auth work
This does not replace inbound caller authentication or authorization. It only handles outbound provider credential injection after Grid route selection.
Expected boundary:
Inbound auth/policy validates who the caller is and what they may access.
AI Grid routing chooses the provider/capability.
grid_credential_injectinjects the credential required by the selected upstream provider.This PR intentionally keeps the credential injector Grid-specific for now. It can be generalized later if the same route-selected credential pattern is needed outside Grid.
This unblocks the Grid operator work to project
InferenceProvider.spec.auth.secretRefthrough the overlay and prove API-provider fallback without exposing provider tokens in routing data or ConfigMaps.Validation
cargo test -p praxis-ai-filters grid
cargo test -p praxis-ai-proxy full_registry_includes_grid_credential_inject_without_duplicate_grid_route
cargo xtask env verify-api-fallback-native -c tests/env/operator-routing.toml
cargo xtask env verify-api-fallback -c tests/env/operator-routing.toml