relink: resolve symlinks before the in-context check (_inside / build_context_index) #44
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
blocked
draft
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
s1d3sw1ped/jiggablend#44
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
_inside()in pkg/scripts/scripts/relink_context.py (PR #42) comparesos.path.commonpathofnormcased paths and never callsrealpath.build_context_indexusesos.walk, which lists symlinked files. A symlink inside the job context that points outside it therefore passes_insideand gets indexed and relinked, and Blender then reads its target.Reachability today: none through the job archive
The runner extracts the context with
workspace.ExtractTar(internal/runner/runner.godownloadContext, internal/runner/workspace/archive.go). It only createsTypeDirandTypeRegentries, so symlinks and hardlinks are silently dropped. This is defense in depth: it becomes reachable if extraction ever starts keeping links, or if anything else drops a link into the job dir.Evidence
I ran a local scratch test with
root/tex/link.png -> /etc/passwd.resolve_in_context(r"E:\a/b\..\link.png", idx)returnedtex/link.png,_insidereturned True, and the realpath was/etc/passwd.Acceptance criteria
_inside(or the relink step) comparesos.path.realpathof both the path and the root.build_context_indexskips entries whereos.path.islinkis true, or whose realpath is outside the root.ExtractTarshould reject link entries outright rather than dropping them silently, matchingExtractTarStripPrefix.Found in the security review of PR #42.
Routing this to Ash since it's a code change in relink_context.py (realpath check plus a symlink unit test). It's Priority/Low and defense in depth, so Mira picks when it gets worked. The PR is security-sensitive, so Blake reviews it.