Skip to content

Harden branding image symlink check to cover ancestor directories#3261

Merged
Mpdreamz merged 1 commit intomainfrom
fix/branding-symlink-ancestor-dirs
May 6, 2026
Merged

Harden branding image symlink check to cover ancestor directories#3261
Mpdreamz merged 1 commit intomainfrom
fix/branding-symlink-ancestor-dirs

Conversation

@Mpdreamz
Copy link
Copy Markdown
Member

@Mpdreamz Mpdreamz commented May 6, 2026

Why

The previous symlink check on branding.icon and branding.og-image only tested whether the image file itself was a symlink. A symlinked parent directory (e.g. assets//etc/) would pass the check and allow an attacker to read arbitrary files outside the documentation source directory.

However we still validate the file itself is an image.

What

Replaces the bare resolved.LinkTarget is not null check with ValidateFileAccess, which walks ancestor directories up to the doc root and rejects any symlinked or hidden intermediate directory — the same protection already used for docset.yml and toc.yml.

The previous check only tested the image file itself for symlinks.
ValidateFileAccess also walks parent directories up to the doc root,
rejecting symlinked or hidden intermediate directories that could be
used to escape the documentation source tree.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@Mpdreamz Mpdreamz requested a review from a team as a code owner May 6, 2026 20:40
@Mpdreamz Mpdreamz added the bug label May 6, 2026
@Mpdreamz Mpdreamz requested a review from reakaleek May 6, 2026 20:40
@Mpdreamz Mpdreamz added the bug label May 6, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

@Mpdreamz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 10 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 05606a7a-baf3-4686-8c1f-f01b08a0a5c6

📥 Commits

Reviewing files that changed from the base of the PR and between dea6859 and 63f3bbf.

📒 Files selected for processing (1)
  • src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/branding-symlink-ancestor-dirs

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 and usage tips.

@Mpdreamz Mpdreamz enabled auto-merge (squash) May 6, 2026 20:40
@Mpdreamz Mpdreamz merged commit 9e5d1f3 into main May 6, 2026
26 checks passed
@Mpdreamz Mpdreamz deleted the fix/branding-symlink-ancestor-dirs branch May 6, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants