Skip to content

repository: reject any updates that has symlink in path hierarchy#8082

Merged
unknwon merged 6 commits intomainfrom
GHSA-gg64-xxr9-qhjp
Jan 8, 2026
Merged

repository: reject any updates that has symlink in path hierarchy#8082
unknwon merged 6 commits intomainfrom
GHSA-gg64-xxr9-qhjp

Conversation

@unknwon
Copy link
Member

@unknwon unknwon commented Jan 8, 2026

Describe the pull request

Link to the GHSA: GHSA-gg64-xxr9-qhjp, closes #8071

Test plan

Tested manually.

@unknwon unknwon added this to the 0.13.4 milestone Jan 8, 2026
This commit fixes the style issues introduced in 28b04ab according to the output
from Go fmt and Gofumpt.

Details: #8082
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses a security vulnerability (GHSA-gg64-xxr9-qhjp) related to symlink path traversal attacks in the repository file editor. The fix prevents malicious users from exploiting symlinks in the path hierarchy to access or modify files outside the intended repository directories.

Key changes:

  • Introduced hasSymlinkInPath function to detect symlinks anywhere in the path hierarchy
  • Added security checks before file operations in UpdateRepoFile, GetDiffPreview, and DeleteRepoFile functions
  • Simplified and fixed IsSymlink function in osutil package to avoid following symlinks during detection

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
internal/osutil/osutil.go Updated function documentation for clarity about symlink following behavior; simplified IsSymlink implementation to fix potential bug
internal/database/repo_editor.go Added hasSymlinkInPath security function and integrated symlink checks into all file update/delete/preview operations; improved error handling and code consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

unknwon and others added 3 commits January 8, 2026 13:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@unknwon unknwon merged commit 553707f into main Jan 8, 2026
12 checks passed
@unknwon unknwon deleted the GHSA-gg64-xxr9-qhjp branch January 8, 2026 19:22
@cfi-gb cfi-gb mentioned this pull request Jan 9, 2026
1 task
unknwon added a commit that referenced this pull request Jan 21, 2026
)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

CVE-2025-8110 Mitigation

2 participants