mirror of
https://github.com/rudrankriyam/App-Store-Connect-CLI.git
synced 2026-04-25 23:55:51 +03:00
[GH-ISSUE #524] Cross-platform hardening: secure_open_other should avoid symlink following where possible #150
Labels
No labels
bug
bug
documentation
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/App-Store-Connect-CLI#150
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?
Originally created by @rudrankriyam on GitHub (Feb 14, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/524
Summary
internal/cli/shared/secure_open_other.gofalls back to plainos.Open/os.OpenFileon non-Unix builds, which can follow symlinks and weakens the no-follow guarantees present on Unix builds.Why this matters
Security posture is currently platform-dependent. For report/artifact file paths, symlink behavior should be explicitly hardened or documented consistently.
Current behavior
O_NOFOLLOWis used.Expected behavior
Lstatchecks + controlled open sequence, andDetailed implementation plan
secure_open_other.go.Acceptance criteria
cc @cursor please implement this end-to-end.
@rudrankriyam commented on GitHub (Feb 14, 2026):
@cursor please implement this issue end-to-end using the checklist and acceptance criteria.
@cursor[bot] commented on GitHub (Feb 14, 2026):
Implemented end-to-end on
cursor/cross-platform-symlink-security-cd97and pushed the changes. I replaced the non-Unix fallback’s plain open calls with a best-effort hardened flow: pre-openLstatsymlink rejection + post-open verification that the opened fd still matches the path (to detect path swaps/races), with explicit TOCTOU caveats in code comments. I wired this throughinternal/cli/shared/secure_open_other.goand added shared helper logic ininternal/cli/shared/secure_open_best_effort.go.I added/updated tests to satisfy the checklist:
internal/cli/shared/secure_open_best_effort_test.gofor:internal/cli/shared/junit_report_test.gosymlink test to use capability-based skip (symlink not supported) instead of unconditional Windows skip, so behavior is checked consistently where symlinks are available.README.mdSecurity section to document Unix (O_NOFOLLOW) vs non-Unix best-effort behavior and residual TOCTOU limitation.Validation evidence (all run successfully):
go test ./internal/cli/shared -run 'TestOpen(Existing|New)NoFollowBestEffort|TestJUnitReport_WriteRefusesSymlink|TestReadLocalizationStrings_RejectsSymlink'make formatmake lintmake testGOOS=windows GOARCH=amd64 go test ./internal/cli/shared -c -o /tmp/shared_windows.test.exe(cross-platform build sanity for non-Unix path)aad5d95Harden non-unix secure open with best-effort nofollow checks37d7b1aFormat secure open best-effort helper@rudrankriyam commented on GitHub (Feb 14, 2026):
Fixed in #532 (merged to main).