security: validate download keys before filesystem access (ai:gpt-5) #50
Labels
No labels
nagonag
nagonag/ignore
bug
doc
duplicate
enhancement
help wanted
invalid
question
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
IUS/once#50
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?
Finding from a whole-codebase security review.
Affected code:
keydirectly fromr.URL.Path.filepath.Join(dir, name, "meta.json").Impact:
Download URLs are bearer-token URLs, but the token is not validated before filesystem access. Go's ServeMux redirects literal
../paths, but encoded path segments such as%2e%2ereach the handler decoded.filepath.Jointhen cleans those segments and can escape the intended store directory while looking for ameta.json/contentpair. Even if exploitation depends on filesystem layout, this is the wrong trust boundary for a public unauthenticated endpoint.Suggested fix:
.or..before calling store lookup.strings.TrimPrefixon the full path.../,%2e%2e,%2f) and for valid UUID keys.