Repository navigation
feat: secure-by-default endpoint trust for ambient credentials - #590
Merged
Seth Juarez (sethjuarez) merged 15 commits intoOct 21, 2026
Merged
Conversation
Add spec section 2.5.1 Endpoint Trust, the untrusted_endpoint load error, the trustedEndpoints load option, and load conformance vectors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add core/endpoint_trust.py and a trusted_endpoints option on load()/load_async(); the vector adapter passes trustedEndpoints. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Some executors trim the connection apiKey and fall back to environment credentials when it is empty. A whitespace-only literal key therefore must not count as file-supplied. Update spec 2.5.1, add a conformance vector, and align the gate in all runtimes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment on lines
+454
to
+457
| catch (Exception error) | ||
| { | ||
| caught = error; | ||
| } |
Comment on lines
+468
to
+471
| catch (Exception error) | ||
| { | ||
| caught = error; | ||
| } |
Comment on lines
+482
to
+485
| catch (Exception error) | ||
| { | ||
| caught = error; | ||
| } |
Comment on lines
+496
to
+499
| catch (Exception error) | ||
| { | ||
| caught = error; | ||
| } |
Comment on lines
+510
to
+513
| catch (Exception error) | ||
| { | ||
| caught = error; | ||
| } |
Comment on lines
+524
to
+527
| catch (Exception error) | ||
| { | ||
| caught = error; | ||
| } |
Comment on lines
+538
to
+541
| catch (Exception error) | ||
| { | ||
| caught = error; | ||
| } |
Comment on lines
+552
to
+555
| catch (Exception error) | ||
| { | ||
| caught = error; | ||
| } |
Comment on lines
+566
to
+569
| catch (Exception error) | ||
| { | ||
| caught = error; | ||
| } |
Comment on lines
+580
to
+583
| catch (Exception error) | ||
| { | ||
| caught = error; | ||
| } |
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.
Summary
Prompty now refuses to load a
.promptyfile that would send ambient credentials to an endpoint chosen by the file. Ambient credentials are ones the file doesn't supply itself, such asDefaultAzureCredentialtokens,*_API_KEYenvironment variables, or OAuth/Foundry identity.The rule lives in the spec (§2.5.1), is pinned by conformance vectors in
schema/model/conformance/vectors/load.tsp, and is implemented the same way in all 7 runtimes (Python, TypeScript, C#, Go, Java, Rust, Swift).Rule (spec §2.5.1)
The check runs on the raw
model.connection, before any${...}is resolved.kind: reference.kind: keywith a non-blank literalapiKey. Anything else counts as ambient, including${env:...}keys, blank keys,oauth,foundry,anonymousand custom kinds.endpointortokenUrlgiven as a literal, a${file:}reference, or an${env:VAR:default}whose default is used becauseVARis unset.untrusted_endpoint.Trusted by default (https only):
api.openai.com,api.anthropic.com,*.openai.azure.com,*.services.ai.azure.com,*.cognitiveservices.azure.com,login.microsoftonline.com.Matching compares scheme + host + port exactly. A URL containing a backslash, or one that can't be parsed, is rejected.
Opt-out / migration
This is a behavior change. A file that pairs ambient credentials with a custom endpoint now fails to load until that endpoint is trusted. To trust it, use either:
trustedEndpointsload option (named per each runtime's conventions), orPROMPTY_TRUSTED_ENDPOINTSenvironment variable (comma-separated origins;*trusts all).Files that load the endpoint from the environment (
endpoint: ${env:AZURE_OPENAI_ENDPOINT}), or that supply a literal key, keep working unchanged.Validation
npm run generateregenerates with no diff.Release notes
This isn't marked as breaking (
!), to avoid a major-version bump across runtimes. The changelog should call out the new load-time check and the opt-out.