CamilleScholtz/swmpc / .agents/skills/audit-xcode-security-settings
audit-xcode-security-settings
VerifiedAudit and enable security-oriented Xcode build settings, compiler warnings, static analysis, and Enhanced Security features.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 57.4 KB |
| references/additional-settings.md | markdown | 1016 B |
| references/adoption-strategy.md | markdown | 5.6 KB |
| references/checked-pointer-arithmetic.md | markdown | 13.7 KB |
| references/cpp-hardening.md | markdown | 3.5 KB |
| references/decision-document.md | markdown | 3.3 KB |
| references/enhanced-security.md | markdown | 9.2 KB |
| references/hardware-memory-tagging.md | markdown | 4.1 KB |
| references/pointer-authentication.md | markdown | 6.8 KB |
| references/reading-build-settings.md | markdown | 5.7 KB |
| references/readonly-platform-memory.md | markdown | 2.5 KB |
| references/runtime-restrictions.md | markdown | 2.8 KB |
| references/security-compiler-warnings.md | markdown | 3.2 KB |
| references/security-settings-reference.md | markdown | 10.5 KB |
| references/stack-zero-init.md | markdown | 1.9 KB |
| references/typed-allocators.md | markdown | 3.2 KB |
| references/universal-binaries-for-libraries.md | markdown | 6.1 KB |
| scripts/filter_build_settings.pyexecutable | script | 3.9 KB |
references/security-compiler-warnings.md
View on GitHub# Security Compiler Warnings
Enhanced Security enables a set of compiler warnings that help identify potentially insecure C and C++ code patterns at build time.
## What It Does
Enables two categories of compiler warnings:
### Standard Warnings (always-on with Enhanced Security)
| Warning Flag | What It Detects |
|---|---|
| `-Wshadow` | Variable declarations that shadow other variables or type aliases |
| `-Wempty-body` | Empty bodies in control flow statements (`if`, `for`, `while`) |
### Additional Security Warnings
Enabled via the `ENABLE_SECURITY_COMPILER_WARNINGS` build setting:
| Warning Flag | What It Detects |
|---|---|
| `-Wbuiltin-memcpy-chk-size` | `memcpy` destination buffer smaller than copy size |
| `-Wformat-nonliteral` | `printf`-style format string that isn't a string literal |
| `-Warray-bounds` | Array index before beginning or past end of array; array argument smaller than function expects |
| `-Warray-bounds-pointer-arithmetic` | Pointer arithmetic resulting in out-of-bounds pointer |
| `-Wsuspicious-memaccess` | Suspicious memory operations: acting on vtable pointers, transposed `memset` args, non-trivially-copyable objects, zero-size operations |
| `-Wsizeof-array-div` | Incorrect `sizeof` calculation for array element count due to wrong types |
| `-Wsizeof-pointer-div` | `sizeof` returning pointer size instead of array size |
| `-Wreturn-stack-address` | Returning address of a local (stack) variable to the caller |
## What Vulnerabilities It Mitigates
- **Buffer overflows** — `memcpy` size mismatches, array bounds violations
- **Format string attacks** — non-literal format strings that an attacker could control
- **Use-after-return** — returning pointers to stack-allocated data
- **Logic bugs** — variable shadowing, empty control flow bodies, transposed arguments
## How to Enable
**Build settings:**
- `-Wshadow`: `GCC_WARN_SHADOW = Yes`
- `-Wempty-body`: `CLANG_WARN_EMPTY_BODY = Yes`
- Additional security warnings: `ENABLE_SECURITY_COMPILER_WARNINGS = Yes`
All are cascaded automatically when `ENABLE_ENHANCED_SECURITY = YES` — no manual setup needed if Enhanced Security is enabled.
## Code Changes Required
Fix the warnings. Common fixes include:
- Rename shadowed variables
- Add bounds checks before array access
- Use string literals for format strings, or mark intentional non-literal formats with appropriate attributes
- Fix `sizeof` calculations to use the correct types
- Remove or populate empty control flow bodies
## How to Disable
- `-Wshadow`: `GCC_WARN_SHADOW = No`
- `-Wempty-body`: `CLANG_WARN_EMPTY_BODY = No`
- Additional security warnings: `ENABLE_SECURITY_COMPILER_WARNINGS = No`
## Platform Availability
- All platforms — these are compile-time checks with no runtime component
## Performance and Stability Impact
- **Performance:** Zero runtime cost. These are compile-time warnings only.
- **Stability:** No runtime behavior change. Fixing the warnings improves code correctness.
## Why This Feature Is Low-Risk
Security compiler warnings are the safest Enhanced Security feature:
- Zero runtime cost
- No behavior changes — only build-time diagnostics
- Warnings identify real bugs that should be fixed regardless of security posture
Enable this first, before any other Enhanced Security feature.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |