Skip to content

Commit 90305c1

Browse files
committed
Fix CodeQL suppression placement
1 parent d00beeb commit 90305c1

2 files changed

Lines changed: 65 additions & 6 deletions

File tree

‎.agents/sow/done/SOW-0029-20260701-ci-scanner-readiness.md‎

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Status: completed
66

7-
Sub-state: implementation, validation, and artifact updates completed.
7+
Sub-state: regression fix implemented and locally validated; GitHub CodeQL must be checked immediately after push because no local CodeQL CLI is installed.
88

99
## Requirements
1010

@@ -291,20 +291,78 @@ Follow-up mapping:
291291

292292
Follow-up mapping:
293293

294-
- Pending.
294+
- The pushed GitHub CodeQL run for this regression commit must be checked immediately after push. If the alert remains live on the new commit, reopen this SOW again as a continued regression.
295295

296296
## Outcome
297297

298-
Pending.
298+
Scanner-readiness cleanup is complete locally. The first pushed implementation left one live CodeQL suppression-placement alert; this regression fix moves the suppression into the official CodeQL-supported position without changing runtime behavior.
299299

300300
## Lessons Extracted
301301

302-
Pending.
302+
- For CodeQL C/C++ alert suppressions, `// codeql[query-id]` must be a standalone comment on the line before the alert, not an end-of-line comment.
303+
- When local CodeQL is unavailable, pushed GitHub CodeQL is the first authoritative validation point; any suppression-only fix must be checked remotely immediately after push.
303304

304305
## Followup
305306

306307
None yet.
307308

308309
## Regression Log
309310

310-
None yet.
311+
See the appended regression section below.
312+
313+
## Regression - 2026-07-01 Remote CodeQL Suppression Placement
314+
315+
What broke:
316+
317+
- After commit `d00beebb0538b478a9e8515b1e75439bc1efb208` was pushed, GitHub Actions completed successfully, but GitHub Code Scanning still reported one live CodeQL alert:
318+
- rule: `cpp/stack-address-escape`
319+
- file: `src/libnetdata/netipc/src/service/netipc_service_posix_server.c`
320+
- line: assignment of `sctx->server = server`
321+
- commit: `d00beebb0538b478a9e8515b1e75439bc1efb208`
322+
323+
Evidence:
324+
325+
- `gh run list --repo netdata/plugin-ipc --commit d00beebb0538b478a9e8515b1e75439bc1efb208` showed all GitHub Actions workflows completed successfully.
326+
- `gh api repos/netdata/plugin-ipc/code-scanning/alerts/7758` showed the `cpp/stack-address-escape` instance on the pushed commit.
327+
- Official CodeQL documentation says `// codeql[query-id]` suppression comments must be on a blank line before the alert. The original fix placed the suppression on the assignment line, so CodeQL did not apply it.
328+
329+
Why previous validation missed it:
330+
331+
- Local CodeQL CLI is not installed, so the first authoritative CodeQL validation was the GitHub run after push.
332+
- The local source review used the correct query id but the wrong comment placement.
333+
334+
Repair plan:
335+
336+
1. Move the `// codeql[cpp/stack-address-escape]` comment to its own line immediately before the assignment.
337+
2. Keep the existing lifetime explanation in the source.
338+
3. Run focused local validation and SOW audit.
339+
4. Commit, push, and re-check GitHub Code Scanning for the pushed commit.
340+
341+
Validation plan:
342+
343+
- `cmake --build build --target netipc_service`
344+
- `/usr/bin/ctest --test-dir build --output-on-failure -R service`
345+
- `bash .agents/sow/audit.sh`
346+
- `git diff --check`
347+
- GitHub CodeQL check after push.
348+
349+
Validation results:
350+
351+
- `cmake --build build --target netipc_service` passed.
352+
- `/usr/bin/ctest --test-dir build --output-on-failure -R service` passed, 9/9 tests.
353+
- Local CodeQL validation was not available: `command -v codeql`, `~/.local/bin`, and `gh extension list` showed no CodeQL CLI or extension installed.
354+
355+
Artifact updates:
356+
357+
- AGENTS.md: no update needed; the workflow rule did not change.
358+
- Runtime project skills: no update needed; no reusable project operation changed.
359+
- Specs: no update needed; public API, wire format, transport semantics, and behavior did not change.
360+
- End-user/operator docs: no update needed; no user-facing behavior changed.
361+
- End-user/operator skills: no update needed.
362+
- SOW lifecycle: this completed SOW was moved back to `current/`, marked `in-progress`, this regression section was appended after the original SOW narrative, then the SOW was marked `completed` again for the regression fix commit.
363+
364+
Outcome:
365+
366+
- The source now uses the CodeQL-documented suppression placement.
367+
- Runtime behavior is unchanged.
368+
- Remote GitHub CodeQL must be rechecked after this commit is pushed.

‎src/libnetdata/netipc/src/service/netipc_service_posix_server.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ void nipc_server_run(nipc_managed_server_t *server) {
266266
}
267267

268268
/* The caller-owned server object stays live until destroy joins sessions. */
269-
sctx->server = server; // codeql[cpp/stack-address-escape]
269+
// codeql[cpp/stack-address-escape]
270+
sctx->server = server;
270271
sctx->session = session;
271272
sctx->shm = shm;
272273
sctx->id = sid;

0 commit comments

Comments
 (0)