Skip to content

Commit 4649586

Browse files
committed
fix(infra): restore symlink rejection in tryReadSecretFileSync
The local wrapper added in 9e4eca0 swallowed all errors from @openclaw/fs-safe@0.2.7's tryReadSecretFileSync via a bare try/catch, silently downgrading every rejectSymlink: true caller (Telegram, LINE, Zalo, IRC, Nextcloud Talk credential files) to accept symlinked credential files. It also broke the infra-state CI shard's symlink expectation that #84595 had just realigned with the new fail-closed upstream contract. Restore the direct re-export so the upstream contract surfaces: undefined for blank/missing/not-found, FsSafeError for symlink, oversize, non-regular file, and hardlink validation failures.
1 parent 6c7fe58 commit 4649586

2 files changed

Lines changed: 3 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Docs: https://docs.openclaw.ai
1818

1919
- WhatsApp: update Baileys to `7.0.0-rc12`.
2020
- Dependencies: update `@openclaw/fs-safe` to `0.2.7` so OpenClaw's default Python-helper-off policy keeps best-effort Node write fallbacks for private stores, secret writes, run logs, and media attachments on Linux/macOS.
21+
- Infra/secrets: restore the fail-closed contract for `tryReadSecretFileSync` so credential loaders that pass `rejectSymlink: true` (Telegram, LINE, Zalo, IRC, Nextcloud Talk tokens) refuse symlinked credential files instead of silently accepting them, and the infra-state CI shard's secret-file symlink test passes again. Thanks @romneyda.
2122
- Browser: honor the configured image sanitization limit for screenshots and labeled snapshots so browser-captured images follow the same resize policy as other image results. (#84595)
2223
- Doctor: remove unrecognized `models.providers.*.models[*].compat.thinkingFormat` values during `doctor --fix` so stale provider model config can validate after upgrade. Fixes #77803.
2324
- Status: show the configured default, session-selected model, reason, clear hint, and docs link when a session remains pinned to a model that differs from `agents.defaults.model.primary`.

src/infra/secret-file.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
import "./fs-safe-defaults.js";
2-
import {
3-
readSecretFileSync as readSecretFileSyncImpl,
4-
tryReadSecretFileSync as tryReadSecretFileSyncImpl,
5-
} from "@openclaw/fs-safe/secret";
2+
import { readSecretFileSync as readSecretFileSyncImpl } from "@openclaw/fs-safe/secret";
63
import { resolveUserPath } from "../utils.js";
74

85
export {
96
DEFAULT_SECRET_FILE_MAX_BYTES,
107
PRIVATE_SECRET_DIR_MODE,
118
PRIVATE_SECRET_FILE_MODE,
129
readSecretFileSync,
10+
tryReadSecretFileSync,
1311
type SecretFileReadOptions,
1412
} from "@openclaw/fs-safe/secret";
1513
export { writeSecretFileAtomic as writePrivateSecretFileAtomic } from "@openclaw/fs-safe/secret";
1614

17-
export function tryReadSecretFileSync(
18-
filePath: string | undefined,
19-
label: string,
20-
options: Parameters<typeof tryReadSecretFileSyncImpl>[2] = {},
21-
): string | undefined {
22-
try {
23-
return tryReadSecretFileSyncImpl(filePath, label, options);
24-
} catch {
25-
return undefined;
26-
}
27-
}
28-
2915
export type SecretFileReadResult =
3016
| {
3117
ok: true;

0 commit comments

Comments
 (0)