Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / module
auth
shared.auth
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| Principal | auth.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| _configured | auth.py | same file |
| allowed_for | auth.py | same file |
| is_public | auth.py | same file |
| parse_bearer | auth.py | same file |
| Principal | auth.py | same file |
| principal_for_token | auth.py | same file |
| require_admin | auth.py | same file |
| token_problems | auth.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| router | router.py | through an import |
shared.authbackend/app/shared/auth.py, lines 1–40Open source
"""Machine-to-machine authentication.Pharos is single-tenant: its clients are the owner's own tools (Ronin, anMCP client such as Claude Code, the CLI, the edge worker). Authentication istherefore two static bearer tokens rather than user accounts:``PHAROS_ADMIN_TOKEN`` full access: ingestion, deletion, admin endpoints.``PHAROS_READ_TOKEN`` optional, read-only: GET requests plus the read-only POST endpoints listed in ``READ_ONLY_POST_PREFIXES`` (search, context retrieval, MCP). Give assistants this token so a prompt-injected agent cannot trigger clones of arbitrary repositories or delete data.Threat model and rotation are documented in ``SECURITY.md``. Properties:* fail closed — if no token is configured, every protected request is 401;* constant-time comparison (``hmac.compare_digest``);* tokens are never logged; failures log only the path;* public paths are matched exactly (no prefix tricks like ``/healthz``)."""from __future__ import annotationsimport hmacimport loggingimport osimport uuidfrom dataclasses import dataclassfrom fastapi import HTTPException, Request, statuslogger = logging.getLogger(__name__)PUBLIC_PATHS = frozenset( { "/health", "/docs", "/docs/oauth2-redirect", "/redoc", "/openapi.json",Shows the first 40 of 157 lines. The rest is on GitHub at this commit.
What the index recorded
- Signature
module backend.app.shared.auth- File
backend/app/shared/auth.py- Lines
- 1–157
- Parser
- python-ast
- Git blob
c77f24b3d7406a6b302764a8fc5e475c40480e60- Call sites
- 3 named, 1 resolved, 2 left unlinked
- Outside this subset
- 4 more edges reach code outside the graph shown here
