Repository navigation
Harden Search Semantics, Request Lifecycles, and OpenSearch Readiness - #115
Merged
Merged
Conversation
afoote-mitre
force-pushed
the
af/0.3.0-review
branch
from
July 29, 2026 15:06
70be9e2 to
01a0c0a
Compare
jdaigneau5
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR hardens the Search API across CPE applicability, request validation, input limits, cancellation, and OpenSearch readiness.
Changes
CPE Applicability and Version Ranges
isVulnerablewith the same CPE Match Criteria entry that matched the requested CPE.Primary files:
utils/cpe.jsutils/searchQueryBuilder.jscontrollers/middleware.jscontrollers/searchController.jsSearch Request and Error Handling
/searchJSON-body contract.503responses withRetry-Afterwhen OpenSearch is unavailable.Primary files:
server.jsroutes/index.jscontrollers/middleware.jscontrollers/searchController.jsutils/errors.jsInput Complexity Limits
cveIds.Primary files:
controllers/middleware.jsutils/constants.jsutils/errors.jsSearch Cancellation and Resource Management
Primary files:
controllers/searchController.jsutils/searchDeadline.jsutils/searchInFlightRegistry.jsutils/searchPostFilterWorkQueue.jsutils/searchProvider.jsutils/searchPerformance.jsOpenSearch Readiness
/api/health-checkas a lightweight process-liveness check./api/ready-checkfor OpenSearch connectivity, index availability, and search permissions.503 SEARCH_NOT_READYresponse withRetry-After.cve-coreSearchReader contract during initialization.Primary files:
routes/index.jsutils/searchProvider.jsutils/requestLogging.jsconfig/default.jsoncconfig/custom-environment-variables.jsoncDocumentation
SearchReadinessTimeoutMssetting.Primary files:
README.mdapi-docs/openapi.json.env.exampleDeferred Items
CPE Applicability Candidate Limit
CPE searches that require semantic applicability filtering currently retrieve at most 10,000 lightweight candidate records from OpenSearch. The API then evaluates CPE criteria, version ranges, and vulnerability flags in Node.js before fetching the requested page.
If more than 10,000 records satisfy the initial OpenSearch query, valid matches outside that candidate window can be omitted. Because total-hit tracking is disabled for this operation, the API cannot currently distinguish a complete candidate set from one truncated at the limit. An incomplete result could also be cached and returned as though it were complete.
Resolving this requires a team decision between:
search_after, which improves correctness but can increase latency and OpenSearch load.sourceIdentifierProduction MappingThe current query builder maps
sourceIdentifiertocontainers.cna.source.discovery. That field may represent discovery provenance rather than the source identifier exposed by the public API contract.The production OpenSearch mapping and representative indexed records must be verified before changing this field because this repository does not own the index mapping. If the current path is incorrect, source identifier searches may return no results or records based on the wrong property. If the field is mapped as analyzed text rather than a keyword, the required query type may also differ.
The production data owner should confirm the authoritative field path, mapping type, and expected values before this filter is changed.
Deprecated
/webSearchEndpoint/webSearchaccepts caller-provided OpenSearch query syntax throughquery_string. It does not use the stricter field-level contract and complexity controls implemented for/search.This creates a broader query-complexity and abuse surface while the endpoint remains enabled. The finding is deferred because
/webSearchis scheduled for removal once consumers have migrated to/search. Until removal, it can be disabled throughWebSearchEnabled=falsewhere no remaining integration depends on it.Vulnerabilities Inherited Through
cve-coreThe two high-severity
npm auditresults are both associated with the same transitiveadm-zipadvisory inherited throughcve-core. The affected ZIP-generation functionality is not invoked by the Search API, and npm does not currently identify a compatible fix available within this repository.Remediation requires an updated
cve-corerelease that upgrades or replaces the dependency. This repository should consume that release when available, but it will not patch or override code owned bycve-core.