Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
357 commits
Select commit Hold shift + click to select a range
844a424
Say a Temporary target is also gone after a reinitialization
varunj-msft Nov 6, 2026
ebd1042
Say which target types can be saved, and mark a refused save
varunj-msft Nov 6, 2026
d3a8d2e
Save targets from the New Target dialog and label where each comes from
varunj-msft Nov 6, 2026
7d9ac2f
Log why storage is unavailable, without its path or URL
varunj-msft Nov 7, 2026
7b5bfeb
Merge the storage error logging
varunj-msft Nov 7, 2026
22806d8
Merge the storage error logging
varunj-msft Nov 7, 2026
34011c9
Hide a restore message with a percent escape, which can hide a creden…
varunj-msft Nov 7, 2026
8a0113f
Merge the storage error logging and the percent-escape fix
varunj-msft Nov 7, 2026
8d51b6c
Merge the storage error logging and the percent-escape fix
varunj-msft Nov 7, 2026
6ddd960
Merge the storage error logging and the percent-escape fix
varunj-msft Nov 7, 2026
91bb36b
Merge the storage error logging and the percent-escape fix
varunj-msft Nov 7, 2026
ad7cb29
Merge the storage error logging and the percent-escape fix
varunj-msft Nov 7, 2026
dc4125c
Stop a launch whose script catches the duplicate-name error for a sav…
varunj-msft Nov 7, 2026
febc8c3
Merge the duplicate-name refusal for saved entries
varunj-msft Nov 7, 2026
303dfa8
Merge the duplicate-name refusal for saved entries
varunj-msft Nov 7, 2026
6abde9f
Merge the duplicate-name refusal for saved entries
varunj-msft Nov 7, 2026
e03fd18
Merge origin/main
varunj-msft Nov 7, 2026
36462db
Merge origin/main
varunj-msft Nov 7, 2026
37f9522
Merge origin/main
varunj-msft Nov 7, 2026
b6ad630
Merge origin/main
varunj-msft Nov 7, 2026
031dc61
Merge origin/main
varunj-msft Nov 8, 2026
7f8ab0d
Merge origin/main
varunj-msft Nov 8, 2026
19205b1
Import the saved recipe models from their package, as main now requires
varunj-msft Nov 8, 2026
0348a0b
Merge origin/main
varunj-msft Nov 8, 2026
bba3afd
Import from public packages, as main now requires
varunj-msft Nov 8, 2026
d4ccd50
Merge origin/main
varunj-msft Nov 8, 2026
ed01798
Merge origin/main
varunj-msft Nov 8, 2026
98766ec
Record a saved entry's name clash wherever a launch script can catch it
varunj-msft Nov 8, 2026
6fb1e00
Merge origin/main
varunj-msft Nov 8, 2026
405c2bd
Import from public packages, as main now requires
varunj-msft Nov 8, 2026
d35eea9
Merge origin/main
varunj-msft Nov 8, 2026
9afbd2c
Merge origin/main
varunj-msft Nov 8, 2026
13bd3ab
Check a target that takes no credentials as the default auth mode
varunj-msft Nov 8, 2026
2b97d83
Merge origin/main
varunj-msft Nov 8, 2026
aaf2c15
Merge origin/main
varunj-msft Nov 8, 2026
0063be7
Merge origin/main
varunj-msft Nov 8, 2026
8c19cc7
Merge the copy connection lock
varunj-msft Nov 8, 2026
0bcfe81
Let users pick a server credential for an OpenAI target
varunj-msft Nov 8, 2026
6586352
Offer server credentials in the New Target dialog
varunj-msft Nov 8, 2026
f020e54
Compare a server credential's endpoint without losing IPv6 brackets o…
varunj-msft Nov 8, 2026
622bbb8
Report storage failures with one error and answer them with 503
varunj-msft Nov 9, 2026
1cae0b9
Merge the single storage error
varunj-msft Nov 9, 2026
eba7bf2
Escape file names once and simplify the saved recipe models
varunj-msft Nov 9, 2026
9f24124
Merge the recipe model simplification
varunj-msft Nov 9, 2026
2bbfc8f
Report restore bugs as build errors and log each failure once
varunj-msft Nov 9, 2026
3735dbc
Merge the restore logging and build error fixes
varunj-msft Nov 9, 2026
ca7563d
Stay ready when a saved entry can't be restored, and hold its name
varunj-msft Nov 9, 2026
a9dfc86
Merge the stay-ready restore
varunj-msft Nov 10, 2026
67416f1
Reset the registries between runtime tests, as a real startup does
varunj-msft Nov 10, 2026
e6e419e
Merge the runtime test isolation
varunj-msft Nov 10, 2026
81c0317
Stop a launch whose script takes the name of a saved entry that failed
varunj-msft Nov 10, 2026
6ee84f0
Merge origin/main
varunj-msft Nov 10, 2026
d43a7e8
Merge origin/main
varunj-msft Nov 10, 2026
0664063
Merge origin/main
varunj-msft Nov 10, 2026
3b3ac59
Merge origin/main
varunj-msft Nov 10, 2026
04fe60f
Merge origin/main
varunj-msft Nov 10, 2026
6911327
Merge origin/main
varunj-msft Nov 10, 2026
ee45962
Refuse OpenAI targets while the server sets OPENAI_CUSTOM_HEADERS
varunj-msft Nov 10, 2026
6a98d17
Merge origin/main
varunj-msft Nov 10, 2026
4a3f2e5
Use final origin names, record startup entries at registration, and t…
varunj-msft Nov 10, 2026
9f5d390
Merge the saved target origin and naming changes
varunj-msft Nov 10, 2026
acfd9eb
Merge origin/main
varunj-msft Nov 10, 2026
c8c4c26
Document that a copy keeps its source's connection, and check every c…
varunj-msft Nov 10, 2026
feba9fb
Merge the saved target origin and naming changes
varunj-msft Nov 10, 2026
aa4f848
Merge the copy connection rule
varunj-msft Nov 10, 2026
51d4fff
Explain that a credential refusal also covers using this server's cre…
varunj-msft Nov 10, 2026
a3d4f92
Merge the credential explanation
varunj-msft Nov 10, 2026
3c7a918
Merge the credential explanation
varunj-msft Nov 10, 2026
0da7b68
Merge the credential explanation
varunj-msft Nov 10, 2026
00fed11
Keep the server credential choice when no credential is listed
varunj-msft Nov 10, 2026
8614025
Use one recipe format version, keep the auth mode, and escape failure…
varunj-msft Nov 10, 2026
5a3f18b
Merge the recipe format changes
varunj-msft Nov 10, 2026
b3c7847
Build restored entries with a builder the caller supplies
varunj-msft Nov 10, 2026
af4075f
Merge the restore builder changes
varunj-msft Nov 10, 2026
061807a
Warn that writing saved entries is administrator authority, and test …
varunj-msft Nov 10, 2026
1740964
Merge the restore builder changes
varunj-msft Nov 10, 2026
01d99d7
Merge the restore builder changes
varunj-msft Nov 10, 2026
600717f
Merge the restore builder changes
varunj-msft Nov 10, 2026
095e76b
Merge the restore builder changes
varunj-msft Nov 10, 2026
7a547aa
Say restore can't tell who wrote a saved file
varunj-msft Nov 10, 2026
f71259b
Merge the saved file wording
varunj-msft Nov 10, 2026
ac27408
Merge the restore builder changes
varunj-msft Nov 10, 2026
986cc90
Test the parser's depth limit without depending on the stack size
varunj-msft Nov 10, 2026
1096925
Merge the parser depth test fix
varunj-msft Nov 10, 2026
f25b520
Merge the parser depth test fix
varunj-msft Nov 10, 2026
1845b64
Merge the parser depth test fix
varunj-msft Nov 10, 2026
bd2224b
Merge the parser depth test fix
varunj-msft Nov 10, 2026
b454e75
Merge the parser depth test fix
varunj-msft Nov 10, 2026
83a0bca
Merge the parser depth test fix
varunj-msft Nov 10, 2026
4247a6c
Merge the parser depth test fix
varunj-msft Nov 10, 2026
fb90af8
Read saved entries in a worker thread when restore isn't given what w…
varunj-msft Nov 10, 2026
c44d2ce
Merge the worker-thread read
varunj-msft Nov 10, 2026
abd116a
Stay not ready when a saved entry can't be restored, and let apply retry
varunj-msft Nov 10, 2026
0bfa6cc
Drop the refusal of held names from launches
varunj-msft Nov 10, 2026
c62118f
Merge the not-ready restore
varunj-msft Nov 10, 2026
c0aa46d
Merge the not-ready restore
varunj-msft Nov 10, 2026
f59306e
Read saved recipes off the event loop by default, and harden URL reda…
richlundeen Nov 10, 2026
7d90d68
Merge the not-ready restore
varunj-msft Nov 10, 2026
0f0c53d
Treat a class a launch script puts in place of another as temporary
varunj-msft Nov 10, 2026
26e1d0e
Merge the not-ready restore
varunj-msft Nov 10, 2026
f1ff143
Keep an "@" in a URL's path when redacting URLs in text
richlundeen Nov 10, 2026
3376a2d
Merge the not-ready restore
varunj-msft Nov 10, 2026
009e761
Merge the restore read and redaction fixes
varunj-msft Nov 10, 2026
21f22a4
Merge the restore read and redaction fixes
varunj-msft Nov 10, 2026
e9103ff
Merge the restore read and redaction fixes
varunj-msft Nov 10, 2026
57b069a
Merge the restore read and redaction fixes
varunj-msft Nov 10, 2026
7c88228
Merge the restore read and redaction fixes
varunj-msft Nov 10, 2026
7476c05
Merge the restore read and redaction fixes
varunj-msft Nov 10, 2026
cc4ae4d
Merge main
varunj-msft Nov 10, 2026
9f4c71e
Merge main
varunj-msft Nov 10, 2026
5121026
Merge main
varunj-msft Nov 10, 2026
d15f7fd
Merge main
varunj-msft Nov 11, 2026
84ad3fe
Merge main
varunj-msft Nov 11, 2026
be0b885
Use the dialog's save button in the new tests from main
varunj-msft Nov 11, 2026
8e04343
Merge main
varunj-msft Nov 11, 2026
187191c
Answer suite readiness storage failures through the shared storage ha…
varunj-msft Nov 11, 2026
ee8162c
Give the HTTPTarget save test the connection field a create now needs
varunj-msft Nov 11, 2026
bb2a620
Merge the readiness and save test fixes
varunj-msft Nov 11, 2026
db7451a
Merge the readiness and save test fixes
varunj-msft Nov 11, 2026
b200c92
Merge the readiness and save test fixes
varunj-msft Nov 11, 2026
4c42a6b
Merge the readiness and save test fixes
varunj-msft Nov 11, 2026
8100cea
Merge the readiness and save test fixes
varunj-msft Nov 11, 2026
374c620
Merge main
varunj-msft Nov 11, 2026
7ac059c
Answer suite readiness storage failures through the shared storage ha…
varunj-msft Nov 11, 2026
e08b67a
Merge main
varunj-msft Nov 11, 2026
7fa4ca4
Expect storage errors from main's version-checked delete tests the wa…
varunj-msft Nov 11, 2026
9bf5886
Merge main
varunj-msft Nov 11, 2026
626d2d4
Merge main
varunj-msft Nov 11, 2026
4a86017
Merge main
varunj-msft Nov 11, 2026
9568edb
Merge main
varunj-msft Nov 11, 2026
54e4374
Merge main
varunj-msft Nov 11, 2026
62499a7
Merge main
varunj-msft Nov 11, 2026
e34258c
Fit the explicit-target E2E from main to the dialog's save button and…
varunj-msft Nov 11, 2026
d3a5d9e
Merge the explicit-target E2E fix
varunj-msft Nov 11, 2026
c506195
Merge main
varunj-msft Nov 11, 2026
1ba526f
Merge main
varunj-msft Nov 11, 2026
9cdf7e7
Merge main
varunj-msft Nov 11, 2026
40d36ed
Merge main
varunj-msft Nov 11, 2026
6a52054
Merge main
varunj-msft Nov 11, 2026
23a7ec1
Merge main
varunj-msft Nov 11, 2026
70fbc3d
Merge main
varunj-msft Nov 11, 2026
a1e79d1
Merge main
varunj-msft Nov 11, 2026
a18f8ee
Merge main
varunj-msft Nov 11, 2026
72d86c4
Merge main
varunj-msft Nov 11, 2026
fceac87
Merge main
varunj-msft Nov 11, 2026
8c517d0
Use the dialog's save button in main's endpoint tests
varunj-msft Nov 11, 2026
91448f1
Merge the endpoint test fix
varunj-msft Nov 11, 2026
0e7a21f
Exempt the storage error handler from the keyword-only check
varunj-msft Nov 11, 2026
c35fa01
Merge keyword-only fixes
varunj-msft Nov 11, 2026
953dcce
Merge keyword-only fixes
varunj-msft Nov 11, 2026
d6079a1
Merge keyword-only fixes
varunj-msft Nov 11, 2026
21556ed
Merge keyword-only fixes
varunj-msft Nov 11, 2026
14004e9
Merge keyword-only fixes
varunj-msft Nov 11, 2026
3abc824
Merge keyword-only fixes
varunj-msft Nov 11, 2026
623fd40
Merge keyword-only fixes
varunj-msft Nov 11, 2026
b10f181
Merge keyword-only fixes
varunj-msft Nov 11, 2026
bf97225
Log every problem with a saved file that isn't valid
varunj-msft Nov 11, 2026
5e6faed
Merge the full schema-validation log
varunj-msft Nov 11, 2026
7625f89
Merge the full schema-validation log
varunj-msft Nov 11, 2026
8dbd4c2
Merge the full schema-validation log
varunj-msft Nov 11, 2026
5c7223a
Merge the full schema-validation log
varunj-msft Nov 11, 2026
ab32bde
Merge the full schema-validation log
varunj-msft Nov 11, 2026
35199cc
Leave the error behind a storage failure out of the logs
varunj-msft Nov 12, 2026
efcdfa9
Test a blob upload that fails with a transport or authentication error
varunj-msft Nov 12, 2026
0fdebdc
Merge the storage log and restore report fixes
varunj-msft Nov 12, 2026
c413994
Merge the storage log and restore report fixes
varunj-msft Nov 12, 2026
c057e30
Merge the storage log and restore report fixes
varunj-msft Nov 12, 2026
dc97ec7
Merge the storage log and restore report fixes
varunj-msft Nov 12, 2026
a9478df
Merge the storage log and restore report fixes
varunj-msft Nov 12, 2026
dc0c058
Merge the storage log and restore report fixes
varunj-msft Nov 12, 2026
8f27c91
Merge the storage log and restore report fixes
varunj-msft Nov 12, 2026
fc85ce5
Merge the storage log and restore report fixes
varunj-msft Nov 12, 2026
c9b795a
Merge main
varunj-msft Nov 12, 2026
38c981c
Merge main
varunj-msft Nov 12, 2026
eb71448
Merge main
varunj-msft Nov 12, 2026
1be067e
Merge main
varunj-msft Nov 12, 2026
162fc2a
Merge main
varunj-msft Nov 12, 2026
6c0c3dd
Merge main
varunj-msft Nov 12, 2026
3d0950d
Merge main
varunj-msft Nov 12, 2026
8b59c5d
Merge main
varunj-msft Nov 12, 2026
3d24b08
Merge main
varunj-msft Nov 12, 2026
338f478
Merge main
varunj-msft Nov 12, 2026
7a70d92
Merge main
varunj-msft Nov 12, 2026
4e8d9c2
Return 409 when a suite's launch scripts would replace a saved entry
varunj-msft Nov 12, 2026
b1bbbe6
Merge the suite launch conflict status
varunj-msft Nov 12, 2026
9ce29cb
Merge the suite launch conflict status
varunj-msft Nov 12, 2026
4e0e640
Merge the suite launch conflict status
varunj-msft Nov 12, 2026
917197c
Merge the suite launch conflict status
varunj-msft Nov 12, 2026
15e00de
Merge main
varunj-msft Nov 12, 2026
0c5baa8
Merge main
varunj-msft Nov 12, 2026
a3f65ad
Merge main
varunj-msft Nov 12, 2026
5d60a52
Merge main
varunj-msft Nov 12, 2026
d4337d8
Merge main
varunj-msft Nov 12, 2026
48bc6d1
Merge main
varunj-msft Nov 12, 2026
9789264
Merge main
varunj-msft Nov 12, 2026
167f322
Merge main
varunj-msft Nov 12, 2026
805ca2a
Merge main into part 7
varunj-msft Nov 13, 2026
b9c50e1
Merge part 7 into part 8
varunj-msft Nov 13, 2026
5363c0b
Merge part 8 into part 9
varunj-msft Nov 13, 2026
8f9f3ea
Merge part 9 into part 19
varunj-msft Nov 13, 2026
7a84c80
Merge main into part 17
varunj-msft Nov 13, 2026
2a9910c
Merge part 17 into part 19
varunj-msft Nov 13, 2026
af869a8
Combine the stage and source hints when editing a converter stage
varunj-msft Nov 13, 2026
cdbe6ad
Keep the recipe storage setup apart from the saved target requirements
varunj-msft Nov 13, 2026
450b1e5
Merge part 7 into part 8
varunj-msft Nov 13, 2026
699ab5b
Move saving a target into the registry library
varunj-msft Nov 13, 2026
7d914b1
Merge part 8 into part 9
varunj-msft Nov 13, 2026
9eb5d46
Merge main into part 17
varunj-msft Nov 13, 2026
713f7d1
Merge main into part 8
varunj-msft Nov 13, 2026
793316a
Merge part 8 into part 9
varunj-msft Nov 13, 2026
92a22c2
Merge part 9 into part 19
varunj-msft Nov 13, 2026
be9805b
Merge part 17 into part 19
varunj-msft Nov 13, 2026
3880a9a
Merge main into part 19
varunj-msft Nov 13, 2026
048283e
Merge main into part 8
varunj-msft Nov 13, 2026
6c243b6
Merge part 8 into part 9
varunj-msft Nov 13, 2026
a45f2ad
Merge part 9 into part 19
varunj-msft Nov 13, 2026
f273bff
Merge main into part 8
varunj-msft Nov 14, 2026
d692b25
Merge main into part 9
varunj-msft Nov 14, 2026
98a714a
Merge main into part 19
varunj-msft Nov 14, 2026
54d9332
Check saved entries against restore's inputs and settle cancelled saves
varunj-msft Nov 14, 2026
0529525
Merge part 8 into part 9
varunj-msft Nov 14, 2026
d0bb066
Ask the backend whether a target's values can be saved
varunj-msft Nov 14, 2026
c05e125
Check saveability with a request that registers nothing
varunj-msft Nov 14, 2026
2506b85
Merge part 9 into part 19, checking a picked server credential the wa…
varunj-msft Nov 14, 2026
e47689c
Wrap the saveability note in the backend README
varunj-msft Nov 14, 2026
cb7c699
Merge part 9 into part 19 (README already wrapped here)
varunj-msft Nov 14, 2026
e6cfbd9
Answer the saveability check in the numeric controls end-to-end mocks
varunj-msft Nov 14, 2026
d6186d5
Merge part 19
varunj-msft Nov 14, 2026
87de386
Bound the URL scheme when redacting text
varunj-msft Nov 14, 2026
96361e5
Merge part 9
varunj-msft Nov 14, 2026
33c7c2b
Merge part 19
varunj-msft Nov 14, 2026
33650ff
Merge main into part 8
varunj-msft Nov 17, 2026
87a4abf
Merge main into part 9
varunj-msft Nov 17, 2026
b369843
Merge main into part 9
varunj-msft Nov 17, 2026
7de76c9
Merge main into part 19
varunj-msft Nov 17, 2026
ed3141f
Merge main into part 9
varunj-msft Nov 18, 2026
f691ba6
Keep saveability available as a target name
varunj-msft Nov 18, 2026
1c5b92f
Merge main into part 19
varunj-msft Nov 18, 2026
2c15d96
Merge main into part 9
varunj-msft Nov 19, 2026
d055396
Keep the class save rule in the library and answer with the cause alone
varunj-msft Nov 19, 2026
ca4324b
Create targets only you can use, or that allow credential updates, as…
varunj-msft Nov 19, 2026
26d80b2
Merge part 9 into part 19
varunj-msft Nov 19, 2026
2513566
Refuse in the saveability check the server credential that create ref…
varunj-msft Nov 19, 2026
d9a66f6
Give each reason a target stays Temporary as its cause only, and drop…
varunj-msft Nov 19, 2026
8bc4161
Say the saveability check runs create's checks on the type, parameter…
varunj-msft Nov 19, 2026
78876c6
Merge part 9 into part 19
varunj-msft Nov 19, 2026
fa087b1
Merge main into part 9
varunj-msft Nov 19, 2026
0dc92aa
Merge main into part 9
varunj-msft Nov 19, 2026
5d6f076
Merge part 9 into part 19
varunj-msft Nov 19, 2026
a4b8a13
Merge main into part 19
varunj-msft Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .pyrit_conf_example
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,22 @@ allow_custom_initializers: false
# blob prefix.
# registry_recipes_source: https://account.blob.core.windows.net/container/registry_recipes

# Server Credentials Users Can Pick
# ---------------------------------
# Keys in this server's environment that users can pick by name for an OpenAI
# target instead of typing one. Users see each entry's name and endpoint, never the
# key or the variable. The key is only sent to the listed endpoint, and a saved
# target stores the entry's name, not the key, and reads the key again each time
# the backend starts. List a variable that holds only this key: a variable a
# target reads on its own, such as OPENAI_CHAT_KEY, can still reach any endpoint
# through a Temporary target created without a key.
#
# Default: none
# server_credentials:
# - name: contoso
# env_var: CONTOSO_OPENAI_KEY
# endpoint: https://contoso.openai.azure.com/openai/v1

# Upload Folder for API-Created Targets
# -------------------------------------
# Folder that targets created through the REST API may upload local files from
Expand Down
17 changes: 16 additions & 1 deletion doc/getting_started/pyrit_conf.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,29 @@ The backend restores saved entries at startup and after a live apply, once the c

#### Saved entry requirements

A saved file never holds a credential: restore refuses a file that stores a value for a parameter its class marks as a credential, such as `api_key`. A saved target also can't use a key from this server: it signs in with Microsoft Entra ID (`"auth_mode": "identity"`), which uses this server's Azure identity for everyone using the app, or needs no key. Targets from the server's configuration that it uses, such as a round-robin's members, keep their own sign-in. Restore refuses a target file that breaks these rules:
A saved file never holds a credential: restore refuses a file that stores a value for a parameter its class marks as a credential, such as `api_key`. A saved target also can't use a key from this server unless it is listed in `server_credentials` (below): otherwise it signs in with Microsoft Entra ID (`"auth_mode": "identity"`), which uses this server's Azure identity for everyone using the app, or needs no key. Targets from the server's configuration that it uses, such as a round-robin's members, keep their own sign-in. Restore refuses a target file that breaks these rules:

- It can't read an empty key from an environment variable or leave an address to this server's settings. An address the server would otherwise fill in must be a full http(s) or ws(s) address.
- It sets each setting its target type would otherwise read from this server's environment, such as an OpenAI target's `model_name`, and only parameters the create API accepts, so no Python objects such as `httpx_client_kwargs`.
- The addresses each target type declares (such as `endpoint`, `container_url` for Blob storage, or an A2A agent card path) can't hold a user name, password, SAS token, fragment, path parameters (`;`, `&`, `=`), or a query other than `api-version`, and a path can't have a query at all.
- In identity mode, an OpenAI target file sets `"headers": "{}"` in its `params` so that the server's `OPENAI_ADDITIONAL_REQUEST_HEADERS` aren't added. The OpenAI SDK adds the headers in `OPENAI_CUSTOM_HEADERS` to every request, so while the server sets it, OpenAI targets can't be saved and saved ones aren't restored. The SDK's `OPENAI_ORG_ID` and `OPENAI_PROJECT_ID` still apply to every OpenAI target on this server.
- GitHub Copilot, Hugging Face, HackAPrompt, LiteLLM, HTTP, and Copilot WebSocket targets can't be saved yet.

### `server_credentials`

Keys in this server's environment that users can pick by name for an OpenAI target instead of typing one. Each entry has a `name` users pick, the `env_var` that holds the key, and the only `endpoint` the key is sent to:

```yaml
server_credentials:
- name: contoso
env_var: CONTOSO_OPENAI_KEY
endpoint: https://contoso.openai.azure.com/openai/v1
```

`GET /api/targets/types` lists each entry's name and endpoint for the types that can use it, never the key or the variable. A target that names an entry (`"server_credential": "contoso"` with `"auth_mode": "api_key"` in `POST /api/targets`) gets the key only when its endpoint is the entry's endpoint, compared with the scheme and host lowercased and a default port and trailing slash removed. A saved target stores the entry's name, never the key, and reads the key again each time the backend starts, so rotating the variable's value takes effect at the next start. Restore refuses a saved target whose entry is no longer listed or whose variable isn't set.

List a variable that holds only this key. A variable a target reads on its own, such as `OPENAI_CHAT_KEY`, can still reach any endpoint through a Temporary target created without a key, so listing it doesn't limit where that key goes. Names are up to 64 lowercase letters, digits, and underscores, starting with a letter, and each name can be listed once. The default is none.

### `initialization_scripts`

Local paths to custom Python scripts containing `PyRITInitializer` subclasses. Paths can be absolute or relative to the current working directory.
Expand Down
5 changes: 4 additions & 1 deletion doc/gui/0_gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ robin that uses the old name: restore finds its members by name, so it would
otherwise send to the initializer's target in place of the saved one.

