Skip to content

Prevent symlink traversal in content migration mutations - #47104

Closed
Ahmed-B52 wants to merge 1 commit into
github:mainfrom
Ahmed-B52:coderabbit/secure-content-migration-paths/70ce560f
Closed

Ahmed-B52 wants to merge 1 commit into
github:mainfrom
Ahmed-B52:coderabbit/secure-content-migration-paths/70ce560f

Conversation

@Ahmed-B52

Copy link
Copy Markdown

Why:

Closes:

What's being changed (if available, include any code snippets, screenshots, or gifs):

Check off the following:

  • A subject matter expert (SME) has reviewed the technical accuracy of the content in this PR. In most cases, the author can be the SME. Open source contributions may require an SME review from GitHub staff.
  • The changes in this PR meet the docs fundamentals that are required for all content.
  • All CI checks are passing and the changes look good in the review environment.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings November 28, 2026 00:46
@github-actions

Copy link
Copy Markdown
Contributor

How to review these changes 👓

Thank you for your contribution. To review these changes, choose one of the following options:

A Hubber will need to deploy your changes internally to review.

Table of review links

Note: Please update the URL for your staging server or codespace.

This pull request contains code changes, so we will not generate a table of review links.

🤖 This comment is automatically generated.

@docs-bot docs-bot added the invalid This issue/PR is invalid label Nov 28, 2026
@docs-bot

Copy link
Copy Markdown
Collaborator

👋 Hi there! It looks like you've modified some files that we can't accept as contributions:

  • src/content-render/scripts/move-by-content-type.ts
  • src/content-render/tests/move-by-content-type.ts

You'll need to raise a new PR that doesn't include those files, before we can review.

The complete list of files we can't accept are:

  • Anything in the root directory
  • .devcontainer/**
  • .github/**
  • data/reusables/rai/**
  • .vscode/**
  • config/**
  • contributing/**
  • src/**
  • content/actions/how-tos/secure-your-work/security-harden-deployments/**
  • content/README.md

We also can't accept contributions to files in the content directory with frontmatter contentType: rai. You can always check out our full contribution guidelines.

@github-actions github-actions Bot added the triage Do not begin working on this issue until triaged by the team label Nov 28, 2026
@github-actions github-actions Bot closed this Nov 28, 2026

@Ahmed-B52 Ahmed-B52 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

0X

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The security-sensitive migration changes recursive symlink checks, platform-dependent no-follow writes, and child-process path mutations, requiring human runtime validation of end-to-end filesystem, race, and cross-platform behavior.

No open issues 🎉

What changed in this PR

Hardens the content migration utility against symlink traversal and out-of-root inputs while preserving normal migration behavior.

Changes:

  • Rejects symbolic links anywhere under content before mutations begin.
  • Validates input paths remain within the content tree and uses safer file-write flags.
  • Adds integration tests for symlink rejection, invalid paths, and standard migrations.
File Description
src/​content-render/​tests/​move-by-content-type.ts Adds regression tests covering symlink traversal prevention, invalid input paths, and standard migration behavior.
src/​content-render/​scripts/​move-by-content-type.ts Adds content-tree symlink detection, path containment validation, safer file writes, and asynchronous error handling.

Review effort: Lite

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

Labels

invalid This issue/PR is invalid triage Do not begin working on this issue until triaged by the team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants