Repository navigation
fix(indexer): skip non-regular files and prevent tar path traversal - #6505
Open
another-rex wants to merge 1 commit into
Open
another-rex wants to merge 1 commit into
another-rex wants to merge 1 commit into
Conversation
another-rex
force-pushed
the
fix/indexer-symlink-tarslip
branch
from
December 4, 2026 02:25
c4ccc3e to
8800181
Compare
another-rex
marked this pull request as ready for review
December 4, 2026 04:13
jess-lowe
approved these changes
Dec 4, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Some general hardening for indexer. I don't want to touch it too much.
Mitigate symlink arbitrary file reads and Tar-Slip path traversal in
gcp/indexerwith minimal changes.(AI-assisted PR)
Details
gcp/indexer/stages/preparation/preparation.go:NoCheckout: trueso working-tree symlinks from external repos are not materialized on disk during preparation.copyToBucket, checkfilepath.Walkerrors, skip non-regular files (!info.Mode().IsRegular()), and write clean relative tar paths (filepath.Rel).gcp/indexer/stages/processing/processing.go:filepath.Walkerrors and skip non-regular files (!info.Mode().IsRegular()) so checked-out symlinks are never dereferenced or hashed intoRepoIndex.gcp/indexer/shared/shared.go:CopyFromBucket, enforce regular-file tar entry types (skippingtar.TypeDirand rejecting symlinks/hardlinks), verify extracted paths remain strictly withintmpDir(preserving compatibility with existing leading-/tarballs), close the GCS reader, and clean uptmpDiron error.Testing
go test ./...,go vet ./..., andgolangci-lint@v2.14.0 run ./...+fmt --diff ./...ingcp/indexer(all passed, 0 issues).NoCheckout: trueclones work with ref enumeration andWorktree().Checkout, that symlinks/broken symlinks are skipped, and that tar traversal/symlink entries are rejected.agy