Saved targets can't hold credentials yet, so choose Identity-based or No key
authentication when the target supports it. A target that needs an API key or
authentication when the target supports it. When the server lists keys for the
target type in `server_credentials`, you can also choose **Server credential** and
pick one by name: the key stays on the server, and the endpoint is set to the only
address that key is sent to. A target that needs an API key or
another credential value, a type that can't be saved, a round robin that uses a
Temporary target, or a target that only you can use or that allows credential
updates is created as **Temporary** instead, and the dialog says why.
Expand Down
40 changes: 40 additions & 0 deletions frontend/e2e/registry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,46 @@ test("saves a target from the New Target dialog and still lists it as Saved afte
await expect(page.getByTestId(`target-row-${name}`).getByText("Saved", { exact: true })).toBeVisible();
});

test("saves a target that uses a server credential by its name, with no key @seeded", async ({ page, request }) => {
const name = `listed_chat_${Date.now()}`;
const sent: unknown[] = [];
page.on("request", (outgoing) => {
if (outgoing.method() === "POST" && new URL(outgoing.url()).pathname === "/api/targets") {
sent.push(outgoing.postDataJSON());
}
});
await page.goto("/registry/targets");
await page.getByRole("button", { name: "New Target", exact: true }).click();
const dialog = page.getByRole("dialog");
const picker = dialog.getByRole("combobox", { name: "Target Type" });
await expect(picker).toBeEnabled();
await picker.click();
await page.getByRole("option", { name: /Implementation: OpenAIChatTarget/ }).click();
await dialog.getByRole("radio", { name: /^Server credential/ }).check();
const endpoint = dialog.getByPlaceholder("https://your-resource.openai.azure.com/");
await expect(endpoint).toHaveValue("https://e2e-listed.example.test/v1");
await expect(endpoint).toHaveAttribute("readonly", "");
await expect(dialog.getByPlaceholder("API key (stored in memory only)")).toHaveCount(0);
await dialog.getByPlaceholder("e.g. gpt-4o, my-deployment").fill("listed-model");
await dialog.getByRole("textbox", { name: /Registry Name/ }).fill(name);
await dialog.getByRole("button", { name: "Save Target" }).click();
await expect(dialog).toHaveCount(0);

expect(sent).toEqual([{
name,
type: "OpenAIChatTarget",
params: { endpoint: "https://e2e-listed.example.test/v1", model_name: "listed-model" },
auth_mode: "api_key",
server_credential: "e2e_listed",
persist: true,
private: false,
}]);
await expect(page.getByTestId(`target-row-${name}`).getByText("Saved", { exact: true })).toBeVisible();
const saved = await request.get(`/api/targets/${name}`, { headers: compatibilityHeaders() });
expect(saved.ok(), await saved.text()).toBe(true);
expect(await saved.text()).not.toContain("e2e-listed-key");
});

