Skip to content

Strengthen search endpoint validation #1745

Closed
1 of 1 issue completed
Closed

Description

@jlkravitz

Update: The below (stricken) finding was deemed to be compliant with ASVS 3.0.1, Requirement 5.10, but a true positive finding.

Related to #1724. We should consider strengthening validation of our search endpoint, by either explicitly specifying an acceptable Marshmallow schema or by constraining the accepted query to an allow-list of fields, operators, and query types.

To ensure compliance with ASVS 3.0.1 per contract requirements, we should implement the below requirement.

> Verify that all SQL queries, HQL, OSQL, NOSQL and stored procedures, calling of stored procedures are protected by the use of prepared statements or query parameterization, and thus not susceptible to SQL injection.

Note: The Finding and Proposed change sections below are mostly Claude-generated with manual human review for false positives. Ultimately, we are bound by the text of the requirement above.

Finding:

> The provider search endpoint accepts a raw, caller-supplied OpenSearch DSL query body rather than a parameterized query: SearchProvidersRequestSchema.query is a marshmallow Raw field (lambdas/python/common/cc_common/data_model/schema/provider/api.py:507) passed through to OpenSearch unchanged (lambdas/python/search/handlers/search.py:437-439). Staff control the entire query structure. This is well-mitigated — per-compact index isolation, a validate_no_cross_index_queries check, the domain setting rest.action.multi.allow_explicit_index: false, and response-sanitization schemas — but the unbounded DSL still allows expensive/abusive queries (query-cost DoS) and is a wide input surface that is not parameterized. Related: #1724 (a dateOfBirth scope-gate bypass via the same raw-DSL pattern in the social-work/cosmetology apps; that specific gate does not exist in compact-connect, but the raw-DSL passthrough does).

Proposed change:

> Constrain the accepted query to a parameterized allow-list of fields, operators, and query types rather than passing raw OpenSearch DSL, or wrap it with query-cost limits and depth/clause caps. Treat DSL fields as data, not structure.

Activity

  1. jlkravitz commented on Jul 14, 2026

    @jlkravitz
    CollaboratorAuthor

    I am not opposed to moving away from passing raw OpenSearch DSL, but this seems like a bigger lift than is worthwhile.

  2. changed the title [-]ASVS 3.0.1, Requirement 5.10[/-] [+]Strengthen search endpoint validation[/+] on Jul 16, 2026
  3. landonshumway-ia commented on Jul 23, 2026

    @landonshumway-ia
    Collaborator

    We can add a simple allowlist of terms based on the terms we know are used by the frontend today, and reject any request that attempts to use a term not included in that list. I've added an estimate to this ticket to reflect that effort.

  4. moved this from Backlog to CSG Review in CompactConnecton Aug 3, 2026
  5. moved this from CSG Review to Done in CompactConnecton Aug 4, 2026
  6. closed this as completedby moving to Done in CompactConnecton Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions