mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-18 23:55:16 +00:00
src/upstream/credential.ts defines what this service holds on a user's behalf and how it reaches an upstream request. The only kind today is an Artcraft session (the signed_session JWT from sign-in) sent as the `session` header; `kind` is stored in grant props from the start so a backend-issued credential can replace it later without touching tools or the client (swap point 2 in mcp/CLAUDE.md). The contract includes non-leaking toString/toJSON: accidental string or JSON conversion yields describe(), never the secret (the secret lives in a private field). Sign-in values are rejected if empty, non-ASCII, or containing whitespace/CRLF (header injection). Unknown prop kinds are an error, not a fallthrough. Tests (9): header attached exactly once and nothing else set, replace semantics, props round-trip, no leak via describe/String/JSON/keys, and validation firing on empty, injection, unknown kind, missing secret, non-object props. Claude-Session: https://claude.ai/code/session_01H3gfN2NCx3hBXSrZXYHUQ3