Repository navigation
Allow custom endpoints to opt out of API key auth - #30
TheGreatAxios wants to merge 2 commits into
Conversation
|
Triage: Pass No changes needed from you. A maintainer will review this pull request. |
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Trust
Custom endpoints may set auth: "none" and send no API key. Official and gateway endpoints still require one.
Findings
No blocking trust findings.
src/schemas.ts:143— only the custom arm acceptsauth: "none". Official and gateway usekind: "'official' | 'gateway'"with"+": "reject", so{ kind: "official", auth: "none" }and the gateway twin fail closed.{ kind: "custom", auth: "bearer" }does not coerce to"none".src/config.ts:99—"none"is applied only whenkind === "custom". The official and gateway return hardcodesauth: "key"(src/config.ts:116), including whenendpointis absent.src/evaluate.ts:288—keylessis onlyendpoint.auth === "none". That path does not readconfig.apiKeyor the env key, andpostEvaluateaddsAuthorizationonly for a non-emptyapiKey.src/adapter.ts:269—createSystemOneAdapterparsesEvaluateConfigbefore building a request.buildRequestuses the bearer sentinel only whenendpoint.auth !== "none"(src/adapter.ts:200).
A custom URL that happens to be the official host is still a custom opt-out. The boundary in this diff is kind, not URL equality.
Coverage note, not a hole: src/evaluate.test.ts rejects auth on official but has no gateway twin. Gateway already shares that schema arm.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Request changes
Lets a custom endpoint set auth: "none" and send no API key. Official and gateway endpoints still require one, and any other auth value throws before a request is built.
Findings
The behavior is clean. bun test src/adapter.test.ts src/evaluate.test.ts exited 0 (37 pass). A deleted probe also checked that auth: "none" omits Authorization on evaluate, createSystemOneAdapter, and the factory even when a key is set, and that bearer, None, "", null, and auth: "none" on official or gateway are rejected with no request.
-
Commit subjects do not follow
CONTRIBUTING.md. Both lack a type, and both end with a period:Allow custom endpoints to opt out of API key auth.Reject invalid adapter endpoint auth before building a request.
Subjects need a Conventional Commits type, an imperative subject, lowercase after the colon, and 72 characters or fewer. The code does not need another change for this.
A custom endpoint with auth set to none skips the no-key fallback and sends no Authorization header. Official and gateway endpoints still require a key.
createSystemOneAdapter now parses its config the same way evaluate does, so an auth value other than none throws instead of sending the bearer sentinel.
3ce3327 to
a2c495a
Compare
Review · Follow-upCommit subjects now follow
Force-pushed as |
|
Superseded by the 0.4.0 release, which is merged: #34 |
Summary
auth: "none"and skip the API key.Authorizationheader, including throughcreateSystemOneAdapter.Verification
bun run checkexited 0 (42 tests on the amended commit).c4755e2found no defects.Fixes CL-9939