Skip to content

fix(safety): O107 credential path realpath / symlink follow-up (#100 O105) - #102

Merged
QiaolongLi1201 merged 1 commit into
mainfrom
fix/o107-credential-realpath
Oct 11, 2026
Merged

QiaolongLi1201 merged 1 commit into
mainfrom
fix/o107-credential-realpath

Conversation

@QiaolongLi1201

Copy link
Copy Markdown
Collaborator

Summary / 摘要

O107 (P3) — follow-up to #100 (O105).

isMossCredentialPath only used path.resolve, so a workspace symlink pointing at .moss/config.json, .moss/devices.json, ~/.moss/*, ~/.config/moss/*, or .apikey-key bypassed the O105 readFileTool.execute → presentToolOutput gate and returned plaintext secrets.

O105 合入后 QA PASS-WITH-CONDITIONS:软链 / realpath 跟进。本 PR 只加严:对 credential 路径做 realpath(及 dangling 时的 readlink),与 protected-paths / canonicalPath 同精神。无 kill-switch,不放宽任何 O105 断言。

Changes / 改动

  • src/safety/read-scope.ts: credentialPathFollowCandidates + isMossCredentialPath follows realpath / readlink target
  • src/safety/credential-path.ts: isRawApiKeyFile uses the same follow so symlink→.apikey-key still withholds
  • test/o107-credential-realpath.spec.mjs: symlink→config/devices redact; ordinary notes symlink plaintext; dangling→config fail-closed; revert-red smoke

Acceptance / 验收

Check Result
Symlink → .moss/config.json (fake apiKey): execute no plaintext, [REDACTED]; isMossCredentialPath(link) true pass
Symlink → .moss/devices.json password pass
Symlink → ordinary notes.txt plaintext, not credential
Revert-red: lexical-only isMossCredentialPath + basename-only isRawApiKeyFile → 6/8 fail; restore → 8/8 pass pass
O105 suite + read-scope.spec.mjs 10/10 pass
npm run check green

Test plan

npm run build
node --test test/o107-credential-realpath.spec.mjs
node --test test/o105-config-credential-read.spec.mjs test/read-scope.spec.mjs
npm run check

Head: d5aec5ca · Base: 9629e423 (#100 merge).

isMossCredentialPath only path.resolve'd, so a workspace symlink into
.moss/config.json, devices.json, ~/.moss/*, ~/.config/moss/*, or
.apikey-key bypassed the O105 readFileTool.execute redaction gate.

Follow realpath (and readlink when dangling) like protected-paths /
canonicalPath; tighten isRawApiKeyFile the same way. Ordinary file
symlinks stay ungated. No kill-switch; O105 asserts unchanged.

Tests: symlink→config/devices redact; notes symlink plaintext;
dangling→config fail-closed; revert-red without follow.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@QiaolongLi1201
QiaolongLi1201 merged commit 048aa1f into main Oct 11, 2026
6 of 12 checks passed
@QiaolongLi1201
QiaolongLi1201 deleted the fix/o107-credential-realpath branch October 12, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant