fix: pin bun runtime config and improve log hygiene (#1174)

* fix: pin bun runtime config and improve log hygiene

* snapshot all SENSITIVE_PATHS to .claude-pr/, not just .claude/
This commit is contained in:
Ashwin Bhat
2026-04-05 07:42:02 -07:00
committed by GitHub
parent 3534c326a5
commit 6e2bd52842
5 changed files with 29 additions and 11 deletions
+13 -7
View File
@@ -15,6 +15,9 @@ const SENSITIVE_PATHS = [
".claude.json",
".gitmodules",
".ripgreprc",
"CLAUDE.md",
"CLAUDE.local.md",
".husky",
];
/**
@@ -44,16 +47,19 @@ export function restoreConfigFromBase(baseBranch: string): void {
`Restoring ${SENSITIVE_PATHS.join(", ")} from origin/${baseBranch} (PR head is untrusted)`,
);
// Snapshot the PR's .claude/ tree to .claude-pr/ before deleting it.
// This lets review agents inspect what the PR actually changes (CLAUDE.md,
// settings, hooks, MCP configs) without those files ever being executed.
// The snapshot is taken before the security delete so it captures the
// Snapshot every PR-authored sensitive path into .claude-pr/ before deletion
// so review agents can inspect what the PR changes without those files ever
// being executed. Captured before the security delete so it reflects the
// PR-authored version.
rmSync(".claude-pr", { recursive: true, force: true });
if (existsSync(".claude")) {
cpSync(".claude", ".claude-pr", { recursive: true });
for (const p of SENSITIVE_PATHS) {
if (existsSync(p)) {
cpSync(p, `.claude-pr/${p}`, { recursive: true });
}
}
if (existsSync(".claude-pr")) {
console.log(
"Preserved PR's .claude/ → .claude-pr/ for review agents (not executed)",
"Preserved PR's sensitive paths → .claude-pr/ for review agents (not executed)",
);
}
+1
View File
@@ -148,6 +148,7 @@ export async function setupGitHubToken(): Promise<string> {
},
);
console.log("App token successfully obtained");
core.setSecret(appToken);
console.log("Using GITHUB_TOKEN from OIDC");
return appToken;