Pilot · Hard-coded credential rule catches #define credentials #374

Closed
opened 2026-09-25 07:59:07 +00:00 by sharang · 0 comments
Owner

Part of #338.

Problem

The hard-coded credential rule for C (cra-ai-8-c-hardcoded-credential) matches variable initialisers such as const char* password = "...". It misses the usual embedded style, #define WIFI_PASS "..." and #define API_KEY "...", so most ESP-IDF and STM32 projects give no hits.

Done when

  • #define macros whose name looks like a credential (PASS, PASSWORD, PWD, SECRET, TOKEN, API_KEY, PSK, …) and whose value is a non-empty string literal are reported.
  • Placeholders ("", "changeme", "YOUR_…", "xxx") are ignored.
  • Tests, and the rule id in the nightly C fixture.
Part of #338. ## Problem The hard-coded credential rule for C (`cra-ai-8-c-hardcoded-credential`) matches variable initialisers such as `const char* password = "..."`. It misses the usual embedded style, `#define WIFI_PASS "..."` and `#define API_KEY "..."`, so most ESP-IDF and STM32 projects give no hits. ## Done when - `#define` macros whose name looks like a credential (PASS, PASSWORD, PWD, SECRET, TOKEN, API_KEY, PSK, …) and whose value is a non-empty string literal are reported. - Placeholders (`""`, `"changeme"`, `"YOUR_…"`, `"xxx"`) are ignored. - Tests, and the rule id in the nightly C fixture.
sharang added this to the Production MVP milestone 2026-09-25 07:59:07 +00:00
sharang added the enhancement label 2026-09-25 07:59:07 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#374