fix(engine): refuse MIN and MAX in the disclosure gate (P57) #282
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #282"
general
weight: 0.35
abendrothj
What and why
Closes #279 (P57; the "Dominance rule" step in
docs/PROJECT_SCOPE.md). Proposes ADR 0015 (number reserved on #279) and implements itsMIN/MAXdecision. TheSUM/AVGpart is #281 (P58). ADR 0015 is Proposed: @AxolDad's acceptance is needed before this merges.MINandMAXover a cohort of k or more still returned one row's value. On the bypass fixture,SELECT COUNT() AS n, MAX(salary) AS hi FROM peoplereturned 9001, the oneceo's salary.WHERE salary < 9001gave the next salary, an id range said whose each one was, andMAX(id)returnedp15verbatim.ADR 0015 answers each question in #279:
PERMITTED_AGGREGATESand refused wherever they appear (select list,HAVING,ORDER BY), in research and ZK mode. The tie rule and top/bottom-coding are recorded as alternatives.AVGtakesSUM's decision, sinceSUM = AVG × n.SUM/AVG(DISTINCT)are refused (P58).suppressed_rowskeeps counting only rows the cohort threshold withholds. Derived columns read the masked value, andcount_arithmeticstays refused under ADR 0011.Aggregate, and a projection directly above it does the masking, soHAVING,ORDER BY … LIMITand derived columns never read a dominated total. This differs from #281's sketch, which carries the auxiliary values to egress. #281 should follow the ADR once it is accepted.How it was tested
policy.rs:PERMITTED_AGGREGATESis nowcount,sumandavg.New bypass cases, all
Rejected:min_max,max_total,max_text,min_text_per_group,max_distinct,max_renamed_below,max_in_subquery,max_in_cte; the walk ADR 0002 left open (max_walk,min_walk); id ranges (max_id_range,max_id_from);max_in_having,min_in_order_by.max_salary,max_id,min_walk,max_in_having.Existing bypass cases, changed deliberately:
-
sum_avg_min_max→sum_avg(Rows(2)): the baseline for the aggregates that stay. MIN/MAX moved tomin_max.-
group_by_id, both suites (Rows(0)): grouping by a unique key still releases nothing.-
having_value(Rows(0)): aHAVINGthat selects the small cohorts.HAVING MAXhas its own refused case.-
min_rare_first/max_rare_first→rare_first_by_value/rare_first_by_count(Rows(0)):ORDER BY … LIMITcannot bring a suppressed cohort forward.- ZK
rare_cohort_suppressed(Rows(0)).group_by_id_per_columngoes fromRows(0)toRejected. It releasedMAX(dept)per id, and nothing permitted returns text.-
filter_on_value(FILTERon a value aggregate) andcomputed_below(a computed column below the aggregate).- Positional subsets (ADR 0002):
limit_below_min→limit_below_sum,limit_below_cte,offset_below_max→offset_below_sum,plain_limit_below; ZKlimit_below_max→limit_below_sum,offset_below_min→offset_below_avg.- Error probes (ADR 0011):
having_div,outer_div,outer_cast,order_by_div,outer_negate_min_literal.AVG(salary)exceeds 9000 for theceogroup only and 9500 for none, asMAXdid.case_in_max,computed_label_below,max_n,window_over_aggregate(both suites),having_subquery,cross_join,aggregate_over_aggregate(both suites),inner_group_by_id,qualified_n,two_n_columns, and ZKgrouping_sets,missing_n_by_id,spoofed_n,max_of_id,computed_below,scalar_subquery_filter.Mutation check: with
minandmaxput back in the allowlist, exactly the new cases andgroup_by_id_per_columnfail (max_totalreturns 9001,max_textreturnsp15,max_walkreturns 7002), and every rewritten case still passes.API:
query_api.rsuses SUM instead of MAX in its unique-key and missing-nchecks and adds MAX to the refused queries (422).research_api.rssends MAX through the research endpoint (422).No new audit event: a MIN/MAX refusal is a plan refusal and takes the existing
engine.querypath.Docs:
docs/THREAT_MODEL.mdgets a new A1 row, a rewritten "Extreme values" residual and a new "Rows, not people" residual.docs/ARCHITECTURE.md, thedocs/PROJECT_SCOPE.mdrow andCHANGELOG.md(Security) are updated too.Checklist
scripts/check.shpasses locallySECURITY_AUDIT_EVENTcovered byaudit_coverage.rsdocs/DATA_POLICY.md)CHANGELOG.mdupdated for user-visible changesdocs/adr/if one was made