Skip to content

Commit 6e2bd52

Browse files
authored
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/
1 parent 3534c32 commit 6e2bd52

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

action.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ runs:
227227
id: run
228228
shell: bash
229229
run: |
230-
bun run ${GITHUB_ACTION_PATH}/src/entrypoints/run.ts
230+
bun --no-env-file \
231+
--config="${GITHUB_ACTION_PATH}/bunfig.toml" \
232+
--tsconfig-override="${GITHUB_ACTION_PATH}/tsconfig.json" \
233+
run ${GITHUB_ACTION_PATH}/src/entrypoints/run.ts
231234
env:
232235
# Prepare inputs
233236
MODE: ${{ inputs.mode }}
@@ -324,7 +327,10 @@ runs:
324327
if: always() && inputs.ssh_signing_key != ''
325328
shell: bash
326329
run: |
327-
bun run ${GITHUB_ACTION_PATH}/src/entrypoints/cleanup-ssh-signing.ts
330+
bun --no-env-file \
331+
--config="${GITHUB_ACTION_PATH}/bunfig.toml" \
332+
--tsconfig-override="${GITHUB_ACTION_PATH}/tsconfig.json" \
333+
run ${GITHUB_ACTION_PATH}/src/entrypoints/cleanup-ssh-signing.ts
328334
329335
- name: Post buffered inline comments
330336
if: always() && inputs.classify_inline_comments != 'false'
@@ -336,7 +342,10 @@ runs:
336342
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
337343
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
338344
run: |
339-
bun run ${GITHUB_ACTION_PATH}/src/entrypoints/post-buffered-inline-comments.ts
345+
bun --no-env-file \
346+
--config="${GITHUB_ACTION_PATH}/bunfig.toml" \
347+
--tsconfig-override="${GITHUB_ACTION_PATH}/tsconfig.json" \
348+
run ${GITHUB_ACTION_PATH}/src/entrypoints/post-buffered-inline-comments.ts
340349
341350
- name: Revoke app token
342351
if: always() && inputs.github_token == '' && steps.run.outputs.github_token != '' && steps.run.outputs.skipped_due_to_workflow_validation_mismatch != 'true'

base-action/src/run-claude-sdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export async function runClaudeWithSdk(
151151

152152
console.log(`Running Claude with prompt from file: ${promptPath}`);
153153
// Log SDK options without env (which could contain sensitive data)
154-
const { env, ...optionsToLog } = sdkOptions;
154+
const { env, extraArgs, ...optionsToLog } = sdkOptions;
155155
console.log("SDK options:", JSON.stringify(optionsToLog, null, 2));
156156

157157
const messages: SDKMessage[] = [];

bunfig.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Intentionally minimal. action.yml pins --config to this file so bun resolves
2+
# its runtime config from the action directory rather than the workspace.

src/github/operations/restore-config.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const SENSITIVE_PATHS = [
1515
".claude.json",
1616
".gitmodules",
1717
".ripgreprc",
18+
"CLAUDE.md",
19+
"CLAUDE.local.md",
20+
".husky",
1821
];
1922

2023
/**
@@ -44,16 +47,19 @@ export function restoreConfigFromBase(baseBranch: string): void {
4447
`Restoring ${SENSITIVE_PATHS.join(", ")} from origin/${baseBranch} (PR head is untrusted)`,
4548
);
4649

47-
// Snapshot the PR's .claude/ tree to .claude-pr/ before deleting it.
48-
// This lets review agents inspect what the PR actually changes (CLAUDE.md,
49-
// settings, hooks, MCP configs) without those files ever being executed.
50-
// The snapshot is taken before the security delete so it captures the
50+
// Snapshot every PR-authored sensitive path into .claude-pr/ before deletion
51+
// so review agents can inspect what the PR changes without those files ever
52+
// being executed. Captured before the security delete so it reflects the
5153
// PR-authored version.
5254
rmSync(".claude-pr", { recursive: true, force: true });
53-
if (existsSync(".claude")) {
54-
cpSync(".claude", ".claude-pr", { recursive: true });
55+
for (const p of SENSITIVE_PATHS) {
56+
if (existsSync(p)) {
57+
cpSync(p, `.claude-pr/${p}`, { recursive: true });
58+
}
59+
}
60+
if (existsSync(".claude-pr")) {
5561
console.log(
56-
"Preserved PR's .claude/ → .claude-pr/ for review agents (not executed)",
62+
"Preserved PR's sensitive paths → .claude-pr/ for review agents (not executed)",
5763
);
5864
}
5965

src/github/token.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ export async function setupGitHubToken(): Promise<string> {
148148
},
149149
);
150150
console.log("App token successfully obtained");
151+
core.setSecret(appToken);
151152

152153
console.log("Using GITHUB_TOKEN from OIDC");
153154
return appToken;

0 commit comments

Comments
 (0)