@nacre.work/api 0.5.2 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,MAAM,EAAuB,MAAM,WAAW,CAAA;AAMhG,OAAO,EAeL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,QAAQ,EAEb,KAAK,yBAAyB,EAC/B,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAsC,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAA;AAEpG,OAAO,EAAwB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAoC,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AACjH,OAAO,KAAK,EAAE,KAAK,EAAU,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAoC,KAAK,MAAM,EAAkB,KAAK,KAAK,EAAiB,MAAM,iBAAiB,CAAA;AAS1H,OAAO,EAAY,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACtE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;AAEhC;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAAA;IAC9E;;;;;;;;;;OAUG;IACH,cAAc,CAAC,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC7F;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,YAA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,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,eAAe,CAAC,EAAE,kBAAkB,CAAA;IAC7C,iFAAiF;IACjF,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;IACtB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;IAChC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAClC;AAgqBD,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAuBrD"}
package/dist/server.js CHANGED
@@ -3,7 +3,7 @@ import { createHash, randomUUID, timingSafeEqual } from 'node:crypto';
3
3
  // Imported rather than taken from the global scope: `lib` is ES2023 with no
4
4
  // DOM, so the global URL is not typed here.
5
5
  import { URL } from 'node:url';
6
- import { logger, MetadataError, MultipartError, multipartBoundary, parseMultipart, queryAudit, parseFilters, parseMetadata, PROTECTED_RESOURCE_PATH, JWKS_PATH, ADMIN_PREFIX, adminRoutes, withAuditSinks, TooBusy, } from '@nacre.work/core';
6
+ import { logger, MetadataError, MultipartError, multipartBoundary, parseMultipart, queryAudit, parseFilters, parseMetadata, PROTECTED_RESOURCE_PATH, JWKS_PATH, AUTHORIZATION_SERVER_PATH, AUTHORIZE_PATH, CODE_TTL_MS, REGISTER_PATH, TOKEN_PATH, authorizationServerMetadata, consentRedirect, generateClientId, generateCode, redirectAllowed, verifierMatches, ADMIN_PREFIX, adminRoutes, withAuditSinks, TooBusy, } from '@nacre.work/core';
7
7
  import { authenticate, rejectTenantOverride } from './auth.js';
8
8
  import { badRequest, internal, notFound, Problem } from './errors.js';
9
9
  import { isConflict, isReplay } from './idempotency.js';
@@ -54,6 +54,10 @@ function accountJson(a) {
54
54
  created_at: a.createdAt,
55
55
  last_used_at: a.lastUsedAt,
56
56
  revoked_at: a.revokedAt,
57
+ // Null on everything created before the column, and on anything `init`
58
+ // made. "My agents" filters on it; a guessed owner would be worse than
59
+ // none.
60
+ created_by: a.createdBy ?? null,
57
61
  };
58
62
  }
59
63
  function userJson(u) {
@@ -165,6 +169,15 @@ async function readRaw(req, limit) {
165
169
  }
166
170
  return Buffer.concat(chunks);
167
171
  }
