SeedDatasetFilter(criteria=[]) silently matches no datasets
Maintainers usually reply within 2 days
@bIackr0se is already working on this.
Since Oct 1, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 57/100
Research direction
Start with SeedDatasetFilter.init and _validate() in pyrit/datasets/seed_datasets/seed_metadata.py, then trace _match_filter_to_metadata in seed_dataset_provider.py. Run the reproduction in the issue and add regression coverage for criteria=[]; done means it no longer silently produces an empty result, using one agreed behavior for empty criteria.
Written by the indexing model from the issue text.
Description
Describe the bug
SeedDatasetFilter(criteria=[]) constructs without error or warning and then matches no dataset, regardless of what is registered.
__init__ takes the criteria is not None branch and stores the empty list as-is:
# pyrit/datasets/seed_datasets/seed_metadata.py
if criteria is not None:
self.criteria = criteria
elif kwargs:
self.criteria = [SeedDatasetMetadata(**kwargs)]
else:
self.criteria = [SeedDatasetMetadata()]
_validate() then has nothing to iterate, and matching reduces to any() over an empty generator:
# pyrit/datasets/seed_datasets/seed_dataset_provider.py
return any(
cls._match_single_criterion(metadata=metadata, criterion=c, strict_match=dataset_filter.strict_match)
for c in dataset_filter.criteria
)
so every dataset evaluates to False. The caller gets an empty result list with no indication that the filter itself was the problem — the likely shape being a criteria list assembled dynamically that happens to come out empty.
This is adjacent to, but distinct from, the empty-set-on-an-axis case handled in #2907: that one is about set() on a single axis having opposite meanings under strict_match, whereas this is an empty OR-list across criteria and has no strict_match interaction at all. Noting it here so the two aren't conflated — #2907's description and the docstring on TestStrictMatchSingularFieldValidation::test_strict_match_validates_criteria_list both use the phrase "criteria=[]" loosely to mean "via the criteria-list form," which makes this gap read as already covered when it isn't.
Steps/Code to Reproduce
from pyrit.datasets.seed_datasets.seed_dataset_provider import SeedDatasetProvider
from pyrit.datasets.seed_datasets.seed_metadata import SeedDatasetFilter, SeedDatasetMetadata
f = SeedDatasetFilter(criteria=[])
print(f.criteria) # []
print(f.has_all_tag) # False
metadata = SeedDatasetMetadata(tags={"safety"}, size={"small"})
print(SeedDatasetProvider._match_filter_to_metadata(metadata=metadata, dataset_filter=f))
Expected Results
Either:
ValueErrorat construction, consistent with the other impossible-filter guards already in_validate()(strict_matchwith multiple values for a singular field, and the empty-axis check added in #2907); or- treat
criteria=[]the same as "no criteria supplied" and fall through to[SeedDatasetMetadata()], i.e. an unfiltered match-all filter.
Option 1 looks more consistent with the existing validation, which prefers to fail loudly on a filter that cannot express a meaningful query. Option 2 is defensible if an empty criteria list is considered a legitimate "no constraints" input. Either is preferable to the current silent empty result.
Actual Results
No exception and no warning. f.criteria is [] and _match_filter_to_metadata returns False for every dataset, so get_all_dataset_names_async(filters=f) returns an empty list.
Versions
- OS: Windows
- Python version: 3.14.2
- PyRIT version: 1.2.0.dev0 (installed from
mainin editable mode)
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 924
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 220
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/PyRIT
-
BUG: PlagiarismScorer accepts invalid n-gram size and blank reference textPossibly taken @RohithPariki claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 2 days
-
PackageHallucinationScorer (Python) misses `from pkg.sub import x` and indented importsPossibly taken @barry166 claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
microsoft/PyRIT#2948 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 2 days
-
BUG Configuration keeps runtime-status errors after polling recoversPossibly taken @rupayon123 claimed this 8 days ago. OpenBug: triage GUI help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
microsoft/PyRIT#2868 · 1 comment ·
Maintainers usually reply within 2 days
-
ObjectiveScorerEvaluator scores every conversation message as an assistant responsePossibly taken @feiiiiii5 claimed this 9 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
FuRongJun-1999/dsh-memory#56 ·
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
pgadmin-org/pgadmin4#10503 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
521xueweihan/HelloGitHub#3857 ·
-
needs-ac
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Ikalus1988/MisakaNet#2845 ·
Maintainers usually reply within 1 day
-
bug connectors operations
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pyinfra-dev/pyinfra#1989 ·
Maintainers usually reply within 3 days