Skip to content

M7 trust boundary - #1

Merged
5aranx merged 3 commits into
mainfrom
m7-trust-boundary
Nov 30, 2026
Merged

5aranx merged 3 commits into
mainfrom
m7-trust-boundary

Conversation

@5aranx

@5aranx 5aranx commented Nov 30, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copyright (c) 2026 5aranx, matching the license and author declared in
pyproject.toml.
Operator authorization (T1, T3)
- Read operator tokens from SHADOWGATE_API_TOKENS_JSON, with the legacy
  SHADOWGATE_API_TOKENS name as a fallback.
- Refuse to start on malformed token configuration. An empty token map is
  allowed only with SHADOWGATE_INSECURE_DEV=true.
- Build the app with the create_app factory (uvicorn --factory); importing
  the module no longer creates files.
- Require a viewer/operator/admin role on every route except /healthz, /,
  /enroll and the agent routes. Accept Bearer or HTTP Basic (token as
  password); /ui sends a Basic challenge. API docs are off outside dev mode.

Agent identity and job ownership (T2)
- /enroll is authorized by the one-time enrollment token alone. Tokens can
  be bound to an agent id. A per-agent token is returned once and stored
  only as a SHA-256 hash. Enrollment runs in one transaction on a dedicated
  connection. Re-enrolling an existing agent returns 409 and the token is
  not burned. Pre-existing agents with no credential can be reclaimed once,
  with a token bound to their id; stored tags are preserved.
- /agent/poll and /agent/result authenticate with X-ShadowGate-Agent-Token
  and take the agent id from the credential. Results are accepted only from
  the job's owner while it is running. An identical retry returns
  "duplicate"; a conflicting one 409; an unknown or foreign job 404.
- The Poller sends the credential, keeps undelivered results and retries
  them, and stops on 401/403.

Launcher and tests
- run.sh uses its development tokens only when no token variable is set in
  the shell (case-insensitive) and .env defines none. --check exports no
  tokens. The redundant SHADOWGATE_DATA_DIR export is removed.
- Tests are isolated from the caller's SHADOWGATE_* variables and .env, so
  ./run.sh --check passes. tests/test_env_precedence.py pins the settings
  and launcher precedence.
- 77 tests pass (17 before); ruff and mypy --strict are clean.

Docs
- README, architecture and threat model describe only verified behavior
  and list the known limitations.
The assessment is the pre-M7 snapshot (findings S1-S8, C1-C9). The tracker
holds the backlog, the M7 plan, implementation and verification records,
the release-readiness review, and the known limitations.
@5aranx
5aranx merged commit b4fcffa into main Nov 30, 2026
2 checks passed
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.

1 participant