Repository navigation
security: fail-closed startup, secret rotation, target-gate backfill and kernel kill-switch - #715
Merged
Merged
Conversation
…ate backfill, and kernel kill-switch - Startup fail-closed: LockDownKeyDir explicitly chmods 0700 an existing key dir (counteracting host bind mounts) and 0600 existing key files; adds keys/ itself alongside jwt.key, secret.key, and config.json to IsolationSelfTest; makes IsolationSelfTest fatal unless ARTEX_ALLOW_UNISOLATED=1 is set. - Secret rotation: adds db.RotateSecretKey (single atomic transaction re-encrypting all sealed columns/settings and bumping auth.password_version), cmd/artex -rotate-secrets, scripts/rotate-secrets.sh, and OPS/SECURITY docs. - Scoped defaults, backfill & posture warnings: TargetGate defaults ON for tasks with CompanyIDs or InterceptRules (explicit opt-out persisted in tasks.target_gate_opt_out); migration 0022_target_gate_backfill.sql backfills existing active scoped tasks that did not explicitly opt out; egress-guard defaults to EGRESS_MODE=enforce when scope lists exist; loud startup warning when target gate or egress enforcement is off. - Kernel-backed local kill-switch: enables PR_SET_CHILD_SUBREAPER and scans /proc (without trusting agent-writable state) on Engine.Pause/BeginDelete to kill escaped setsid, nohup, and nested double-fork daemons (plus all execPriv.UID processes in isolated mode) within <= 5s with zero post-pause egress.
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Security hardening for the panel and the agent execution boundary. This is the first half of the fix for the execution-scope gap tracked in #421, #423, #554 and #555, and confirmed publicly by the 28 November 2026 writeup.
What changes
ARTEX_ALLOW_UNISOLATED=1is set explicitly. The key directory is tightened to 0700 and existing key files to 0600 at startup, so a host bind mount cannot mask the image permissions.db.RotateSecretKey,artex -rotate-secretsandscripts/rotate-secrets.shre-encrypt every sealed database value and bumpauth.password_versionin one transaction before the new key is moved into place. Existing sessions are invalidated.0022_target_gate_backfill.sqlsetstarget_gate=trueon active scoped tasks that did not opt out, and persists an explicit opt-out intasks.target_gate_opt_out. New scoped tasks default the gate ON;TargetGate: &falseis the explicit opt-out.Engine.PauseandEngine.BeginDeletesetPR_SET_CHILD_SUBREAPERand terminate the executor UID or the task descendant tree from/proc. Tests coversetsid,nohup, a double-fork withtrap '' TERM, an active egress loop, and verify that egress stops after pause.Upgrade notes
ARTEX_ALLOW_UNISOLATED=1deliberately.target_gate=true; pass an explicit opt-out to keep a task ungated.scripts/rotate-secrets.sh --dsn ...is required when PostgreSQL holdsenc:v1:*values; rotating the files alone leaves those rows unreadable.Tests
go build ./...,go vet ./...go test -p 1 ./...on PostgreSQL 16, 23/23 packagesgo test -race ./serverkill-switch tests:setsid,nohup, double-forktrap '' TERM, post-pause egressscripts/rotate-secrets.shand-rotate-secretsagainst a disposable databaseReferences and credits
The scope and isolation gaps were reported and designed in public before the writeup: #421 and #423 by @youssefmedhatl, #554 and #555 by @renaesop, with the two-sources-of-truth analysis by @Dukotah in #421. This change implements the first part of that work. The execution sandbox follows in a second pull request.