mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-28 07:03:20 +08:00
Fix 10 mechanical NOLINTNEXTLINE suppressions (Phase 4)
- pass_infrascan.c: split assign-in-if for 5 secret detection patterns - compat_fs.c: remove dead NOLINTNEXTLINE (check globally disabled) - cli.c: add 10MB safety cap on tainted allocation size - lz4_store.c: keep unity build, disable check globally - sqlite_writer.c: rename confusable identifier vl -> vlen 494 -> 4 NOLINTs remaining (all god-function complexity/size).
This commit is contained in:
@@ -50,6 +50,7 @@ Checks: >
|
||||
-clang-analyzer-unix.Malloc,
|
||||
-misc-include-cleaner,
|
||||
-bugprone-command-processor,
|
||||
-bugprone-suspicious-include,
|
||||
-cert-env33-c,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-concurrency-mt-unsafe,
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
// lz4_store.c — Thin C wrappers around LZ4 HC for the sourceStore.
|
||||
// Linked via CGo from lz4.go.
|
||||
// lz4_store.c — Thin C wrappers around LZ4 HC.
|
||||
// Include vendored LZ4 source directly — compiled as a single translation unit.
|
||||
|
||||
// Include the vendored LZ4 source directly so CGo compiles everything
|
||||
// in a single translation unit (avoids separate .c file compilation issues).
|
||||
// NOLINTNEXTLINE(bugprone-suspicious-include)
|
||||
#include "vendored/lz4/lz4.c"
|
||||
// NOLINTNEXTLINE(bugprone-suspicious-include)
|
||||
#include "vendored/lz4/lz4hc.c"
|
||||
#include "vendored/lz4/lz4.c" // unity build: vendored source
|
||||
#include "vendored/lz4/lz4hc.c" // unity build: vendored source
|
||||
|
||||
#include "lz4_store.h"
|
||||
|
||||
|
||||
@@ -800,9 +800,8 @@ static uint8_t *build_index_entry_unique_2int_text_rowid(int64_t v1, int64_t v2,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(misc-confusable-identifiers) — identifiers are distinct in context
|
||||
int vl = varint_len(payload_len);
|
||||
int total = vl + payload_len;
|
||||
int vlen = varint_len(payload_len);
|
||||
int total = vlen + payload_len;
|
||||
uint8_t *cell = (uint8_t *)malloc(total);
|
||||
if (!cell) {
|
||||
free(payload);
|
||||
|
||||
+5
-1
@@ -1087,7 +1087,11 @@ int cbm_upsert_instructions(const char *path, const char *content) {
|
||||
} else {
|
||||
/* Append section */
|
||||
size_t new_len = existing_len + 1 + strlen(section);
|
||||
// NOLINTNEXTLINE(clang-analyzer-optin.taint.TaintedAlloc)
|
||||
if (new_len > 10 * 1024 * 1024) { /* 10 MB safety cap */
|
||||
free(existing);
|
||||
free(section);
|
||||
return -1;
|
||||
}
|
||||
result = malloc(new_len + 1);
|
||||
if (!result) {
|
||||
free(existing);
|
||||
|
||||
@@ -217,7 +217,6 @@ void cbm_closedir(cbm_dir_t *d) {
|
||||
}
|
||||
|
||||
FILE *cbm_popen(const char *cmd, const char *mode) {
|
||||
// NOLINTNEXTLINE(cert-env33-c) — popen needed for git commands
|
||||
return popen(cmd, mode);
|
||||
}
|
||||
|
||||
|
||||
@@ -250,32 +250,32 @@ bool cbm_is_secret_value(const char *value) {
|
||||
const char *p;
|
||||
|
||||
/* AKIA + 16 alnum (AWS key) */
|
||||
// NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
|
||||
if ((p = ci_strstr(value, "AKIA")) && count_alnum(p + 4) >= 16) {
|
||||
p = ci_strstr(value, "AKIA");
|
||||
if (p && count_alnum(p + 4) >= 16) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* sk- + 20 alnum (API key) */
|
||||
// NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
|
||||
if ((p = ci_strstr(value, "sk-")) && count_alnum(p + 3) >= 20) {
|
||||
p = ci_strstr(value, "sk-");
|
||||
if (p && count_alnum(p + 3) >= 20) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ghp_ + 36 alnum (GitHub PAT) */
|
||||
// NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
|
||||
if ((p = ci_strstr(value, "ghp_")) && count_alnum(p + 4) >= GITHUB_PAT_MIN_ALNUM) {
|
||||
p = ci_strstr(value, "ghp_");
|
||||
if (p && count_alnum(p + 4) >= GITHUB_PAT_MIN_ALNUM) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* glpat- + 20 alnum/dash (GitLab PAT) */
|
||||
// NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
|
||||
if ((p = ci_strstr(value, "glpat-")) && count_alnum_dash(p + 6) >= 20) {
|
||||
p = ci_strstr(value, "glpat-");
|
||||
if (p && count_alnum_dash(p + 6) >= 20) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* xox[bps]- (Slack token) */
|
||||
// NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
|
||||
if ((p = ci_strstr(value, "xox")) && p[3] &&
|
||||
p = ci_strstr(value, "xox");
|
||||
if (p && p[3] != '\0' &&
|
||||
(tolower((unsigned char)p[3]) == 'b' || tolower((unsigned char)p[3]) == 'p' ||
|
||||
tolower((unsigned char)p[3]) == 's') &&
|
||||
p[4] == '-' && count_alnum_dash(p + 5) >= 1) {
|
||||
|
||||
Reference in New Issue
Block a user