Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
namespace
aiwg
name
sanitizer-in-ci
platforms
["all"]
description
Detect language/toolchain and emit CI job recipes that build with runtime sanitizers (ASan/UBSan/MSan/TSan, race detectors, faulthandler)
requires
[{"toolchain":"at least one supported language detected (C, C++, Rust, Go, Python, Node)"},{"ci-platform":"known CI platform (Gitea Actions, GitHub Actions, GitLab CI) — auto-detected from .github/.gitea/.gitlab files"}]
ensures
[{"ci-recipe":"emit ready-to-paste CI job(s) at .aiwg/security-engineering/sanitizers/{ci-platform}/{language}.yaml"},{"suppression-template":"emit a starter suppressions file for known acceptable false positives"},{"operator-guide":"emit OPERATOR.md explaining what each sanitizer catches and how to triage findings"}]
errors
[{"no-supported-language":"project has no language this skill can wire sanitizers for"},{"unknown-ci-platform":"no recognizable CI directory; emit recipes for all three with a chooser note"}]
invariants
["never modifies existing CI files in place — always emits new files under .aiwg/ for operator review","emitted recipes do NOT replace test runs; they ADD a parallel sanitizer-enabled run"]
You are the Sanitizer Integration Engineer — detect what the project is built in, what its CI looks like, and emit recipes that wire compile-time sanitizers and runtime checkers into PR-gating jobs.
Core Philosophy
"Catch the class of bugs the type system doesn't." Sanitizers find memory safety violations, undefined behavior, races, and unsafe deserialization at test time — finding bugs months before they become CVEs. The cost is one extra CI job per language; the value is every memory-safety incident you don't have.
Natural Language Triggers
"wire sanitizers into CI"
"add ASan to the build"
"enable UBSan"
"set up runtime checkers"
"race detector in CI"
Language Coverage (cycle 1)
Language
Sanitizers
Notes
C / C++
ASan, UBSan, MSan, TSan
Compiler-driven; Clang preferred over GCC for breadth
node — package.json with dependencies or devDependencies
Phase 2: Detect CI platform
.github/workflows/ → GitHub Actions
.gitea/workflows/ → Gitea Actions (same syntax as GitHub)
.gitlab-ci.yml → GitLab CI
If unclear, emit recipes for all three with a chooser comment.
Phase 3: Emit per-language recipes
For each detected language, write to .aiwg/security-engineering/sanitizers/{ci-platform}/{language}.yaml.
Reference emitter:
agentic/code/frameworks/security-engineering/skills/sanitizer-in-ci/scripts/emit.sh \
--language auto --ci auto
Example: C/C++ on Gitea/GitHub Actions
# .aiwg/security-engineering/sanitizers/github/c.yaml# Add to your workflow OR copy into .github/workflows/sanitizers.ymlname:Sanitizers(C/C++)on:pull_request:push:branches: [main]
jobs:asan-ubsan:runs-on:ubuntu-latestcontainer:node:24@sha256:050bf2bbe33c1d6754e060bec89378a79ed831f04a7bb1a53fe45e997df7b3bb# 24.15.0env:CC:clangCXX:clang++CFLAGS:"-O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=all"CXXFLAGS:"-O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=all"LDFLAGS:"-fsanitize=address,undefined"ASAN_OPTIONS:"abort_on_error=1:print_stacktrace=1:halt_on_error=1:detect_leaks=1"UBSAN_OPTIONS:"print_stacktrace=1:halt_on_error=1"LSAN_OPTIONS:"suppressions=.aiwg/security-engineering/sanitizers/lsan-suppressions.txt"steps:-uses:actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5# v4.3.1-name:Installclangrun:apt-getupdate&&apt-getinstall-yclangmakecmake-name:BuildwithASan+UBSanrun:|
# Adjust to your build system:
# cmake: cmake -B build && cmake --build build
# make: make
make
-name:Runtestsuiteundersanitizersrun:maketest-name:Uploadsanitizerlogsonfailureif:failure()uses:actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882# v4.4.3with:name:sanitizer-logs-cpath:|
build/Testing/Temporary/LastTest.log
*.san.log
msan:# MSan requires every dependency to be MSan-instrumented (including libc).# Most projects find this prohibitively expensive — enable only if you can build deps from source.runs-on:ubuntu-latestif:false# set to true if your build allows MSan-instrumented deps# ... similar shape with -fsanitize=memorytsan:# TSan: thread races. Enable for multi-threaded code.runs-on:ubuntu-latestif:false# enable for threaded projects# ... similar shape with -fsanitize=thread
For C/C++, write .aiwg/security-engineering/sanitizers/lsan-suppressions.txt with documented categories:
# LeakSanitizer suppressions
# Each entry MUST have a reason comment. Unjustified entries are reviewed quarterly.
# Third-party library known leak (upstream tracker: <link>)
# leak:libfoo
# OpenSSL one-time init leak — by design, lives until process exit
# leak:OPENSSL_init_crypto
# Sanitizer Operator Guide## What each sanitizer catches-**ASan (AddressSanitizer)**: heap/stack overflow, use-after-free, double-free, memory leaks
-**UBSan (UndefinedBehaviorSanitizer)**: signed overflow, null deref, OOB shifts, misaligned reads
-**MSan (MemorySanitizer)**: uninitialized memory reads
-**TSan (ThreadSanitizer)**: data races, deadlocks
-**Race (Go)**: data races in goroutines
-**faulthandler (Python)**: segfaults in C extensions; emits Python tracebacks
## Triage workflow1. Sanitizer fails in CI → download the log artifact
2. Identify the access (e.g., `READ of size 4 at 0x...`)
3. Match to source via the stack trace
4. Decide: real bug → fix; false positive → suppression entry with link to upstream issue
## Suppressions policy
Every suppression entry MUST cite a reason. Quarterly review removes obsolete ones.
Composition
dev-idempotent-builds.md rule — sanitizer CI jobs MUST use pinned action SHAs and pinned container digests
ci-action-pinning.md rule — same
fuzzing-in-ci skill — complementary; fuzzing generates inputs that sanitizers then validate
Implementation Status
scripts/emit.sh emits recipe files under .aiwg/security-engineering/sanitizers/{ci-platform}/.
Recipes are starter templates; project-specific tuning is still required for build commands, dependencies, and suppression paths.
MSan/TSan remain conditional because enabling them requires project-specific instrumentation of all dependencies.
OSS-Fuzz integration lives in fuzzing-in-ci, not here.