mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-21 16:41:56 +00:00
test: add transcript permission regression coverage
This commit is contained in:
@@ -18,6 +18,7 @@ Docs: https://docs.openclaw.ai
|
||||
### Fixes
|
||||
|
||||
- Security: replace deprecated SHA-1 sandbox configuration hashing with SHA-256 for deterministic sandbox cache identity and recreation checks. Thanks @kexinoh.
|
||||
- Security/Sessions: create new session transcript JSONL files with user-only (`0o600`) permissions and extend `openclaw security audit --fix` to remediate existing transcript file permissions.
|
||||
- Security/Logging: redact Telegram bot tokens from error messages and uncaught stack traces to prevent accidental secret leakage into logs. Thanks @aether-ai-agent.
|
||||
- Sandbox/Security: block dangerous sandbox Docker config (bind mounts, host networking, unconfined seccomp/apparmor) to prevent container escape via config injection. Thanks @aether-ai-agent.
|
||||
- Sandbox: preserve array order in config hashing so order-sensitive Docker/browser settings trigger container recreation correctly. Thanks @kexinoh.
|
||||
|
||||
@@ -183,6 +183,10 @@ describe("appendAssistantMessageToSessionTranscript", () => {
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok) {
|
||||
expect(fs.existsSync(result.sessionFile)).toBe(true);
|
||||
const sessionFileMode = fs.statSync(result.sessionFile).mode & 0o777;
|
||||
if (process.platform !== "win32") {
|
||||
expect(sessionFileMode).toBe(0o600);
|
||||
}
|
||||
|
||||
const lines = fs.readFileSync(result.sessionFile, "utf-8").trim().split("\n");
|
||||
expect(lines.length).toBe(2);
|
||||
|
||||
@@ -255,6 +255,9 @@ describe("security fix", () => {
|
||||
const sessionsStorePath = path.join(sessionsDir, "sessions.json");
|
||||
await fs.writeFile(sessionsStorePath, "{}\n", "utf-8");
|
||||
await fs.chmod(sessionsStorePath, 0o644);
|
||||
const transcriptPath = path.join(sessionsDir, "sess-main.jsonl");
|
||||
await fs.writeFile(transcriptPath, '{"type":"session"}\n', "utf-8");
|
||||
await fs.chmod(transcriptPath, 0o644);
|
||||
|
||||
const env = {
|
||||
...process.env,
|
||||
@@ -269,6 +272,7 @@ describe("security fix", () => {
|
||||
expectPerms((await fs.stat(allowFromPath)).mode & 0o777, 0o600);
|
||||
expectPerms((await fs.stat(authProfilesPath)).mode & 0o777, 0o600);
|
||||
expectPerms((await fs.stat(sessionsStorePath)).mode & 0o777, 0o600);
|
||||
expectPerms((await fs.stat(transcriptPath)).mode & 0o777, 0o600);
|
||||
expectPerms((await fs.stat(includePath)).mode & 0o777, 0o600);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user