Skip to content

Sandboxing & Policy Enforcement

Engineer/DeveloperSecurity SpecialistOperations & StrategyDevops

Authored by:

munamwasi
munamwasi
jubos
jubos
masterfung
masterfung

Reviewed by:

matta
matta
The Red Guild | SEAL

🔑 Key Takeaway

  • Policy determines what is allowed; sandboxing limits damage when allowed actions go wrong.
  • Enforce controls before execution, during runtime, and before promotion/deploy.
  • Use both layers together to close gaps that either control leaves on its own.

Sandboxing and policy enforcement solve different problems and must be used together:

  • Policy decides what should be allowed.
  • Sandboxing limits damage when allowed actions fail, are abused, or are bypassed.

Using only one layer leaves material gaps.

Three policy checkpoints

CheckpointPurposeTypical examples
Pre-executionblock unsafe configuration before run startsdeny privileged runner flags, deny forbidden workflow triggers
Runtimeenforce constraints during executionseccomp/AppArmor, pod security admission, network policy
Post-executionverify integrity before promotion/deploysignature verification, provenance checks, policy attestations

CI/CD control stack

A practical stack for pipelines:

  1. Workflow policy
    • lint and validate pipeline definitions
    • require least-privilege token settings
  2. Runner/runtime policy
    • enforce non-privileged execution
    • require sandbox profile and resource limits
  3. Artifact/release policy
    • enforce signed artifacts and provenance before publish/deploy
  4. Environment policy
    • require approvals for production mutation paths

Threat-to-control mapping

ThreatPolicy controlSandbox control
Secret exfiltrationdeny secret injection into untrusted workflowsfilesystem isolation + egress allowlist
Runner compromisedeny privileged execution configssyscall filtering + ephemeral runner
Supply-chain tamperingrequire trusted source and attestationisolated build runtime + immutable logs
Unauthorized deploybranch/environment approvalsisolated deploy runner with scoped identity

Maturity model

Level 1 (baseline)

  • static policy checks for CI configuration
  • isolated runners for untrusted PRs
  • least-privilege CI tokens

Level 2 (intermediate)

  • runtime admission/enforcement policies
  • default-deny network egress
  • short-lived credentials via federation

Level 3 (advanced)

  • signed provenance verification on promotion
  • policy decision logging with centralized audit
  • periodic control validation exercises (breakout tests/tabletops)

Common anti-patterns

  • Writing policy that is never enforced at runtime.
  • Treating sandbox exceptions as permanent defaults.
  • Failing open when policy engine is unavailable.
  • Skipping auditability for policy decisions.

References