Skip to content

fix(tlscert): make O_NOFOLLOW Windows-safe (unbreak cross-compile) - #56

Merged
malickyeu merged 1 commit into
mainfrom
fix/tlscert-windows-build
Jun 16, 2026
Merged

fix(tlscert): make O_NOFOLLOW Windows-safe (unbreak cross-compile)#56
malickyeu merged 1 commit into
mainfrom
fix/tlscert-windows-build

Conversation

@malickyeu

Copy link
Copy Markdown
Contributor

Summary

PR #54 (--make-certs) opened key.pem with syscall.O_NOFOLLOW to defeat a symlink-redirect attack. That constant is not defined on Windows, so internal/tlscert no longer cross-compiles for GOOS=windows — the next release's Windows binary would fail to build. CI only builds Linux, so it slipped through.

Fix: move the flag behind a platform constant — syscall.O_NOFOLLOW on Unix, 0 (no-op) on Windows. The Unix symlink-redirect protection (and its pentest) is unchanged.

Verified go build ./... now succeeds for linux, windows/amd64 and darwin/arm64.

Type of change

  • Bug fix

Checklist

  • go test -short ./... and go vet ./... pass
  • gofmt gate is clean
  • Frontend — n/a
  • web/dist — n/a
  • Added/updated tests for the change (existing tlscert pentests still pass; build now covers all release platforms)
  • CHANGELOG.md entry

Notes for reviewers

No behaviour change on Unix. Two tiny build-tagged files (nofollow_unix.go / nofollow_windows.go) define the oNoFollow constant.

internal/tlscert opened key.pem with syscall.O_NOFOLLOW, which is not
defined on Windows, so the cross-compiled Windows release binary failed to
build. Move the flag behind a platform constant (syscall.O_NOFOLLOW on Unix,
0 on Windows); the symlink-redirect protection is unchanged on Unix.
Copilot AI review requested due to automatic review settings June 16, 2026 07:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@malickyeu
malickyeu merged commit bace1cc into main Jun 16, 2026
3 checks passed
@malickyeu
malickyeu deleted the fix/tlscert-windows-build branch June 16, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants