Required filters: a table must be filtered on one of its columns

Open
#24 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
50/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python, sql
Domain
security

Research direction

Start with src/sqlguardllm/rules/required_filters.py and the required_filters option in src/sqlguardllm/policy.py, and check whether #4, which this depends on, is already merged. Read the existing corpus format in tests/corpus/required_filters.yaml to see how cases are written. Done means the four corpus cases (missing, predicate in WHERE, predicate in ON, inside a CTE) pass and violations report missing_required_filter with the table and columns named.

Written by the indexing model from the issue text.

Description

area:core size:s type:feature
Goal

Force a predicate on large tables, such as a date range on a fact table, so a model can't scan everything.

Acceptance criteria
  • required_filters: {table: [columns]} policy option
  • Every occurrence of the table needs a predicate in its own WHERE (or the JOIN ... ON) that references one of the columns
  • New violation code missing_required_filter naming the table and the columns
  • Corpus cases: missing, present in WHERE, present in ON, inside a CTE
Relevant files
  • src/sqlguardllm/rules/required_filters.py
  • src/sqlguardllm/policy.py
  • tests/corpus/required_filters.yaml
Size

S (up to half a day)

Notes
Dominant language
Python
Stars
0
Forks
0
Avg merge
1m
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jmmana/sqlguardllm

All issues in jmmana/sqlguardllm

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.