Skip to content

feat(aincrad)!: separate read-only token vs full one - #575

Merged
vEnhance merged 2 commits into
mainfrom
claude/aincrad-api-auth-4ih4yb
Sep 29, 2026
Merged

vEnhance merged 2 commits into
mainfrom
claude/aincrad-api-auth-4ih4yb

Conversation

@vEnhance

@vEnhance vEnhance commented Sep 2, 2026

Copy link
Copy Markdown
Owner

also move the token into the header rather than in the POST body

The API is now authenticated by two token hashes instead of one:
API_TOKEN_HASH_FULL, which may do anything, and API_TOKEN_HASH_READONLY,
which may only run the actions in READONLY_ACTIONS (currently `init`).
A read-only token used for anything else gets a 403 saying so.

The check itself moves to aincrad/auth.py and gains three things: a
constant-time comparison, support for a Django password hash (salted
PBKDF2) as an alternative to a bare SHA-256 digest, and acceptance of the
token in an `Authorization: Bearer` header. Existing SHA-256 hashes and
body tokens keep working, so only the new variable has to be deployed.

`./manage.py mkapitoken {full,readonly}` generates a random token and
prints the hash to configure it with.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JTXqG5HKnMgGZF5ebYzkXC
Accepting a Django password hash too was a choice nobody needed to make;
the tokens are random strings, so SHA-256 is what they get. Drops the
mkapitoken command along with it, since generating a random string
belongs on a local machine rather than on the server.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JTXqG5HKnMgGZF5ebYzkXC
@vEnhance
vEnhance force-pushed the claude/aincrad-api-auth-4ih4yb branch 2 times, most recently from 5d999a2 to d3b84e8 Compare September 29, 2026 17:46
@vEnhance
vEnhance merged commit 3f0c6c1 into main Sep 29, 2026
9 checks passed
@vEnhance

Copy link
Copy Markdown
Owner Author

yeah sure why not

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.

2 participants