Repository navigation
FEAT: Show who saved each target and list only your own (part 10) - #4028
varunj-msft wants to merge 339 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
Saving now refuses what restore can't rebuild: a setting left to the server's environment (each target type declares these, replacing the backend's class-name table) and parameters the create API can't set. A cancelled save finishes or is undone before the cancellation goes on, rollback deletes only the version this save wrote, storage failures log a redacted cause chain, and capability detection keeps the target's origin.
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.
Richard Lundeen (richlundeen)
left a comment
There was a problem hiding this comment.
I’d close this now that #4024 has merged. Only me already gives people a way to find their own targets via Account → Yours, and the registry enforces who can see and use those targets. Only targets I saved answers a different question: it filters the table by who saved a target, but those targets are still shared. I don’t think we need both concepts in the Targets UI right now.
For the Registry save flow in #4027, I’d keep #4024’s rules: saved targets are shared, private targets can’t be saved, and the registry remains the source of truth for access. I’d leave out saved_by, saved_by_me, and the extra checkbox, and rebase #4050 without this layer. If teams need to know who saved a shared target, let’s handle that separately as attribution, not access control.
|
Thanks Rich, that makes sense, so I'm closing this one. #4027 keeps #4024's rules: saved targets are shared, private targets can't be saved, and the registry decides who can see and use them. #4050 now builds on #4027 without this layer. Who saved a target is still kept in its saved file, so we can show it later as attribution if teams need it. |
Description
This is one of the changes for saving Registry entries across restarts. It builds on #4027, which saves targets from the Registry. Until the earlier PRs merge, the diff here also shows their changes.
Problem. With sign-in on, everyone's saved targets land in one Targets list, and nothing says who saved which, so users can't find their own. Frederic raised this on the design gist and suggested Mine, Official and All views.
Change.
saved_by, the name) and whether that's the signed-in user asking (saved_by_me). The server compares the object IDs, so no ID leaves it. Capability detection returns both too, so the caption stays after a check.What stays the same. Anyone can still save and use every target, and nothing here decides who can change or delete one. The saved file format doesn't change. Targets from configuration and Temporary targets have no owner. The round robin member list and the other target pickers are unchanged.
Not covered.
Tests and Documentation
tests/unit/registry/test_registry_recipe_restore.py: restore keeps who saved each target, converter and scorer; an entry saved without sign-in has nobody.tests/unit/backend/test_target_service.py: a saved target says who saved it and whether it was the caller, for the saver, another user and nobody signed in, the same before and after a restart; a target saved with sign-in off and a Temporary one name nobody, including the create response.tests/unit/backend/test_mappers.py: the name and the flag for each owner and caller, a blank name, no object ID in the response, and inner targets of a saved round robin naming nobody.tests/unit/backend/test_api_routes.pyandtest_auth_middleware.py: list and get pass the caller's object ID, and none with sign-in off.TargetTable.test.tsx: the captions; the checkbox narrowing the list, together with the column filters and with hidden targets; no checkbox when nothing is yours; turning off when your last saved target is gone.frontend/e2e/config.spec.ts(mock): the captions, the checkbox, and a fresh load listing everyone again.frontend/e2e/registry.spec.ts(seeded, sign-in off): nobody is named and there's no checkbox.uv run --frozen --extra all python -m pytest -n 8 --dist=loadfile tests/unit/registry tests/unit/backend tests/unit/prompt_target tests/unit/models tests/unit/setup tests/unit/converter tests/unit/score: 19,612 passed, 9 skipped, 4 xfailedcd frontend && npm run test:coverage: 184 suites, 4,563 tests passedcd frontend && npx playwright test --project=mock e2e/config.spec.ts e2e/registry.spec.ts: 29 passedcd frontend && E2E_SEEDED_MODE=true npx playwright test --project=seeded: 109 passednpx tsc --noEmit,npx eslinton the changed files, and pre-commit (ruff, ty, docs checks): passeddoc/gui/0_gui.md(Registry): the "Saved by" caption and the checkbox.pyrit/backend/README.md: the two new fields.No JupyText changes.