Skip to content

[BREAKING] FEAT: Require a name when the API registers a target (part 16) - #4068

Open
varunj-msft wants to merge 341 commits into
microsoft:mainfrom
varunj-msft:varunj-msft/13178-Require-Target-Name
Open

varunj-msft wants to merge 341 commits into
microsoft:mainfrom
varunj-msft:varunj-msft/13178-Require-Target-Name

Conversation

@varunj-msft

@varunj-msft varunj-msft commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Part 16 of saving Registry entries across restarts. A side branch stacked on part 9 (#4027); nothing builds on it. This PR's own changes: varunj-msft/PyRIT@varunj-msft/13178-Save-From-Registry...varunj-msft/13178-Require-Target-Name

Design: 4.8 Names. Where every part fits: PR map.

This is one of the changes for saving Registry entries across restarts. Until the earlier PRs merge, the diff here also shows their changes.

POST /api/targets with register left on (the default) and no name registered the target under a generated compat_<hex> name. That fallback was marked LEGACY until targets required a name. Scorers already require one to register, and saved targets need one, so targets now match.

  • A request that registers a target must include name, or it gets a 422 ("name is required when register=true"). A request with "register": false still needs none.
  • The compat_<hex> fallback and its LEGACY notes are removed.
  • The tests and the e2e specs that created targets without a name now send one. The backend README says so.

What stays the same: a request with "register": false still needs no name, and the GUI isn't affected because it always sends one. A private copy (source) is never registered, so it needs no name either: one sent with register left on still gets "source requires register=false", which says what to change.

Breaking change: an API caller that relied on the generated name now gets a 422. To migrate, add "name": "<registry name>" to the request. The GUI always sends a name, so it isn't affected.

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
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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants