Add self-extracting binary examples, use internal pathsafe and update README#8
Add self-extracting binary examples, use internal pathsafe and update README#8sanderhahn wants to merge 8 commits intomasterfrom
Conversation
sanderhahn
commented
Feb 11, 2026
- Introduced examples for self-extracting binaries using both gozip and the Go standard library.
- Added demo scripts and main programs demonstrating the creation and extraction of payload files.
- Updated README with instructions and examples for building self-extracting binaries.
- Introduced examples for self-extracting binaries using both gozip and the Go standard library. - Added demo scripts and main programs demonstrating the creation and extraction of payload files. - Updated README with instructions and examples for building self-extracting binaries.
There was a problem hiding this comment.
Pull request overview
Adds documentation and runnable examples demonstrating “self-extracting” binaries where a zip payload is appended to an executable, and shows extraction both via gozip and via Go’s archive/zip.
Changes:
- Expanded
readme.mdwith self-extracting binary instructions and two example approaches (gozip + stdlib). - Added a
gozip-based self-extracting example program anddemo.sh. - Added a stdlib-only self-extracting example program and
demo.sh.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| readme.md | Adds build/run instructions and embedded-zip extraction examples (gozip + stdlib). |
| examples/selfextract/main.go | Example self-extracting app using gozip.Unzip / UnzipList. |
| examples/selfextract/demo.sh | Scripted demo for building/packing/running the gozip-based example. |
| examples/selfextract-stdlib/main.go | Example extractor implemented with archive/zip (no gozip import). |
| examples/selfextract-stdlib/demo.sh | Scripted demo for building/packing/running the stdlib-based example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add `sanitizePath` function to prevent path traversal attacks. - Update `main.go` to use `zip.OpenReader` and sanitize paths during extraction. - Refactor `Unzip` function in `gozip.go` to utilize `pathsafe.SafeJoin`. - Remove dependency on `github.com/cyphar/filepath-securejoin`. - Add tests for path sanitization in `gozip_test.go`. - Update README with improved examples and warnings about path validation.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
go.mod:4
go.sumis now committed as an empty file (0 lines). If the module has no external dependencies after removingfilepath-securejoin, it’s cleaner to deletego.sumentirely; otherwise, regenerate it viago mod tidyso it contains the expected sums.
module github.com/sanderhahn/gozip
go 1.22
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@sanderhahn I've opened a new pull request, #9, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: sanderhahn <775103+sanderhahn@users.noreply.github.com>
Co-authored-by: sanderhahn <775103+sanderhahn@users.noreply.github.com>
Co-authored-by: sanderhahn <775103+sanderhahn@users.noreply.github.com>
Fix GOOS detection and document TOCTOU limitations in pathsafe