Aggregate-only tables with a minimum group size (k-anonymity)

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

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python, sqlite

Research direction

Start with the issue's dependency on #4 and the existing rule in src/sqlguardllm/rules/aggregate_only.py, then see how policy.py loads per-table options. The change adds an aggregate_only: {table: k} option, rejects raw reads with aggregate_required, and appends HAVING COUNT(*) >= k while keeping any existing HAVING. Done when tests/test_aggregate_only.py passes on SQLite and shows that groups smaller than k never come back.

Written by the indexing model from the issue text.

Description

area:security size:m type:feature
Goal

Allow statistics over sensitive tables while making it impossible to single out a person.

Acceptance criteria
  • aggregate_only: {table: k} policy option
  • The SELECT that reads the table may only project aggregates and GROUP BY columns; raw reads are aggregate_required (new code)
  • The guard adds HAVING COUNT(*) >= k to that SELECT, combined with any existing HAVING
  • Tests on SQLite proving that groups smaller than k never come back
Relevant files
  • src/sqlguardllm/rules/aggregate_only.py
  • src/sqlguardllm/policy.py
  • tests/test_aggregate_only.py
Size

M (1-2 days)

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.