fix(sast): an upper-case format macro is not a non-literal format (#380) (#395)
CI / Check (push) Skipped
CI / Detect Changes (push) Successful in 4s
CI / Deploy Dashboard (push) Skipped
CI / Deploy Docs (push) Skipped
CI / Deploy MCP (push) Skipped
CI / Deploy Agent (push) Successful in 4m3s

This commit was merged in pull request #395.
This commit is contained in:
sharang committed 2026-09-25 11:27:23 +00:00
1 parent aee2f5b9eb
commit a3cfaf422f
2 files changed
+10 -1

No files matched your search

+3 -1
View File
@@ -171,9 +171,11 @@ rules:
- pattern: std::fprintf($F, $FMT, ...)
- pattern: std::sprintf($B, $FMT, ...)
- pattern: std::snprintf($B, $N, $FMT, ...)
# Not a literal, and not an upper-case macro (`#define GET_REQUEST
# "GET / HTTP/1.1"`): a macro like that expands to a literal.
- metavariable-regex:
metavariable: $FMT
regex: ^[^"]
regex: ^(?![A-Z][A-Z0-9_]*$)[^"]
- id: cra-ai-8-c-hardcoded-credential
languages: [c, cpp]
@@ -20,3 +20,10 @@ void status(const char* state) {
}
} // namespace cli
// A format macro expands to a literal: not a finding (#380).
#define STATUS_FMT "state: %s\n"
void status_line(const char* state) {
std::printf(STATUS_FMT, state);
}