Repository navigation
fix(mcp-scan): normalize mixed-case MCP SARIF rule IDs - #733
Open
Elon-Jiang wants to merge 1 commit into
Open
Elon-Jiang wants to merge 1 commit into
Elon-Jiang wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Normalize mixed-case MCP risk codes before selecting SARIF rule metadata and computing alert fingerprints. An input such as
mcp05: Command Injectioncurrently produces a separatemcp05rule alongside the built-inMCP05; the same finding then has a different rule ID and fingerprint solely because of casing. Baremcp05already resolves toMCP05.The change extends the existing normalization to MCP-prefixed numeric codes, preserving the original handling of other identifiers. Regression tests compare complete English and Chinese reports for lowercase/mixed-case prefixes, both colon forms, and surrounding whitespace, and verify that non-MCP/custom rule IDs retain their identity.
Type of change
How was this tested?
851e3f2: six new report regressions fail; eleven other tests in the same file pass.test_pre_scan_sanitizes_non_utf8_filenameandtest_build_repo_tree_sanitizes_non_utf8_filenamemix astrtemporary-directory path with abytesfilename and raiseTypeErrorbefore exercising scanner behavior. Those tests are outside this patch.python main.py --help: passed.UP012diagnostic and pre-existing formatting differences as upstream; the changed block is formatted andgit diff --checkpasses.GOMAXPROCS=2 GOMEMLIMIT=512MiB go build -p 2 ./...: passed with Go 1.23.2.Related issue
N/A — reproduced directly against the current formatter; checked all open PR file lists, all-state SARIF/casing/risk-type searches, discussions and formatter history for overlap.
Checklist
go build ./...succeeds locally (with-p 2)Prepared with assistance from OpenAI Codex. Reproduction and validation were executed locally; the two unrelated upstream test failures are disclosed above.