Repository navigation
FEAT: Save converters and scorers created through the API (part 12) - #4051
Open
varunj-msft wants to merge 341 commits into
Open
varunj-msft wants to merge 341 commits into
varunj-msft wants to merge 341 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: # pyrit/registry/registry_recipe_restore.py
Its text can carry a SAS URL. The 503 handler no longer logs it as a debug traceback, and the scenario suite service no longer attaches it to its warning; both log the storage message, which has no credentials.
# Conflicts: # frontend/src/components/Config/CreateTargetDialog.tsx
A suite launch runs its launch scripts during preflight and sends its scans without them, so the clash is raised there. Map it to 409 with its message, as a single launch does, and drop the per-entry message that a clash can no longer reach.
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. It builds on #4050, which refuses saved converters and scorers that would use this server's credentials. Until the earlier PRs merge, the diff here also shows their changes.
A converter or scorer created through the API is gone when the backend restarts. With
"persist": true,POST /api/convertersandPOST /api/scorersnow save it the wayPOST /api/targetsdoes (#4026), so restore brings it back at every start.target_service.pyto a sharedservices/saved_entries.py: turn off the server values an entry would read, refuse what it can't hold or a Temporary entry it uses, write the recipe create-only, register it, and delete the recipe again if registering fails. The owner and not-saveable helpers move toroutes/common.py, andTargetOrigin(new in FEAT: Save targets created through the API (part 8) #4026) becomesRegistryEntryOrigin. Targets behave as before.persiston converters and scorers follows the target rules. It needsregisterand a name matching^[a-z][a-z0-9_]{0,63}$(422 otherwise). A refusal is a typed 400 (/errors/not-saveable), a taken name is 409, and unreadable storage is 503. The owner is recorded as for targets.@apply_defaults) is written into the recipe by name, each entry of a list included, so restore uses the same entries even if nothing sets that default at the next start. A default that is Temporary, or isn't a registered entry, is refused. Other configured defaults apply again from the configuration at every start, as they do for startup entries.sourcecan't be saved yet (422).origin(saved,configurationortemporary) on list, get and create, and the startup entries of all three kinds are marked as configuration.DELETE /api/converters/{id}returns 409 for a saved converter, since it would come back from its file at the next start. Temporary and configuration converters are removed as before.typesis now reserved, as it is for targets and converters, sinceGET /api/scorers/typeswould hide a scorer with that name.pyrit_conf.mddescribe saving converters and scorers.Not covered:
GET /api/scorers/typesdoesn't say yet why a scorer type can't be saved; saving one refuses it with the reason.