Skip to content

FEAT: Add DeletionResidue scenario for records still revealed after deletion - #4816

Open
Umesh Chounde (umeshchounde) wants to merge 8 commits into
microsoft:mainfrom
umeshchounde:feat/deletion-residue-scenario
Open

Umesh Chounde (umeshchounde) wants to merge 8 commits into
microsoft:mainfrom
umeshchounde:feat/deletion-residue-scenario

Conversation

@umeshchounde

@umeshchounde Umesh Chounde (umeshchounde) commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Closes #4815. This adds airt.DeletionResidue, which checks whether a RAG application still reveals records after they were deleted at the source. It reports a match rate per dataset, so the deleted records are shown next to a sensitivity control and a false-positive control.

  • pyrit/scenario/scenarios/airt/deletion_residue.py follows the structure of AggregationLeakage. It has one PromptSending atomic attack per dataset and uses BaselineAttackPolicy.Forbidden, since prompt sending already sends each question unchanged. The default scorer is OutputMatchesScorer, and a custom scorer must support OutputMatches.
  • The scenario won't run until targets_deleted_externally=True, because PyRIT doesn't ingest or delete anything itself.
  • max_total is applied after per-source limits, with one group reserved for each selected dataset, so a small cap can't drop the targets or a control. max_total must be at least the number of selected datasets. The coverage step in Scenario.initialize_async doesn't fire with the default resolver, because the resolver has already applied the cap, so I override _resolve_seed_groups_by_dataset_async here. I can move this into Scenario instead if you'd prefer.
  • Three 16-group datasets of synthetic support tickets are in pyrit/datasets/seed_datasets/local/airt/. Each objective has an output_matches condition on the ticket's code. Target and keep tickets also carry the ticket text in record_text metadata, which is what the user ingests. No other local dataset sets conditions in YAML yet.
  • tests/end_to_end/test_scenarios.py passes the confirmation flag and expects one objective per dataset.
  • New section in doc/scanner/airt.py. The example runs one question per dataset against a plain chat model with nothing ingested, so all three rates are 0, and the section explains why that run is inconclusive. I don't have the documented endpoints, so I generated the saved notebook output against a local OpenAI-compatible server running Qwen2.5-1.5B, and the output shows that endpoint. Please regenerate it with your setup.

The numbers in the issue come from a separate probe script in my harness (https://github.com/umeshchounde/rag-deletion-residue), not from this scenario. If you'd prefer one of the smaller shapes from the issue, I'll rework this.

AI disclosure: I used an AI assistant to write most of the code, tests and this description. I've reviewed every line and can maintain it.

Copilot AI balanced review requested due to automatic review settings December 3, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The global cap can silently omit targets or a control dataset before coverage-aware sampling runs, and the small-cap test mocks away the resolver behavior that causes this.

1 open issue
What changed in this PR

Adds airt.DeletionResidue to PyRIT’s scenario framework to check whether RAG applications still reveal externally deleted records, alongside sensitivity and false-positive controls.

Changes:

  • Adds the scenario, deletion confirmation flag, and per-dataset scoring.
  • Bundles three synthetic datasets with 16 groups each.
  • Adds tests and documentation with an example of inconclusive results.
File Description
tests/​unit/​scenario/​test_scenario_e2e_contract.py Checks the three-group end-to-end cap.
tests/​unit/​scenario/​airt/​test_deletion_residue.py Tests datasets, validation, scoring, and sampling.
tests/​end_to_end/​test_scenarios.py Configures confirmation and dataset limits.
pyrit/​scenario/​scenarios/​airt/​deletion_residue.py Implements the scenario.
pyrit/​scenario/​scenarios/​airt/​__init__.py Exports the scenario and techniques.
pyrit/​datasets/​seed_datasets/​local/​airt/​deletion_residue_targets.prompt Adds deleted-record probes.
pyrit/​datasets/​seed_datasets/​local/​airt/​deletion_residue_keeps.prompt Adds sensitivity controls.
pyrit/​datasets/​seed_datasets/​local/​airt/​deletion_residue_absents.prompt Adds false-positive controls.
doc/​scanner/​airt.py Documents preparation and usage.
doc/​scanner/​airt.ipynb Adds the paired example and saved output.
doc/​scanner/​0_scanner.md Lists the new AIRT scenario.

Review effort: Balanced

The default resolver applied max_total to the union of datasets before the
coverage step, so a small cap could drop the targets or a control. Apply
source limits first, then sample the total with one group per dataset. The
small-cap test now resolves from memory instead of mocking the resolver.
@umeshchounde

Copy link
Copy Markdown
Contributor Author

The one failing check (macos-latest, 3.11, dev_all) is test_present_canonical_names_block_embedded_legacy_fallback, which hit the analytics query timeout on a run that took 64 minutes. This PR doesn't touch memory or analytics, and the test passes locally. Earlier runs also failed once each on test_pseudo_protocol_padding_does_not_catastrophic_backtrack (a 0.5s timing limit) on different runners. Could someone re-run the failed job? I don't have permission to.

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.

FEAT: DeletionResidue scenario for records a RAG app still reveals after deletion

2 participants