Skip to content

Commit 63f4f87

Browse files
lpcoxCopilot
andcommitted
fix: make audit artifacts world-readable to fix gh-aw post-job EACCES
AWF creates audit files (squid.conf, docker-compose.redacted.yml, policy-manifest.json) as root with 0o600 permissions. When gh-aw's post-job secret scanner runs as the runner user, it gets EACCES trying to stat/scan these files, causing job failures. Since audit files already have secrets redacted, change permissions from 0o700/0o600 to 0o755/0o644 so they're readable without needing the chmod a+rX cleanup step to have run first. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7d97a4c commit 63f4f87

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/docker-manager.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,19 +2339,20 @@ export async function writeConfigs(config: WrapperConfig): Promise<void> {
23392339
// Write audit artifacts (config snapshots for post-run forensics)
23402340
const auditDir = config.auditDir || path.join(config.workDir, 'audit');
23412341
if (!fs.existsSync(auditDir)) {
2342-
// Restrictive permissions initially; made readable during cleanup (chmod a+rX)
2343-
fs.mkdirSync(auditDir, { recursive: true, mode: 0o700 });
2342+
// World-readable so gh-aw post-job scanners can access audit artifacts
2343+
// (files are already secret-redacted, so 0o755 is safe)
2344+
fs.mkdirSync(auditDir, { recursive: true, mode: 0o755 });
23442345
}
23452346

23462347
// Save squid.conf for audit (no secrets — just domain ACLs and proxy config)
2347-
fs.writeFileSync(path.join(auditDir, 'squid.conf'), squidConfig, { mode: 0o600 });
2348+
fs.writeFileSync(path.join(auditDir, 'squid.conf'), squidConfig, { mode: 0o644 });
23482349

23492350
// Save redacted docker-compose.yml (strip env vars that may contain secrets)
23502351
const redactedCompose = redactDockerComposeSecrets(dockerCompose);
23512352
fs.writeFileSync(
23522353
path.join(auditDir, 'docker-compose.redacted.yml'),
23532354
yaml.dump(redactedCompose, { lineWidth: -1 }),
2354-
{ mode: 0o600 }
2355+
{ mode: 0o644 }
23552356
);
23562357

23572358
// Generate and save policy manifest (structured description of all firewall rules)
@@ -2368,7 +2369,7 @@ export async function writeConfigs(config: WrapperConfig): Promise<void> {
23682369
fs.writeFileSync(
23692370
path.join(auditDir, 'policy-manifest.json'),
23702371
JSON.stringify(policyManifest, null, 2),
2371-
{ mode: 0o600 }
2372+
{ mode: 0o644 }
23722373
);
23732374

23742375
logger.debug(`Audit artifacts written to: ${auditDir}`);

0 commit comments

Comments
 (0)