172
+ /**
173
+ * The body as text, for the one endpoint whose media type is not JSON.
174
+ *
175
+ * RFC 6749 specifies `application/x-www-form-urlencoded` at the token endpoint,
176
+ * so it has to see the bytes rather than a parsed object.
177
+ */
178
+ async function readRawBody(req, limit = MAX_BODY_BYTES) {
179
+ return (await readRaw(req, limit)).toString('utf8');
180
+ }
168
181
  async function readBody(req, limit = MAX_BODY_BYTES) {
169
182
  const raw = await readRaw(req, limit);
170
183
  if (raw.length === 0)
@@ -678,6 +691,23 @@ async function handle(req, res, options) {
678
691
  send(res, 200, options.resourceMetadata, requestId);
679
692
  return;
680
693
  }
694
+ /**
695
+ * RFC 8414 — where a client finds the two endpoints.
696
+ *
697
+ * Served only when this deployment runs the authorization server. Absent, the
698
+ * discovery below still answers and simply names no `authorization_servers`,
699
+ * which is the resource-server-only shape this product had before and still
700
+ * supports: a deployment with its own identity provider names that instead.
701
+ */
702
+ if (req.method === 'GET' && instance === AUTHORIZATION_SERVER_PATH) {
703
+ if (options.oauth === undefined) {
704
+ const problem = notFound(instance, requestId);
705
+ send(res, problem.status, problem.toJSON(), requestId);
706
+ return;
707
+ }
708
+ send(res, 200, authorizationServerMetadata(options.oauth.issuer), requestId);
709
+ return;
710
+ }
681
711
  if (req.method === 'GET' && instance === JWKS_PATH) {
682
712
  // The public half of the signing key, so anything outside this process can
683
713
  // verify a token without a secret — a gateway, a sidecar, a second service
@@ -760,6 +790,234 @@ async function handle(req, res, options) {
760
790
  // rather than an omission: they are inside the authenticated surface, where
761
791
  // presenting a credential is the price of being told anything. Nothing is
762
792
  // concealed by it — every route this API serves is in docs/openapi.yaml.
793
+ // ─────────────────────── the authorization server ───────────────────────
794
+ //
795
+ // Three endpoints, and one decision running through all of them: the token
796
+ // this flow issues acts as a **service account**, never as the person who
797
+ // signed in. A consent screen that hands an agent your authority collapses
798
+ // "what may this agent read" into "what may you read", which is the
799
+ // distinction this whole product is built on.
800
+ //
801
+ // Unauthenticated by necessity — a client arrives here with no credential,
802
+ // which is what it came to get. Authority is created at exactly one point:
803
+ // `POST /v1/oauth/consent`, which is inside the authenticated surface and is
804
+ // where a signed-in person picks the agent.
805
+ if (options.oauth !== undefined && (instance === REGISTER_PATH || instance === AUTHORIZE_PATH || instance === TOKEN_PATH)) {
806
+ const oauth = options.oauth;
807
+ // RFC 7591. Open, which is what an MCP client expects and what the RFC is
808
+ // for; the exposure is bounded by the fact that a client row permits
809
+ // nothing at all. It becomes authority only when somebody signs in and
810
+ // approves it, and the consent screen shows the redirect URI beside the
811
+ // self-asserted name, because the URI is what actually decides where a code
812
+ // goes.
813
+ if (instance === REGISTER_PATH) {
814
+ if (req.method !== 'POST') {
815
+ const problem = notFound(instance, requestId);
816
+ send(res, problem.status, problem.toJSON(), requestId);
817
+ return;
818
+ }
819
+ // Read here rather than by the shared parse below: this endpoint sits
820
+ // ahead of the authenticated surface, which is where that happens.
821
+ let posted;
822
+ try {
823
+ posted = await readBody(req);
824
+ }
825
+ catch {
826
+ send(res, 400, { error: 'invalid_request', error_description: 'The request body could not be read.' }, requestId);
827
+ return;
828
+ }
829
+ const registration = (posted ?? {});
830
+ const uris = Array.isArray(registration.redirect_uris)
831
+ ? registration.redirect_uris.filter((u) => typeof u === 'string')
832
+ : [];
833
+ if (uris.length === 0) {
834
+ send(res, 400, { error: 'invalid_redirect_uri', error_description: "'redirect_uris' is required." }, requestId);
835
+ return;
836
+ }
837
+ // Checked at registration as well as at authorize. A URI that could never
838
+ // receive a code is better refused now, when there is somebody to tell,
839
+ // than at the redirect, when the failure is a blank browser tab.
840
+ if (!uris.every((u) => redirectAllowed(u, uris))) {
841
+ send(res, 400, {
842
+ error: 'invalid_redirect_uri',
843
+ error_description: 'Every redirect URI must be https, or http on loopback (127.0.0.1, [::1], localhost).',
844
+ }, requestId);
845
+ return;
846
+ }
847
+ const name = typeof registration.client_name === 'string' ? registration.client_name.slice(0, 200) : 'unnamed client';
848
+ const clientId = generateClientId();
849
+ await oauth.clients.register(name, uris, clientId);
850
+ // 201 and the RFC's field names. No secret: this is a public client and
851
+ // PKCE is what binds the exchange, so issuing one would be theatre.
852
+ send(res, 201, { client_id: clientId, client_name: name, redirect_uris: uris, token_endpoint_auth_method: 'none' }, requestId);
853
+ return;
854
+ }
855
+ // The authorize endpoint hands the browser to the consent screen and does
856
+ // nothing else. Nothing is written here: an unapproved authorization
857
+ // request is a set of query parameters the browser is already carrying, and
858
+ // storing it would add a table any unauthenticated caller could fill.
859
+ if (instance === AUTHORIZE_PATH) {
860
+ if (req.method !== 'GET') {
861
+ const problem = notFound(instance, requestId);
862
+ send(res, problem.status, problem.toJSON(), requestId);
863
+ return;
864
+ }
865
+ const q = url.searchParams;
866
+ const clientId = q.get('client_id') ?? '';
867
+ const redirectUri = q.get('redirect_uri') ?? '';
868
+ const client = clientId === '' ? undefined : await oauth.clients.find(clientId);
869
+ // These two are the only errors that must **not** redirect. RFC 6749 is
870
+ // explicit and the reason is worth stating: an unvalidated redirect URI
871
+ // is exactly what an attacker supplies, so bouncing an error to it would
872
+ // make this endpoint an open redirector.
873
+ if (client === undefined) {
874
+ send(res, 400, { error: 'invalid_client', error_description: 'Unknown client_id.' }, requestId);
875
+ return;
876
+ }
877
+ if (!redirectAllowed(redirectUri, client.redirectUris)) {
878
+ send(res, 400, { error: 'invalid_redirect_uri', error_description: 'redirect_uri does not match a registered value.' }, requestId);
879
+ return;
880
+ }
881
+ const challenge = q.get('code_challenge') ?? '';
882
+ const method = q.get('code_challenge_method') ?? '';
883
+ const back = (error, description) => {
884
+ const to = new URL(redirectUri);
885
+ to.searchParams.set('error', error);
886
+ to.searchParams.set('error_description', description);
887
+ const state = q.get('state');
888
+ if (state !== null)
889
+ to.searchParams.set('state', state);
890
+ res.writeHead(302, { location: to.toString() });
891
+ res.end();
892
+ };
893
+ if (q.get('response_type') !== 'code') {
894
+ back('unsupported_response_type', 'Only the authorization code flow is supported.');
895
+ return;
896
+ }
897
+ // S256 only. `plain` is in RFC 7636 and defeats it — the verifier travels
898
+ // in the clear, so anybody holding the code holds the challenge too.
899
+ if (method !== 'S256' || challenge === '') {
900
+ back('invalid_request', 'PKCE with code_challenge_method=S256 is required.');
901
+ return;
902
+ }
903
+ // Straight to the consent screen. `consentRedirect` carries the rule that
904
+ // the fragment is a route and the request is appended to it — see the
905
+ // note there for what assigning it outright did.
906
+ res.writeHead(302, { location: consentRedirect(oauth.consentUrl, q) });
907
+ res.end();
908
+ return;
909
+ }
910
+ // The exchange. A code, a verifier, and the redirect URI it was issued for.
911
+ if (instance === TOKEN_PATH) {
912
+ if (req.method !== 'POST') {
913
+ const problem = notFound(instance, requestId);
914
+ send(res, problem.status, problem.toJSON(), requestId);
915
+ return;
916
+ }
917
+ // `application/x-www-form-urlencoded` is what RFC 6749 specifies and what
918
+ // every client sends; JSON is accepted too because some send that and
919
+ // refusing it would be a conformance point nobody benefits from.
920
+ let form;
921
+ try {
922
+ const raw = await readRawBody(req);
923
+ form =
924
+ (req.headers['content-type'] ?? '').includes('json')
925
+ ? (JSON.parse(raw) ?? {})
926
+ : Object.fromEntries(new URLSearchParams(raw));
927
+ }
928
+ catch {
929
+ send(res, 400, { error: 'invalid_request', error_description: 'The request body could not be read.' }, requestId);
930
+ return;
931
+ }
932
+ const fail = (error, description) => {
933
+ send(res, 400, { error, error_description: description }, requestId);
934
+ };
935
+ // The refresh grant, which is what makes a connection endable. An access
936
+ // token is a JWT verified against a key, so nothing can take one back
937
+ // before it expires; the refresh token is stored, and revoking the
938
+ // connection deletes it. The access token then outlives a revocation by
939
+ // at most its own TTL, which is bounded and stated rather than forever.
940
+ if (form.grant_type === 'refresh_token') {
941
+ const presented = typeof form.refresh_token === 'string' ? form.refresh_token : '';
942
+ if (presented === '') {
943
+ fail('invalid_request', "'refresh_token' is required.");
944
+ return;
945
+ }
946
+ const rotated = await oauth.refreshTokens.rotate(presented);
947
+ if (rotated === undefined) {
948
+ // One answer for expired, revoked, unknown and replayed. A client can
949
+ // act on exactly one thing — start the flow again — and telling them
950
+ // apart would say whether a token ever existed.
951
+ fail('invalid_grant', 'The refresh token is unknown, expired, already used, or the connection was ended.');
952
+ return;
953
+ }
954
+ const next = generateCode();
955
+ await oauth.refreshTokens.issue(rotated.orgId, rotated.consentId, next, rotated.family, new Date(Date.now() + oauth.refreshTtlSeconds * 1000));
956
+ const issued = await oauth.mint(rotated);
957
+ send(res, 200, {
958
+ access_token: issued.accessToken,
959
+ token_type: 'Bearer',
960
+ expires_in: issued.expiresIn,
961
+ refresh_token: next,
962
+ }, requestId, { 'cache-control': 'no-store', pragma: 'no-cache' });
963
+ return;
964
+ }
965
+ if (form.grant_type !== 'authorization_code') {
966
+ fail('unsupported_grant_type', 'Only authorization_code and refresh_token are supported.');
967
+ return;
968
+ }
969
+ const code = typeof form.code === 'string' ? form.code : '';
970
+ const verifier = typeof form.code_verifier === 'string' ? form.code_verifier : '';
971
+ if (code === '' || verifier === '') {
972
+ fail('invalid_request', "'code' and 'code_verifier' are required.");
973
+ return;
974
+ }
975
+ // Consumed here whether or not the checks below pass, and deliberately:
976
+ // a code presented with a wrong verifier is a code that has been in the
977
+ // wrong hands, and the safe response is to spend it.
978
+ const approved = await oauth.authorizations.redeem(code);
979
+ if (approved === undefined) {
980
+ fail('invalid_grant', 'The code is unknown, expired, or already used.');
981
+ return;
982
+ }
983
+ if (!verifierMatches(verifier, approved.codeChallenge)) {
984
+ fail('invalid_grant', 'The code_verifier does not match the challenge.');
985
+ return;
986
+ }
987
+ if (typeof form.client_id === 'string' && form.client_id !== approved.clientId) {
988
+ fail('invalid_grant', 'The code was issued to another client.');
989
+ return;
990
+ }
991
+ if (typeof form.redirect_uri === 'string' && form.redirect_uri !== approved.redirectUri) {
992
+ fail('invalid_grant', 'The redirect_uri does not match the one the code was issued for.');
993
+ return;
994
+ }
995
+ const token = await oauth.mint(approved);
996
+ // A refresh token, hung on the standing connection. Without one the
997
+ // client's access simply stops at the TTL and it has to send somebody
998
+ // back through consent — and, more to the point, there would be nothing
999
+ // to revoke when they end the connection.
1000
+ //
1001
+ // Absent for a code from before consents existed: those rows carry no
1002
+ // connection, and issuing a refresh token against nothing would create
1003
+ // access with no record and no way to end it.
1004
+ let refresh;
1005
+ if (approved.consentId !== undefined) {
1006
+ refresh = generateCode();
1007
+ await oauth.refreshTokens.issue(approved.orgId, approved.consentId, refresh, undefined, new Date(Date.now() + oauth.refreshTtlSeconds * 1000));
1008
+ }
1009
+ // `no-store`, which RFC 6749 requires of this response and which matters
1010
+ // more here than usual: the body is a bearer token and a caching proxy
1011
+ // that keeps it hands it to whoever asks next.
1012
+ send(res, 200, {
1013
+ access_token: token.accessToken,
1014
+ token_type: 'Bearer',
1015
+ expires_in: token.expiresIn,
1016
+ ...(refresh === undefined ? {} : { refresh_token: refresh }),
1017
+ }, requestId, { 'cache-control': 'no-store', pragma: 'no-cache' });
1018
+ return;
1019
+ }
1020
+ }
763
1021
  if (!instance.startsWith('/v1/')) {
764
1022
  const problem = notFound(instance, requestId);
765
1023
  send(res, problem.status, problem.toJSON(), requestId);
@@ -1343,6 +1601,47 @@ async function handle(req, res, options) {
1343
1601
  }, requestId);
1344
1602
  return;
1345
1603
  }
1604
+ /**
1605
+ * Who the caller is — and nothing about anyone else.
1606
+ *
1607
+ * There was no way to ask. The admin UI signed in, got a pair of tokens,
1608
+ * and had no idea whether the person holding them was an `org_admin` or a
1609
+ * `member` — so it drew every screen and every button for everybody. A
1610
+ * member then pressed "New user" and got a `404`, because invariant 4 makes
1611
+ * a refusal indistinguishable from a missing object. That is right for the
1612
+ * API and unusable as a product: to the person it reads as a broken
1613
+ * application rather than as a permission they do not hold.
1614
+ *
1615
+ * Telling a caller their own role is not a leak and is not in tension with
1616
+ * invariant 4. Rule 4 is about *objects* being invisible; this discloses
1617
+ * nothing except what the presented token already asserts, which the caller
1618
+ * necessarily has. Nothing here can name another principal.
1619
+ *
1620
+ * A service account gets an answer too, which the "sign in as an agent to
1621
+ * see what it sees" flow needs: the UI accepts a `nacre_sk_` key and could
1622
+ * not previously say which account it belonged to.
1623
+ */
1624
+ if (instance === '/v1/me') {
1625
+ // 404 for another method, the same as every other path here: invariant 4
1626
+ // reserves the distinction for objects, and a 405 on a path that answers
1627
+ // one verb tells a caller nothing they can act on.
1628
+ if (req.method !== 'GET') {
1629
+ const problem = notFound(instance, requestId);
1630
+ send(res, problem.status, problem.toJSON(), requestId);
1631
+ return;
1632
+ }
1633
+ // Composed from the token and nothing else — no query, so this cannot
1634
+ // grow a way to name somebody else. `organization` is included because a
1635
+ // UI showing "you are an administrator" has to say of what, and it is the
1636
+ // same value invariant 1 already took from the token.
1637
+ send(res, 200, {
1638
+ organization: auth.orgId,
1639
+ principal_type: auth.principal.type,
1640
+ principal_id: auth.principal.id,
1641
+ role: auth.role,
1642
+ }, requestId);
1643
+ return;
1644
+ }
1346
1645
  if (instance === '/v1/workspaces' && options.workspaces !== undefined) {
1347
1646
  if (req.method === 'GET') {
1348
1647
  const page = readPage(url.searchParams, instance, requestId);
@@ -1924,6 +2223,183 @@ async function handle(req, res, options) {
1924
2223
  res.end(format === 'ndjson' ? toNdjson(items) : toCsv(items));
1925
2224
  return;
1926
2225
  }
2226
+ /**
2227
+ * The one point in the OAuth flow where authority is created.
2228
+ *
2229
+ * Everything before it — registration, the authorize redirect — is a
2230
+ * conversation with an unauthenticated caller and grants nothing. This is
2231
+ * inside the authenticated surface because it has to be: a signed-in person
2232
+ * is choosing which **agent** the client will act as.
2233
+ *
2234
+ * The token that comes out acts as that service account and never as the
2235
+ * person. That is the design and not an implementation detail: an agent
2236
+ * holding your authority answers "what may this agent read" with "whatever
2237
+ * you may read", which is the question the whole permission model exists to
2238
+ * ask separately.
2239
+ *
2240
+ * The service account must already exist and the caller must be able to see
2241
+ * it. Creating one, and granting it anything, goes through the endpoints
2242
+ * that already exist and already check — this deliberately adds no second
2243
+ * path to either, because a second path is how the guarded one gets walked
2244
+ * around.
2245
+ */
2246
+ /**
2247
+ * The connections this caller may see, and ending one.
2248
+ *
2249
+ * "Forget this application" is the whole point, and it is why 0024 exists:
2250
+ * before it there was a record of an authorization *code* — ninety seconds
2251
+ * long and consumed — and nothing of the connection that outlived it. So
2252
+ * nothing could list what was connected, and nothing could stop it.
2253
+ *
2254
+ * Ending one deletes its refresh tokens in the same transaction. The access
2255
+ * token already issued is a JWT verified against a key, so it keeps working
2256
+ * until it expires — at most `NACRE_ACCESS_TOKEN_TTL`. That window is real
2257
+ * and is stated in the response rather than papered over: the alternative
2258
+ * is a denylist consulted on every request, which would make local
2259
+ * verification not local.
2260
+ */
2261
+ if (instance === '/v1/oauth/consents' && options.oauth !== undefined) {
2262
+ if (req.method !== 'GET') {
2263
+ const problem = notFound(instance, requestId);
2264
+ send(res, problem.status, problem.toJSON(), requestId);
2265
+ return;
2266
+ }
2267
+ const items = await options.oauth.consents.list(auth);
2268
+ send(res, 200, {
2269
+ items: items.map((c) => ({
2270
+ id: c.id,
2271
+ client_id: c.clientId,
2272
+ client_name: c.clientName,
2273
+ service_account_id: c.serviceAccountId,
2274
+ service_account_name: c.serviceAccountName,
2275
+ approved_by: c.approvedBy,
2276
+ created_at: c.createdAt,
2277
+ last_refreshed_at: c.lastRefreshedAt,
2278
+ revoked_at: c.revokedAt,
2279
+ })),
2280
+ // Not a field a caller has to compute from configuration they cannot
2281
+ // see. It is how long an already-issued access token can still work
2282
+ // after a connection is ended, and a screen that says "ended" without
2283
+ // it would be overstating what just happened.
2284
+ access_token_ttl_seconds: options.oauth.accessTtlSeconds,
2285
+ }, requestId);
2286
+ return;
2287
+ }
2288
+ if (instance.startsWith('/v1/oauth/consents/') && options.oauth !== undefined) {
2289
+ const id = instance.slice('/v1/oauth/consents/'.length);
2290
+ if (req.method !== 'DELETE') {
2291
+ const problem = notFound(instance, requestId);
2292
+ send(res, problem.status, problem.toJSON(), requestId);
2293
+ return;
2294
+ }
2295
+ const ended = await options.oauth.consents.revoke(auth, id);
2296
+ if (!ended) {
2297
+ // One they cannot see, one that does not exist, and one already ended
2298
+ // are the same answer.
2299
+ const problem = notFound(instance, requestId);
2300
+ send(res, problem.status, problem.toJSON(), requestId);
2301
+ return;
2302
+ }
2303
+ await options.audit?.write({
2304
+ orgId: auth.orgId,
2305
+ actor: `${auth.principal.type}:${auth.principal.id}`,
2306
+ action: 'oauth.revoke',
2307
+ result: 'allow',
2308
+ detail: { consent_id: id },
2309
+ requestId,
2310
+ });
2311
+ send(res, 200, { ended: true, access_token_ttl_seconds: options.oauth.accessTtlSeconds }, requestId);
2312
+ return;
2313
+ }
2314
+ if (instance === '/v1/oauth/consent' && options.oauth !== undefined) {
2315
+ if (req.method !== 'POST') {
2316
+ const problem = notFound(instance, requestId);
2317
+ send(res, problem.status, problem.toJSON(), requestId);
2318
+ return;
2319
+ }
2320
+ // A service account cannot consent on behalf of anybody: the flow exists
2321
+ // so a *person* decides what an agent gets, and an agent approving its
2322
+ // own successor is that decision made by the thing it is about.
2323
+ if (auth.principal.type !== 'user') {
2324
+ const problem = notFound(instance, requestId);
2325
+ send(res, problem.status, problem.toJSON(), requestId);
2326
+ return;
2327
+ }
2328
+ const consent = (body ?? {});
2329
+ const need = (field) => typeof consent[field] === 'string' && consent[field] !== '' ? consent[field] : undefined;
2330
+ const clientId = need('client_id');
2331
+ const redirectUri = need('redirect_uri');
2332
+ const codeChallenge = need('code_challenge');
2333
+ const serviceAccountId = need('service_account_id');
2334
+ if (clientId === undefined || redirectUri === undefined || codeChallenge === undefined || serviceAccountId === undefined) {
2335
+ const problem = badRequest(instance, requestId, "'client_id', 'redirect_uri', 'code_challenge' and 'service_account_id' are required.");
2336
+ send(res, problem.status, problem.toJSON(), requestId);
2337
+ return;
2338
+ }
2339
+ // Re-checked here rather than trusted from the browser. Everything in
2340
+ // this body came back through a redirect the caller controls, so the
2341
+ // client and its redirect URI are verified against the registration
2342
+ // again — the authorize endpoint's check protected the redirect, and this
2343
+ // one protects the code.
2344
+ const client = await options.oauth.clients.find(clientId);
2345
+ if (client === undefined || !redirectAllowed(redirectUri, client.redirectUris)) {
2346
+ const problem = badRequest(instance, requestId, 'Unknown client, or a redirect_uri it did not register.');
2347
+ send(res, problem.status, problem.toJSON(), requestId);
2348
+ return;
2349
+ }
2350
+ // The agent has to be one this caller can see, which is what makes the
2351
+ // consent theirs to give. `404` for anything else, because an agent they
2352
+ // cannot see and one that does not exist are the same answer here as
2353
+ // everywhere.
2354
+ const visible = options.serviceAccounts === undefined
2355
+ ? undefined
2356
+ : (await options.serviceAccounts.list(auth, { limit: 200, after: undefined })).items.find((a) => a.id === serviceAccountId);
2357
+ if (visible === undefined) {
2358
+ const problem = notFound(instance, requestId);
2359
+ send(res, problem.status, problem.toJSON(), requestId);
2360
+ return;
2361
+ }
2362
+ // The standing connection first, then the code that points at it. That
2363
+ // order matters: the code is exchanged for a refresh token hung on the
2364
+ // connection, and a code with no connection would mint access nobody can
2365
+ // ever take back — which is the gap this closes.
2366
+ const consentId = await options.oauth.consents.record(auth, clientId, serviceAccountId);
2367
+ const code = generateCode();
2368
+ await options.oauth.authorizations.approve(auth, {
2369
+ orgId: auth.orgId,
2370
+ serviceAccountId,
2371
+ clientId,
2372
+ redirectUri,
2373
+ codeChallenge,
2374
+ ...(need('resource') === undefined ? {} : { resource: need('resource') }),
2375
+ code,
2376
+ consentId,
2377
+ expiresAt: new Date(Date.now() + CODE_TTL_MS),
2378
+ });
2379
+ // Recorded, because "why does this agent hold a token" is a question an
2380
+ // administrator will ask and the grant table cannot answer: the grants
2381
+ // were there before, and what changed is that a client was handed the
2382
+ // right to act as this principal.
2383
+ await options.audit?.write({
2384
+ orgId: auth.orgId,
2385
+ actor: `${auth.principal.type}:${auth.principal.id}`,
2386
+ action: 'oauth.consent',
2387
+ result: 'allow',
2388
+ detail: { client_id: clientId, client_name: client.clientName, service_account_id: serviceAccountId },
2389
+ requestId,
2390
+ });
2391
+ // The redirect is returned rather than performed: this is an API call
2392
+ // from a page, and the page is what navigates. `state` is echoed
2393
+ // untouched — it is the client's, it is opaque to us, and it is how the
2394
+ // client ties the response back to the request it started.
2395
+ const to = new URL(redirectUri);
2396
+ to.searchParams.set('code', code);
2397
+ const state = need('state');
2398
+ if (state !== undefined)
2399
+ to.searchParams.set('state', state);
2400
+ send(res, 200, { redirect_to: to.toString() }, requestId);
2401
+ return;
2402
+ }
1927
2403
  if (instance === '/v1/service-accounts' && options.serviceAccounts !== undefined) {
1928
2404
  // org_admin, not "admin on some scope". A service account is a principal
1929
2405
  // in the organization rather than an object inside a workspace, and there