mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-12-03 09:09:33 +01:00
fix(tunnel): give the unauthenticated tunnel its own acknowledgement
The network acknowledgement that install.sh writes for every passwordless LAN install also satisfied the tunnel guard, so one click on the welcome screen's tunnel link published full terminal control to a public URL with no login and no confirm. The tunnel now needs CODEMAN_ALLOW_UNAUTHENTICATED_TUNNEL or --allow-unauthenticated-tunnel (carried by web -d and service install), and with no login the browser asks before every enable, reading a new loginConfigured field from GET /api/tunnel/status. The guard is now decided once per request and required again where the tunnel starts, so a save that found the tunnel running can no longer restart it unguarded after a concurrent stop. Closes #706
This commit is contained in:
1 parent
3e06f3c141
commit
fc0ecc6051
26 files changed
+1029
-165
No files matched your search
@@ -7,15 +7,28 @@ export function isExplicitlyEnabled(value: string | undefined): boolean {
|
||||
}
|
||||
|
||||
/**
|
||||
* True when unauthenticated network exposure is acceptable: either a password is
|
||||
* set (auth active) or the operator explicitly acknowledged it. Used by the
|
||||
* tunnel-enable guard (COD-55) to refuse publishing an unauthenticated public URL.
|
||||
* True when an unauthenticated non-loopback BIND is acceptable: either a password is
|
||||
* set (auth active) or the operator explicitly acknowledged it. Quiets the startup
|
||||
* warning only; it does not cover the Cloudflare tunnel (#706), which has its own
|
||||
* acknowledgement below.
|
||||
*/
|
||||
export function isUnauthenticatedNetworkAcknowledged(allowFlag = false): boolean {
|
||||
if (process.env.CODEMAN_PASSWORD) return true;
|
||||
return allowFlag || isExplicitlyEnabled(process.env.CODEMAN_ALLOW_UNAUTHENTICATED_NETWORK);
|
||||
}
|
||||
|
||||
/**
|
||||
* True when the operator opted in to an unauthenticated public Cloudflare tunnel:
|
||||
* `--allow-unauthenticated-tunnel` (passed in as `allowFlag`) or
|
||||
* CODEMAN_ALLOW_UNAUTHENTICATED_TUNNEL. Used by the tunnel-enable guard (COD-55) in
|
||||
* place of a login. Kept apart from the network acknowledgement on purpose (#706):
|
||||
* install.sh writes that one for every passwordless LAN install, and it must never
|
||||
* also publish the machine to the internet. install.sh never writes this one.
|
||||
*/
|
||||
export function isUnauthenticatedTunnelAcknowledged(allowFlag = false): boolean {
|
||||
return allowFlag || isExplicitlyEnabled(process.env.CODEMAN_ALLOW_UNAUTHENTICATED_TUNNEL);
|
||||
}
|
||||
|
||||
export function isLoopbackBindHost(host: string): boolean {
|
||||
const normalized = host
|
||||
.trim()
|
||||
|
||||
Reference in new issue
Block a user