Skip to content

Harden fixture publication to prevent symlink clobbering - #589

Open
luvs01 wants to merge 2 commits into
devfrom
codex/fix-symlink-vulnerability-in-fixture-publisher
Open

luvs01 wants to merge 2 commits into
devfrom
codex/fix-symlink-vulnerability-in-fixture-publisher

Conversation

@luvs01

@luvs01 luvs01 commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Tests were publishing marker files via a predictable temporary pathname and non-exclusive writeFileSync, which allowed a same-UID attacker to pre-position a symlink and have the test overwrite an arbitrary target.
  • The goal is to preserve the atomic reader-visible rename contract while preventing symlink-following writes to the temporary file.
  • Add a focused regression that demonstrates and guards against the symlink pre-positioning attack.

Description

  • Add tests/helpers/fixture-file-publisher.ts providing publishFixtureFile(path, content) that creates the temp file with openSync(..., "wx", 0o600), verifies descriptor vs directory-entry identity via fstatSync/lstatSync, writes through the verified descriptor, closes it, and then renameSyncs into place.
  • Replace the previous non-exclusive temp-write in tests/helpers/native-profile-startup-child.ts with an import and uses of publishFixtureFile for both the port and settled marker publications.
  • Add a regression test tests/codex-integration/native-profile-startup-publication.test.ts that pre-creates a PID-derived .tmp symlink and asserts publishFixtureFile throws and does not clobber the symlink target.
  • Register the new test in scripts/test-layout/layout.json and tests/fixtures/test-layout-expected.json so it participates in tooling and layout checks.

Testing

  • Ran the focused test set with bun test tests/codex-integration/native-profile-startup-publication.test.ts tests/codex-integration/native-profile-startup.test.ts tests/test-layout.test.ts tests/test-layout-tooling.test.ts and observed the changed/focused tests pass (66 passed, 0 failed).
  • Ran type checking and privacy scan with bun run typecheck and bun run privacy:scan, both reported success.
  • Attempted the repository-wide bun run test; the new focused tests passed, but the full parallel suite produced unrelated timing/contention failures in preexisting tests (unrelated to these changes).

Codex Task


Devin Review

devin-ai-integration Bot and others added 2 commits September 20, 2026 13:22
…forwarded role (lidge-jun#5334 follow-up)

lidge-jun#5334 made the developer wire role tri-state: an undeclared destination folds
it to system. Two suites asserting role:"developer" on the Chat wire were
missed because they are about tool-result repair ordering and document parts,
not role selection — declare the destination, per the convention the change
established.

Verified: both files fail on dev@600075d2 with system-for-developer wire roles
and pass with the declaration.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: luvs01/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 9fd17bd4-aaa2-43ca-8184-98418516a9c6


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-09-21T00:54:34.076363Z 67a5bda PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore label Sep 21, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant