Skip to content

fix(security): skip symlinks when pinning repos#5

Merged
Canvinus merged 1 commit into
mainfrom
hotfix/ipfs-symlink-leak
Jun 5, 2026
Merged

fix(security): skip symlinks when pinning repos#5
Canvinus merged 1 commit into
mainfrom
hotfix/ipfs-symlink-leak

Conversation

@Canvinus

@Canvinus Canvinus commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • skip symlinks and non-regular files before adding verified repos to IPFS
  • resolve the upload root and reject resolved paths outside that root
  • add regression tests for symlinked files/directories pointing outside the repo

Verification

  • docker run --rm -v /Users/andrey/Documents/SourceScan/verifier-back:/src:ro -w /tmp/work node:24-alpine sh -lc 'cp -a /src/nest/. . && npm ci && npm test -- --runInBand && npm run build'
  • 9 Jest suites passed, 41 tests passed
  • nest build passed

@Canvinus Canvinus merged commit 03f03ea into main Jun 5, 2026
2 checks passed
@Canvinus Canvinus deleted the hotfix/ipfs-symlink-leak branch June 5, 2026 21:00

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06d8371f21

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +129 to +133
if (stats.isSymbolicLink()) {
this.logger.warn(
`Skipping symbolic link while adding to IPFS: ${fullPath}`,
);
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve in-repo symlinks when pinning sources

When a verified Git repo contains a symlink whose target is still inside the checked-out repo, this unconditional skip drops that source path from the CID even though the build may have followed it successfully. Since verify.controller.ts stores this CID as the pinned source snapshot after checkout and verification, users fetching the pinned source can get a tree that no longer matches or rebuilds the verified commit; the existing isPathInsideRoot check below can distinguish safe in-repo targets from external ones instead of skipping both.

Useful? React with 👍 / 👎.

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