interface RegisteredConverter {
converter_id: string;
identifier: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default defineConfig({
`cd .. && uv run --no-sync python -m pyrit.backend.pyrit_backend ` +
`--auth-mode local --host 127.0.0.1 --port ${E2E_BACKEND_PORT} --log-level warning ` +
`--config-file "${SEEDED_BACKEND_CONFIG_FILE}"`,
env: { PYRIT_DEV_MODE: "true" },
env: { PYRIT_DEV_MODE: "true", PYRIT_E2E_LISTED_KEY: "e2e-listed-key" },
url: `${E2E_BACKEND_URL}/api/health`,
reuseExistingServer: false,
timeout: 120_000,
Expand Down
94 changes: 94 additions & 0 deletions frontend/src/components/Config/CreateTargetDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3558,6 +3558,100 @@ describe("CreateTargetDialog saving", () => {
});
});

const SERVER_CREDENTIAL_TYPES: TargetTypeListResponse = {
items: SAVEABLE_TARGET_TYPES.items.map((entry) => (
entry.target_type === "OpenAIChatTarget"
? {
...entry,
server_credentials: [
{ name: "contoso", endpoint: "https://api.contoso.com/v1" },
{ name: "fabrikam", endpoint: "https://fabrikam.openai.azure.com/openai/v1" },
],
}
: entry
)),
};

it("should save a target that uses a server credential by sending its name and no key", async () => {
const user = userEvent.setup();
mockedTargetsApi.listTargetTypes.mockResolvedValue(SERVER_CREDENTIAL_TYPES);
render(
<TestWrapper>
<CreateTargetDialog {...defaultProps} />
</TestWrapper>
);

await selectTargetType("OpenAIChatTarget");
await user.click(screen.getByRole("radio", { name: /^Server credential/ }));
const endpointInput = screen.getByPlaceholderText("https://your-resource.openai.azure.com/");
expect(endpointInput).toHaveValue("https://api.contoso.com/v1");
expect(endpointInput).toHaveAttribute("readonly");
expect(screen.queryByPlaceholderText("API key (stored in memory only)")).not.toBeInTheDocument();
await user.selectOptions(screen.getByRole("combobox", { name: "Server credential" }), "fabrikam");
expect(endpointInput).toHaveValue("https://fabrikam.openai.azure.com/openai/v1");
await pasteInto(user, screen.getByRole("textbox", { name: /Model \/ Deployment Name/ }), "gpt-4o");
await user.click(screen.getByRole("button", { name: "Save Target" }));

await waitFor(() => expect(defaultProps.onCreated).toHaveBeenCalledTimes(1));
expect(mockedTargetsApi.createTarget).toHaveBeenCalledWith({
name: "openai_chat_gpt_4o",
type: "OpenAIChatTarget",
params: { endpoint: "https://fabrikam.openai.azure.com/openai/v1", model_name: "gpt-4o" },
auth_mode: "api_key",
server_credential: "fabrikam",
private: false,
persist: true,
});
});

it("should keep the server credential's endpoint, and drop its name, when a key is typed instead", async () => {
const user = userEvent.setup();
mockedTargetsApi.listTargetTypes.mockResolvedValue(SERVER_CREDENTIAL_TYPES);
render(
<TestWrapper>
<CreateTargetDialog {...defaultProps} />
</TestWrapper>
);

await selectTargetType("OpenAIChatTarget");
await user.click(screen.getByRole("radio", { name: /^Server credential/ }));
await user.click(screen.getByRole("radio", { name: "API Key" }));
const endpointInput = screen.getByPlaceholderText("https://your-resource.openai.azure.com/");
expect(endpointInput).toHaveValue("https://api.contoso.com/v1");
expect(endpointInput).not.toHaveAttribute("readonly");
await pasteInto(user, screen.getByRole("textbox", { name: /Model \/ Deployment Name/ }), "gpt-4o");
await user.type(screen.getByPlaceholderText("API key (stored in memory only)"), "test-key");

expect(screen.getByRole("status", { name: "This target can't be saved" })).toHaveTextContent(
`Saved targets can't use an API key yet. ${TEMPORARY_NOTE}`,
);
await user.click(screen.getByRole("button", { name: "Create as Temporary" }));
await waitFor(() => expect(defaultProps.onCreated).toHaveBeenCalledTimes(1));
expect(mockedTargetsApi.createTarget).toHaveBeenCalledWith({
name: "openai_chat_gpt_4o",
type: "OpenAIChatTarget",
params: { endpoint: "https://api.contoso.com/v1", model_name: "gpt-4o", api_key: "test-key" },
private: false,
persist: false,
});
});

it("should not offer a server credential for a type the server lists none for", async () => {
mockedTargetsApi.listTargetTypes.mockResolvedValue(SERVER_CREDENTIAL_TYPES);
render(
<TestWrapper>
<CreateTargetDialog {...defaultProps} />
</TestWrapper>
);

await selectTargetType("OpenAIChatTarget");
expect(screen.getByRole("radio", { name: /^Server credential/ })).toBeInTheDocument();
await selectTargetType("GitHubCopilotTarget");

expect(screen.queryByRole("radio", { name: /^Server credential/ })).not.toBeInTheDocument();
expect(screen.queryByRole("combobox", { name: "Server credential" })).not.toBeInTheDocument();
});

it("should offer Temporary with the reason when the target uses an API key", async () => {
const user = userEvent.setup();
render(
Expand Down
Loading
Loading