Skip to content

feat(security): add auth token flag to protect self-hosted server - #116

Merged
kernelshard merged 3 commits into
developfrom
feat/server-auth-token
Nov 6, 2026
Merged

kernelshard merged 3 commits into
developfrom
feat/server-auth-token

Conversation

@kernelshard

Copy link
Copy Markdown
Owner

Adds an optional auth token flag and environment variable to protect self-hosted servers from unauthorized subdomain registrations.

• Server: --token flag and EXPOSE_SERVER_TOKEN env fallback
• Client: --token flag and EXPOSE_SERVER_TOKEN env fallback
• Rejects handshake with ErrUnauthorized using constant-time comparison (crypto/subtle)
• Fully backwards compatible when server has no token configured
• Adds unit tests for rejection, success handshake, and CLI commands

Closes #63

@codecov-commenter

codecov-commenter commented Nov 6, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 66.66667% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.44%. Comparing base (e94c647) to head (3d7e422).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
internal/cli/server.go 20.00% 4 Missing ⚠️
internal/cli/tunnel.go 20.00% 4 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff              @@
##           develop     #116       +/-   ##
============================================
+ Coverage    62.77%   73.44%   +10.66%     
============================================
  Files           15       15               
  Lines          814      836       +22     
============================================
+ Hits           511      614      +103     
+ Misses         272      192       -80     
+ Partials        31       30        -1     
Flag Coverage Δ
unittests 73.44% <66.66%> (+10.66%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…oken

# Conflicts:
#	internal/provider/selfhosted.go
#	internal/provider/selfhosted_test.go
@kernelshard
kernelshard merged commit 9ad0e95 into develop Nov 6, 2026
2 checks passed
@kernelshard
kernelshard deleted the feat/server-auth-token branch November 6, 2026 19:22
kernelshard added a commit that referenced this pull request Nov 6, 2026
* fix(deploy): enable on_demand in Caddyfile for dynamic subdomain SSL (#112) (#114)

Co-authored-by: Samiul Sk <9149283+kernelshard@users.noreply.github.com>

* fix(provider/selfhosted): server-advertised max connections and cap standby pool (#113)

* fix(provider/selfhosted): cap data connections to 10 and eliminate dial spin (#55)

* feat(provider/selfhosted): negotiate server-advertised max connections (#55)

---------

Co-authored-by: Samiul Sk <9149283+kernelshard@users.noreply.github.com>

* feat(security): add auth token flag to protect self-hosted server (#116)

* feat(security): add auth token flag to protect self-hosted server (#63)

* test: add unit tests for cli commands and tunnel service

---------

Co-authored-by: Samiul Sk <9149283+kernelshard@users.noreply.github.com>

* docs: document optional auth token for self-hosted server

* chore(release): bump version to v0.6.3 and update documentation

---------

Co-authored-by: Samiul Sk <9149283+kernelshard@users.noreply.github.com>
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.

feat(security): add auth token flag to protect self-hosted server

2 participants