fix(jsonfilter): validate column identifier before building selector#3210
Conversation
Restrict the JSON filter column to a bare SQL identifier so it cannot reach the query builder unvalidated, mirroring the existing field-path allowlist. The sole current caller hardcodes the column, so this is defense-in-depth that removes reliance on every caller doing so. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: e83297c9-6593-4d73-9315-9547d86beb70
AI Session Analysis
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| modified | ai | pkg/jsonfilter/jsonfilter_test.go |
+35 / -0 |
| modified | ai | pkg/jsonfilter/jsonfilter.go |
+29 / -0 |
Policies (4)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-e83297 |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-e83297 |
- |
| ✅ Passed | ai-config-no-secrets |
ai-coding-session-e83297 |
- |
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-e83297 |
- |
Powered by Chainloop and Chainloop Trace
Adds allowlist validation for the JSON filter column in
BuildEntSelectorFromJSONFilter, restricting it to a bare SQL identifier before it reaches the query builder. This mirrors the existing field-path validation so input safety no longer depends on every caller hardcoding the column.Defense-in-depth hardening: the only current caller already sets the column to a known constant.
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri