Repository navigation
Add exact multi-CWE searches and validate CVSS filters - #184
Open
afoote-mitre wants to merge 5 commits into
Open
afoote-mitre wants to merge 5 commits into
afoote-mitre wants to merge 5 commits into
Conversation
afoote-mitre
marked this pull request as draft
October 14, 2026 14:28
afoote-mitre
marked this pull request as ready for review
October 14, 2026 18:31
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
POST /searchnow supports exact matching for one or more CWE IDs throughcweIds, rejects malformed CWE and CVSS metric inputs before querying OpenSearch, and accepts the validNONEseverity for CVSS v3 and v4.The request field changes from
cweIdtocweIds. For example,{"cweIds":"CWE-79, cwe-89"}matches records containing either complete identifier within the selected CNA/ADP scope. The formercweIdfield is rejected as unsupported.Closes #179.
Changes and Primary Files
79orCWEto produce broad matches. The newcweIdsfield follows the comma-separated input pattern ofcveIds: trims entries, handles case-insensitive identifiers, deduplicates matching values, and matches any requested ID. Arrays, empty entries, or any malformed ID reject the entire request with HTTP 400CWE_IDS_FORMAT. Limits are 100 supplied IDs before deduplication, 32 characters per ID, and 4,096 characters overall. Format-valid IDs without indexed matches do not discard other matching IDs.controllers/middleware.js,routes/index.js,utils/constants.js,utils/errors.jstermqueries now use CWE.keywordfields, with OR between IDs and eligible container fields. The CWE filter is combined with other search filters using AND.utils/searchQueryBuilder.js,utils/searchScope.jsutils/searchReadiness.jsNONEseverityNONEas a severity, but validation previously rejected it. These filters now acceptNONEcase-insensitively. CVSS v2 continues to use the LOW/MEDIUM/HIGH score ranges.controllers/middleware.js,utils/errors.js,utils/constants.jsCVSS_METRICS_FORMAT; valid partial vectors and optional metrics remain supported.utils/cvss.js,controllers/middleware.js,utils/errors.jscvssV3Metrics, an explicitCVSS:3.0orCVSS:3.1prefix restricts candidate retrieval and semantic matching to that version; omitting it searches both versions. All supplied tokens must still match one eligible vector.utils/cvss.js,utils/searchQueryBuilder.jscweIdsfield, its OR and scope behavior, limits, and validation errors documented consistently. The parameter descriptions and examples also explain CVSS prefixes and tokens and severity labels versus score ranges.README.md,routes/swagger.js,api-docs/openapi.json,test/postman/buildCollection.js,test/postman/CVE-Search-API.postman_collection.jsonRegression coverage is included in
controllers/middleware.test.js,controllers/searchController.test.js,routes/search.integration.test.js,utils/cvss.test.js,utils/searchQueryBuilder.test.js,utils/searchReadiness.test.js,utils/errors.test.js, andapi-docs/openapi.test.js.