mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-12-05 09:03:39 +01:00
With the dashboard bound to the network (make up-lan), the frontend proxy added the server ADMIN_KEY to every same-origin request and the backend trusted the frontend container as the local operator, so any device on the LAN that opened the dashboard had full control: DMs, contacts, gate keys and settings. The proxy cannot tell the local browser apart from other devices, because Next.js forwards client-supplied X-Forwarded-For verbatim (verified against next start: a remote client sending X-Forwarded-For: 127.0.0.1 reaches the backend as 127.0.0.1). SHADOWBROKER_LAN_MODE=1, set by make up-lan, now makes the proxy inject the admin key only for signed-in admin sessions and stops the backend trusting the frontend container. Loopback tools on the host keep working. For a backend behind nginx/Caddy on the same host, the new opt-in SHADOWBROKER_UNTRUSTED_LOOPBACK=1 makes loopback callers present the key too. Default installs are unchanged. Also compare the admin key in constant time at sign-in, and make the 403 message say how to sign in from another device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UeX9wuqeVAQNr22zQHWj2H
59 lines
1.8 KiB
Makefile
59 lines
1.8 KiB
Makefile
.PHONY: up-local up-lan down restart-local restart-lan logs status help
|
|
|
|
COMPOSE = docker compose
|
|
|
|
# Detect LAN IP (tries Wi-Fi first, falls back to Ethernet)
|
|
LAN_IP := $(shell ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null)
|
|
|
|
## Default target — print help
|
|
help:
|
|
@echo ""
|
|
@echo "Shadowbroker taskrunner"
|
|
@echo ""
|
|
@echo "Usage: make <target>"
|
|
@echo ""
|
|
@echo " up-local Start with loopback binding (local access only)"
|
|
@echo " up-lan Start with 0.0.0.0 binding (LAN accessible)"
|
|
@echo " down Stop all containers"
|
|
@echo " restart-local Bounce and restart in local mode"
|
|
@echo " restart-lan Bounce and restart in LAN mode"
|
|
@echo " logs Tail logs for all services"
|
|
@echo " status Show container status"
|
|
@echo ""
|
|
|
|
## Start in local-only mode (loopback only)
|
|
up-local:
|
|
BIND=127.0.0.1 $(COMPOSE) up -d
|
|
|
|
## Start in LAN mode (accessible to other hosts on the network)
|
|
up-lan:
|
|
@if [ -z "$(LAN_IP)" ]; then \
|
|
echo "ERROR: Could not detect LAN IP. Check your network connection."; \
|
|
exit 1; \
|
|
fi
|
|
@echo "Detected LAN IP: $(LAN_IP)"
|
|
BIND=0.0.0.0 SHADOWBROKER_LAN_MODE=1 CORS_ORIGINS=http://$(LAN_IP):3000 $(COMPOSE) up -d
|
|
@echo ""
|
|
@echo "Shadowbroker is now running and can be accessed by LAN devices at http://$(LAN_IP):3000"
|
|
@echo "LAN mode: every browser, including this computer's, must sign in with ADMIN_KEY"
|
|
@echo "(Settings -> admin key) before using messages, gates or settings. Set a strong"
|
|
@echo "ADMIN_KEY in .env; without one, protected features stay locked."
|
|
|
|
## Stop all containers
|
|
down:
|
|
$(COMPOSE) down
|
|
|
|
## Restart in local-only mode
|
|
restart-local: down up-local
|
|
|
|
## Restart in LAN mode
|
|
restart-lan: down up-lan
|
|
|
|
## Tail logs for all services
|
|
logs:
|
|
$(COMPOSE) logs -f
|
|
|
|
## Show running container status
|
|
status:
|
|
$(COMPOSE) ps
|