Skip to content

fix(aggregate): allowlist filter_*/sum_* query params - #2858

Merged
susilnem merged 1 commit into
developfrom
fix/aggregate-lookup-allowlist
Oct 15, 2026
Merged

susilnem merged 1 commit into
developfrom
fix/aggregate-lookup-allowlist

Conversation

@susilnem

@susilnem susilnem commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Changes

  • Removed dynamic filter_*/sum_* lookups from /api/v1/aggregate/ (GO-API-4VW).
  • Only the params used by the frontend are allowed:
    • filter_atype (appeal)
    • sum_amount_funded=amount_funded (appeal)
    • sum_beneficiaries=num_beneficiaries (appeal)
  • Other filter_*/sum_* params are ignored.
  • Schema has been changed

Note

Warning

External clients (e.g. PowerBI, partner scripts) might use other filter_*/sum_* params. These will now be ignored. Please check before merging. If any are needed, we can add them to the allowlist.

Checklist

Things that should succeed before merging.

  • Updated/ran unit tests
  • Updated CHANGELOG.md

Release

If there is a version update, make sure to tag the repository with the latest version.

@szabozoltan69 szabozoltan69 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and readable, concise solution. Thanks for it!

@susilnem
susilnem marked this pull request as ready for review October 7, 2026 06:56
@susilnem
susilnem force-pushed the fix/aggregate-lookup-allowlist branch 2 times, most recently from 22704ca to 6c8cc47 Compare October 12, 2026 05:15
@susilnem

Copy link
Copy Markdown
Member Author

@szabozoltan69 , Can you merge this pull request and deploy on staging?

@susilnem
susilnem force-pushed the fix/aggregate-lookup-allowlist branch from 6c8cc47 to ef1c06a Compare October 15, 2026 04:08
@susilnem
susilnem merged commit f8ed63a into develop Oct 15, 2026
6 checks passed
@susilnem
susilnem deleted the fix/aggregate-lookup-allowlist branch October 15, 2026 04:18
@susilnem

Copy link
Copy Markdown
Member Author

Staging verification

Tested on staging against /api/v1/aggregate/.

Check Expected Result
Unknown filter_* params (relation lookups, restricted records) Ignored, same response as baseline ✅ Identical (200, same body hash)
Arbitrary sum_* param Ignored ✅ Identical to baseline
Malformed lookup value (previously 500, Sentry GO-API-4VW) No error ✅ 200
Missing model_type 400 ✅ 400
Appeal-only param on model_type=fieldreport 400 ✅ 400
sum_amount_funded with invalid value 400 ✅ 400
Invalid start_date 400 ✅ 400
Valid appeal query (filter_atype + sum_amount_funded, unit=month) 200 with data ✅ 200

Result: Only allowlisted params are accepted; arbitrary ORM lookups/aggregations no longer affect the query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants