Generate the job capture token from the admin panel
Deploy with Docker Compose / deploy (push) Successful in 52s
Deploy with Docker Compose / deploy (push) Successful in 52s
The userscript's bearer token was an env var, JOB_CAPTURE_TOKEN, so rotating it meant editing .env and redeploying. It is now minted on the admin diagnostics panel instead, and the env var is gone. - services.CaptureToken keeps only a SHA-256 of the token, in backend/token/job_capture_token.json beside the OAuth tokens, so it survives rebuilds and cannot be read back. The token is shown once. - GET/POST/DELETE /admin/capture-token report, generate (replacing any existing token) and revoke it, behind the cookie-authenticated admin group. - With no token generated the capture routes still answer 503. - Userscript bumped to 1.0.1 for the changed prompt text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+11
-3
@@ -83,6 +83,7 @@ for the things GraphQL cannot do:
|
||||
| `/notes/*path` | streams a file download, not JSON |
|
||||
| `/ws` | WebSocket upgrade |
|
||||
| `/rowing` (GET), `/spotify/listening`, `/spotify/recent` | predate the equivalent queries; kept working |
|
||||
| `/admin/config`, `/admin/logs`, `/admin/capture-token` | process environment and files on disk, not the data model |
|
||||
| `/jobs/capture`, `/jobs/capture/status`, `/jobs/capture/extract` | called by a userscript on other sites' origins, where the `SameSite=Lax` auth cookies are never sent; they take a bearer token instead |
|
||||
|
||||
### Job capture
|
||||
@@ -91,10 +92,17 @@ for the things GraphQL cannot do:
|
||||
(`vue/public/job-capture.user.js`, installed from the tracker page) that adds
|
||||
the posting open in the browser to the job tracker.
|
||||
|
||||
- **Auth** is `Authorization: Bearer $JOB_CAPTURE_TOKEN`, checked by
|
||||
- **Auth** is `Authorization: Bearer <token>`, checked by
|
||||
`CaptureTokenMiddleware`. The token opens these three routes and nothing
|
||||
else — it cannot read the tracker or reach GraphQL. **An unset token turns
|
||||
the routes off (503)**; it never means "no auth".
|
||||
else — it cannot read the tracker or reach GraphQL. **With no token
|
||||
generated the routes are off (503)**; that never means "no auth".
|
||||
- **The token is generated in the admin panel**, not set in `.env`
|
||||
(`services/capture_token.go`; `GET`/`POST`/`DELETE /admin/capture-token`,
|
||||
cookie-authenticated like the rest of the admin group). It is 32 random
|
||||
bytes, shown once; only its SHA-256 is kept, in
|
||||
`/backend/token/job_capture_token.json` beside the OAuth tokens, so it
|
||||
survives restarts and rebuilds. There is one token at a time: generating
|
||||
again replaces it, which is how a leaked one is rotated.
|
||||
- `GET /jobs/capture/status?url=` — is this posting already tracked, and at
|
||||
what status. Drives the script's badge.
|
||||
- `POST /jobs/capture/extract` — page text in, `{jobTitle, company, location,
|
||||
|
||||
Reference in New Issue
Block a user