You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Built-in z_score audit ignores condition for the rows it checks, and valid_http_method ignores condition entirely #6155
Most built-in audits accept an optional condition argument that restricts the rows being audited. Two audits do not honor it correctly:
z_score applies condition only inside the stats CTE that computes the mean and standard deviation. The outer query reads every row of the model, so rows that the condition excludes are still compared against statistics computed from a different subset and are reported as failures.
valid_http_method has no condition default and its query does not reference @condition, so a condition passed to it is silently ignored and the whole model (or time range) is audited.
The same applies when the audits are declared on a model, e.g. z_score(column := v, threshold := 1, condition := region = 'us').
Expected
z_score returns only (11, 1.1547...), the one us row whose z-score exceeds the threshold.
valid_http_method adds the condition to its WHERE clause and returns no rows, because every us row has a valid method.
Actual
z_score returns [(11, 1.1547...), (1000, 1714.15...), (1000, 1714.15...)]: the two eu rows are flagged even though the condition excludes them.
valid_http_method renders SELECT * FROM "db"."t" AS "t" WHERE NOT "method" IN ('GET', 'POST', ...) with no condition, and the two eu rows are flagged.
So the audit fails (or warns, for the _non_blocking variants) on rows the user excluded on purpose. It also scans the full model instead of the filtered subset.
Activity