Skip to content

Commit 1274d6e

Browse files
lsr911claude
andcommitted
fix(sandbox): create skills dirs before first container launch
When a new agent workspace has no skills or .agents/skills directories, the read-only mount instructions are silently skipped. This creates a first-write vulnerability window where the agent can freely create executable scripts before the protective ro mount is applied on restart. Create both directories eagerly during workspace initialization so the Docker ro mount lock always applies from the first container launch. Fixes #94425 Co-Authored-By: Claude <[email protected]>
1 parent f8f2006 commit 1274d6e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/agents/workspace.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,11 @@ export async function ensureAgentWorkspace(params?: {
874874

875875
await fs.mkdir(dir, { recursive: true });
876876

877+
// Ensure sandbox skill directories exist before the first container launch so
878+
// read-only mounts always take effect (prevents first-write vulnerability window).
879+
await fs.mkdir(path.join(dir, "skills"), { recursive: true });
880+
await fs.mkdir(path.join(dir, ".agents", "skills"), { recursive: true });
881+
877882
if (!params?.ensureBootstrapFiles) {
878883
const hasContentEvidence = await hasSkipBootstrapWorkspaceContentEvidence(dir);
879884
if (recentAttestationPath && !hasContentEvidence) {

0 commit comments

Comments
 (0)