Fix Strict Handling Ignoring Unknown Underscore Search Params

Open Beginner friendly
#4,694 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
clojure
Domain
api

Research direction

Start at remove-query-param? in modules/fhir-structure/src/blaze/fhir/search_clauses.clj and trace where it runs relative to the Prefer: handling=strict check. The key question is which _ params count as result params (_count, _summary, _include) versus unknown ones, so the allowlist can be split. Reproduce with the three curl commands from the issue against a local build, and look at the fhir-structure tests around search clause handling. Done when _bogus and _type return 400 under strict, result params still pass, and lenient handling is unchanged.

Written by the indexing model from the issue text.

Description

Under Prefer: handling=strict, unknown search params return 400, except those starting with _, which are silently dropped.

docker run --rm -p 8080:8080 samply/blaze:1.13.0
curl -s -o /dev/null -w '%{http_code}\n' -H 'Prefer: handling=strict' 'localhost:8080/fhir/Patient?bogus=1'   # 400
curl -s -o /dev/null -w '%{http_code}\n' -H 'Prefer: handling=strict' 'localhost:8080/fhir/Patient?_bogus=1'  # 200, expected 400
curl -s -o /dev/null -w '%{http_code}\n' -H 'Prefer: handling=strict' 'localhost:8080/fhir?_type=Patient'     # 200, expected 400

Impact: GET [base]?_type=Patient&_tag=sys|A returns every type tagged sys|A. A client deleting by that result hits resources it never selected, and strict handling gives no signal.

Cause: remove-query-param? in modules/fhir-structure/src/blaze/fhir/search_clauses.clj drops _-prefixed params not on its allowlist before the strict check sees them.

Expected: under strict, an unknown _ param returns 400, except result params (_count, _summary, _include, …). Lenient handling unchanged.

Dominant language
Clojure
Stars
230
Forks
27
Avg merge
9h 20m
Merged PRs (30d)
149

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 samply/blaze

All issues in samply/blaze

Similar issues

More Clojure issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.