Skip to content

docs(security): verify the deployment page - #335

Merged
homer6 merged 2 commits into
devfrom
security/303-deployment
Nov 3, 2026
Merged

homer6 merged 2 commits into
devfrom
security/303-deployment

Conversation

@homer6

@homer6 homer6 commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

docs/security/deployment.md is rewritten and verified. As the issue asked, it keeps to the C++-relevant parts: privilege separation, sandboxing parsers, crash reports without secrets, and logs.

  • Least privilege: drop_privileges() drops in the order CERT POS36-C requires (groups → gid → uid), checks every result and confirms root can't be regained (POS37-C). Plus capabilities, socket activation and service accounts.
  • Isolate parsers: a broker/worker diagram and the sandbox mechanism per OS (seccomp + no_new_privs, Landlock, Capsicum, pledge/unveil, App Sandbox, AppContainer). seccomp strict mode's four system calls and the no_new_privs requirement are from seccomp(2). Includes a forbid_new_privileges() snippet.
  • Crash dumps without secrets:
    • PR_SET_DUMPABLE (also blocks same-user ptrace; the suid_dumpable=2 caveat);
    • MADV_DONTDUMP (Linux 3.4+);
    • RLIMIT_CORE, which core(5) says isn't enforced when dumps are piped to a handler such as systemd-coredump, so it isn't relied on alone;
    • what crash reporters collect.
  • Logs: a Secret type that formats and streams as [redacted], and log_field(), which escapes control characters against log forging and terminal escapes (CWE-117).
  • Vulnerability intake: SECURITY.md / GitHub private reporting, and a "ship" process that means a rebuilt binary. Every report becomes a regression test.
  • tests/security/deployment_test.cpp:
    • redaction through std::format and <<;
    • log escaping;
    • a failed drop throws (non-root only);
    • RLIMIT_CORE can be lowered;
    • Linux: not-dumpable, MADV_DONTDUMP, and no_new_privs is one-way (checked in a child process).
  • cpp-security skill page table row updated.
  • Imported claims dropped: the CISA, games-security and SEI citations, which didn't support the specific statements.

README/CLAUDE.md: no change needed.

Still open (owner decision): the repo has no SECURITY.md. The page recommends one, but it needs a contact the owner chooses.

Related

Test plan

  • Security area, Clang 22 and GCC 15 (macOS): 78/78 pass. Two Linux-only tests skip with reasons.
  • Linux (gcc:16 image, arm64), whole security binary:
    • as root: all pass, with FailedDropThrows skipped (root);
    • as uid 1000: all 76 pass, including the drop test.
  • check_snippets.py docs/security/deployment.md: 5/5 on GCC 15, Clang 22 and Linux GCC 16. The Linux-guarded blocks are actually compiled there.
  • run_clang_tidy.sh on the new test: no findings.

@homer6 homer6 self-assigned this Nov 3, 2026
@homer6
homer6 force-pushed the security/302-supply-chain branch from c1e47ed to fd06784 Compare November 3, 2026 12:23
@homer6
homer6 force-pushed the security/303-deployment branch from 5c41754 to c461029 Compare November 3, 2026 12:23
@homer6
homer6 changed the base branch from security/302-supply-chain to dev November 3, 2026 13:30
@homer6
homer6 force-pushed the security/303-deployment branch from c461029 to 9779141 Compare November 3, 2026 13:37
@homer6

homer6 commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto dev (669c206) without #334's commit, on the owner's instruction. #334 was rejected, and its merge was undone by resetting dev.

Under the owner's rule that guidance beyond C++ belongs when it changes how
the C++ is written: stop safely and restart cleanly (supervisor with a rate
limit, write-to-temp-then-rename so a crash never leaves half a file, with a
tested write_atomically), and get secrets at run time (a secret store, never
argv, prefer files to environment variables, read once, plan for rotation).

Related to #303
@homer6
homer6 merged commit 72645a1 into dev Nov 3, 2026
@homer6
homer6 deleted the security/303-deployment branch November 3, 2026 14:09
@homer6

homer6 commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Merged into dev as a merge commit (72645a1) on the owner's review ("commit and merge").

  • Added before merging (3089886), under the new rule that guidance beyond C++ belongs when it changes how the C++ is written:
    • Stop safely, restart cleanly: a supervisor with a restart limit, and write-to-temp-then-rename so a crash never leaves half a file, with a tested write_atomically.
    • Get secrets at run time: a secret store; never argv; files over environment variables; read once; plan for rotation.
  • Checked: security area 77/77 on clang-22 and gcc-15, page snippets 6/6 on both, clang-tidy clean and links ok. Earlier: the Linux runs as root and as uid 1000.
  • Still owed: the MSVC, MinGW and FreeBSD builds of the test run in the next consented platform run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant