Create the server token at install and document the security boundary
This commit is contained in:
@@ -38,6 +38,12 @@ def server_address(config):
|
||||
return f"{config.get('bind_address') or '127.0.0.1'}:{config['server_port']}"
|
||||
|
||||
|
||||
def server_token_env(config):
|
||||
"""PIPELINES_SERVER_TOKEN_FILE for the server, the web proxy and the CLI."""
|
||||
path = (config.get("web") or {}).get("server_token_file")
|
||||
return {"PIPELINES_SERVER_TOKEN_FILE": path} if path else {}
|
||||
|
||||
|
||||
def mdns_args(config):
|
||||
"""The LAN port the server advertises over mDNS.
|
||||
|
||||
@@ -416,6 +422,9 @@ def supervise(config):
|
||||
PIPELINES_NTFY_PUBLIC_URL=config["public_url"],
|
||||
PIPELINES_NTFY_TOKEN_FILE=str(root / "secrets/publisher-token"))
|
||||
env.pop("PIPELINES_NTFY_TOKEN", None)
|
||||
# The server requires, and the proxy and every child CLI send, the
|
||||
# shared token in this file (installs from before it have none).
|
||||
env.update(server_token_env(config))
|
||||
server_command = [str(root / "bin/pipelines-server"), "-addr",
|
||||
server_address(config), "-db", str(root / "data/pipelines.db")]
|
||||
if config.get("allow_authoring") is True:
|
||||
@@ -520,6 +529,7 @@ def main():
|
||||
env.update(config.get("opencode_env", {}))
|
||||
env.update(PIPELINES_URL=f"ws://127.0.0.1:{config['server_port']}/connect",
|
||||
PIPELINES_OPENCODE=config["opencode"], PATH=config["path"])
|
||||
env.update(server_token_env(config))
|
||||
os.execve(binary, [binary, *(forwarded or ["tui"])], env)
|
||||
return
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
|
||||
Reference in New Issue
Block a user