Repository navigation
FEAT: Let users pick a server credential for a target (part 19) - #4070
Open
varunj-msft wants to merge 357 commits into
Open
varunj-msft wants to merge 357 commits into
varunj-msft wants to merge 357 commits into
Conversation
The dialog asks for a registry name and suggests one, saves the target by default, and creates a Temporary target only when it can't be saved, saying why before it is created. The Targets table labels each target Saved, From configuration or Temporary.
# Conflicts: # pyrit/registry/registry_recipe_restore.py
# Conflicts: # tests/unit/registry/test_instance_registry.py
# Conflicts: # pyrit/backend/services/runtime_lifecycle.py # tests/unit/backend/test_runtime_lifecycle.py
# Conflicts: # pyrit/setup/initializers/tools.py # tests/unit/backend/test_scenario_run_service.py # tests/unit/backend/test_scenario_suite_execution_service.py # tests/unit/registry/test_attack_technique_registry.py # tests/unit/registry/test_instance_registry.py # tests/unit/registry/test_registry_recipe_restore.py
create_named_instance checks the name before it builds, and the technique registry checks names case-insensitively before it registers. Both raised the duplicate-name error without recording the clash, so a launch script that caught either one could still leave a saved entry in place of its own. The name check now records the clash itself, as register already did, and the technique check records it too.
# Conflicts: # tests/unit/registry/test_registry_recipe_restore.py
The dialog keeps the type's own reasons from the type list and gets the rest from POST /api/targets/saveability, which runs create's checks and the library's save checks without building or saving anything, so the warning and the save share one policy. The Entra ID endpoint message shows on the Endpoint URL field after it loses focus.
Saved-entry storage failures now pass their traceback through redact_urls, and code scanning flags the scheme pattern as slow on a long run of letters. A scheme is short, so bounding it keeps the match linear.
… a saveability answer once its request goes away The private-target test now controls the debounce clock, so a slow run can't check the values chosen before Only me.
…s, and auth mode only
This branch has not been deployed
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.
Description
This is one of the changes for saving Registry entries across restarts. Until the earlier PRs merge, the diff here also shows their changes.
A saved target can't hold a key, so a target that needs an API key could only be Temporary. An administrator can now list keys from the server's environment that users pick by name, each tied to the only endpoint it is sent to.
.pyrit_conftakesserver_credentials: a list of entries with anameusers pick, theenv_varthat holds the key, and theendpointthe key is sent to. Each name can be listed once. The endpoint must be a full http(s) address with no user name, password, query or fragment.GET /api/targets/typeslists each credential's name and endpoint for the types that can use one (the OpenAI targets for now), never the variable or the key.POST /api/targetstakes"server_credential": "<name>"withauth_modeapi_keyand noapi_keyof its own, and not withsource(422 otherwise). The key is used only when the target's endpoint is the credential's endpoint, compared with the scheme and host lowercased and a default port and trailing slash removed. A credential that isn't listed or set, or another endpoint, gets a 400..pyrit_conf_example,doc/getting_started/pyrit_conf.md, the backend README and the GUI doc describe the setting. They say to list a variable that holds only that key: a variable a target reads on its own, such asOPENAI_CHAT_KEY, can still reach any endpoint through a Temporary target created without a key.What stays the same: without
server_credentialsin.pyrit_conf, nothing changes; the types list has empty lists and the dialog offers no new choice. A typed key still makes a Temporary target, and a Temporary target without a key still uses this server's own key variable, as the backend README describes.Screenshots: the New Target dialog with Server credential chosen, and the saved target in the Targets table.


Not covered: