@atproto/pds 0.4.59 → 0.4.60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/api/app/bsky/actor/getProfile.d.ts.map +1 -1
  3. package/dist/api/app/bsky/actor/getProfile.js +2 -9
  4. package/dist/api/app/bsky/actor/getProfile.js.map +1 -1
  5. package/dist/api/app/bsky/actor/getProfiles.d.ts.map +1 -1
  6. package/dist/api/app/bsky/actor/getProfiles.js +2 -6
  7. package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
  8. package/dist/api/app/bsky/feed/getActorLikes.d.ts.map +1 -1
  9. package/dist/api/app/bsky/feed/getActorLikes.js +2 -9
  10. package/dist/api/app/bsky/feed/getActorLikes.js.map +1 -1
  11. package/dist/api/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
  12. package/dist/api/app/bsky/feed/getAuthorFeed.js +2 -9
  13. package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
  14. package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
  15. package/dist/api/app/bsky/feed/getFeed.js +2 -1
  16. package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
  17. package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
  18. package/dist/api/app/bsky/feed/getPostThread.js +12 -14
  19. package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
  20. package/dist/api/app/bsky/feed/getTimeline.d.ts.map +1 -1
  21. package/dist/api/app/bsky/feed/getTimeline.js +2 -6
  22. package/dist/api/app/bsky/feed/getTimeline.js.map +1 -1
  23. package/dist/api/com/atproto/repo/getRecord.js +1 -1
  24. package/dist/api/com/atproto/repo/getRecord.js.map +1 -1
  25. package/dist/api/com/atproto/server/requestPasswordReset.js +1 -1
  26. package/dist/api/com/atproto/server/requestPasswordReset.js.map +1 -1
  27. package/dist/config/config.d.ts +9 -0
  28. package/dist/config/config.d.ts.map +1 -1
  29. package/dist/config/config.js +10 -1
  30. package/dist/config/config.js.map +1 -1
  31. package/dist/config/env.d.ts +6 -1
  32. package/dist/config/env.d.ts.map +1 -1
  33. package/dist/config/env.js +8 -1
  34. package/dist/config/env.js.map +1 -1
  35. package/dist/context.d.ts +6 -2
  36. package/dist/context.d.ts.map +1 -1
  37. package/dist/context.js +55 -11
  38. package/dist/context.js.map +1 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/lexicon/lexicons.d.ts +33 -0
  43. package/dist/lexicon/lexicons.d.ts.map +1 -1
  44. package/dist/lexicon/lexicons.js +42 -3
  45. package/dist/lexicon/lexicons.js.map +1 -1
  46. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +2 -0
  47. package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
  48. package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
  49. package/dist/lexicon/types/app/bsky/actor/profile.d.ts +1 -0
  50. package/dist/lexicon/types/app/bsky/actor/profile.d.ts.map +1 -1
  51. package/dist/lexicon/types/app/bsky/actor/profile.js.map +1 -1
  52. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +13 -2
  53. package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
  54. package/dist/lexicon/types/app/bsky/feed/defs.js +21 -1
  55. package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
  56. package/dist/lexicon/types/app/bsky/feed/getAuthorFeed.d.ts +1 -0
  57. package/dist/lexicon/types/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
  58. package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +2 -0
  59. package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +1 -1
  60. package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts +2 -0
  61. package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts.map +1 -1
  62. package/dist/mailer/index.d.ts +1 -1
  63. package/dist/mailer/index.d.ts.map +1 -1
  64. package/dist/mailer/index.js.map +1 -1
  65. package/dist/mailer/templates/confirm-email.js +1 -1
  66. package/dist/mailer/templates/confirm-email.js.map +2 -2
  67. package/dist/mailer/templates/delete-account.js +1 -1
  68. package/dist/mailer/templates/delete-account.js.map +2 -2
  69. package/dist/mailer/templates/plc-operation.js +1 -1
  70. package/dist/mailer/templates/plc-operation.js.map +2 -2
  71. package/dist/mailer/templates/reset-password.js +1 -1
  72. package/dist/mailer/templates/reset-password.js.map +2 -2
  73. package/dist/mailer/templates/update-email.js +1 -1
  74. package/dist/mailer/templates/update-email.js.map +2 -2
  75. package/dist/pipethrough.d.ts +26 -26
  76. package/dist/pipethrough.d.ts.map +1 -1
  77. package/dist/pipethrough.js +328 -228
  78. package/dist/pipethrough.js.map +1 -1
  79. package/dist/read-after-write/util.d.ts +13 -5
  80. package/dist/read-after-write/util.d.ts.map +1 -1
  81. package/dist/read-after-write/util.js +37 -22
  82. package/dist/read-after-write/util.js.map +1 -1
  83. package/package.json +16 -15
  84. package/src/api/app/bsky/actor/getProfile.ts +3 -17
  85. package/src/api/app/bsky/actor/getProfiles.ts +3 -15
  86. package/src/api/app/bsky/feed/getActorLikes.ts +3 -19
  87. package/src/api/app/bsky/feed/getAuthorFeed.ts +3 -17
  88. package/src/api/app/bsky/feed/getFeed.ts +3 -1
  89. package/src/api/app/bsky/feed/getPostThread.ts +16 -23
  90. package/src/api/app/bsky/feed/getTimeline.ts +3 -14
  91. package/src/api/com/atproto/repo/getRecord.ts +1 -1
  92. package/src/api/com/atproto/server/requestPasswordReset.ts +1 -1
  93. package/src/config/config.ts +21 -1
  94. package/src/config/env.ts +20 -2
  95. package/src/context.ts +62 -17
  96. package/src/index.ts +1 -0
  97. package/src/lexicon/lexicons.ts +44 -3
  98. package/src/lexicon/types/app/bsky/actor/defs.ts +2 -0
  99. package/src/lexicon/types/app/bsky/actor/profile.ts +1 -0
  100. package/src/lexicon/types/app/bsky/feed/defs.ts +38 -2
  101. package/src/lexicon/types/app/bsky/feed/getAuthorFeed.ts +1 -0
  102. package/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts +2 -0
  103. package/src/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.ts +2 -0
  104. package/src/mailer/index.ts +1 -1
  105. package/src/mailer/templates/confirm-email.hbs +106 -336
  106. package/src/mailer/templates/delete-account.hbs +110 -346
  107. package/src/mailer/templates/plc-operation.hbs +107 -338
  108. package/src/mailer/templates/reset-password.d.ts +1 -1
  109. package/src/mailer/templates/reset-password.hbs +108 -344
  110. package/src/mailer/templates/update-email.hbs +107 -337
  111. package/src/pipethrough.ts +489 -233
  112. package/src/read-after-write/util.ts +58 -32
  113. package/tests/account-deletion.test.ts +1 -1
  114. package/tests/account.test.ts +2 -2
  115. package/tests/email-confirmation.test.ts +2 -2
  116. package/tests/plc-operations.test.ts +1 -1
  117. package/tests/proxied/proxy-catchall.test.ts +255 -0
  118. package/tests/proxied/proxy-header.test.ts +31 -1
@@ -1 +1 @@
1
- {"version":3,"file":"pipethrough.js","sourceRoot":"","sources":["../src/pipethrough.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAkC;AAClC,wDAA0B;AAC1B,8DAAgC;AAEhC,8CAAoE;AACpE,sDAK6B;AAC7B,wCAAuD;AACvD,4CAAqE;AACrE,iDAAkD;AAClD,qCAAqC;AAG9B,MAAM,YAAY,GAAG,CAAC,GAAe,EAAmB,EAAE;IAC/D,MAAM,cAAc,GAAG,GAAG,CAAC,YAAY,CAAC,cAAc,EAAE,CAAA;IACxD,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC9B,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,uBAAe,EAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YAC1D,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,EAAE,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@ -1,10 +1,18 @@
1
- import { Headers } from '@atproto/xrpc';
1
+ /// <reference types="node" />
2
+ import { HeadersMap } from '@atproto/xrpc';
3
+ import { HandlerPipeThrough } from '@atproto/xrpc-server';
4
+ import express from 'express';
2
5
  import AppContext from '../context';
3
6
  import { HandlerResponse, LocalRecords, MungeFn } from './types';
4
- import { HandlerPipeThrough } from '@atproto/xrpc-server';
5
- export declare const getRepoRev: (headers: Headers) => string | undefined;
7
+ export declare const getRepoRev: (headers: HeadersMap) => string | undefined;
6
8
  export declare const getLocalLag: (local: LocalRecords) => number | undefined;
7
- export declare const handleReadAfterWrite: <T>(ctx: AppContext, nsid: string, requester: string, res: HandlerPipeThrough, munge: MungeFn<T>) => Promise<HandlerResponse<T> | HandlerPipeThrough>;
8
- export declare const readAfterWriteInternal: <T>(ctx: AppContext, nsid: string, requester: string, res: HandlerPipeThrough, munge: MungeFn<T>) => Promise<HandlerResponse<T> | HandlerPipeThrough>;
9
+ export declare const pipethroughReadAfterWrite: <T>(ctx: AppContext, reqCtx: {
10
+ req: express.Request;
11
+ auth: {
12
+ credentials: {
13
+ did: string;
14
+ };
15
+ };
16
+ }, munge: MungeFn<T>) => Promise<HandlerResponse<T> | HandlerPipeThrough>;
9
17
  export declare const formatMungedResponse: <T>(body: T, lag?: number) => HandlerResponse<T>;
10
18
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/read-after-write/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAKzD,eAAO,MAAM,UAAU,YAAa,OAAO,KAAG,MAAM,GAAG,SAEtD,CAAA;AAED,eAAO,MAAM,W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,CASlB,CAAA"}
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatMungedResponse = exports.readAfterWriteInternal = exports.handleReadAfterWrite = exports.getLocalLag = exports.getRepoRev = void 0;
3
+ exports.formatMungedResponse = exports.pipethroughReadAfterWrite = exports.getLocalLag = exports.getRepoRev = void 0;
4
+ const lexicon_1 = require("@atproto/lexicon");
5
+ const xrpc_server_1 = require("@atproto/xrpc-server");
6
+ const lexicons_1 = require("../lexicon/lexicons");
4
7
  const logger_1 = require("../logger");
5
- const viewer_1 = require("./viewer");
6
8
  const pipethrough_1 = require("../pipethrough");
9
+ const viewer_1 = require("./viewer");
7
10
  const REPO_REV_HEADER = 'atproto-repo-rev';
8
11
  const getRepoRev = (headers) => {
9
12
  return headers[REPO_REV_HEADER];
@@ -21,32 +24,44 @@ const getLocalLag = (local) => {
21
24
  return Date.now() - new Date(oldest).getTime();
22
25
  };
23
26
  exports.getLocalLag = getLocalLag;
24
- const handleReadAfterWrite = async (ctx, nsid, requester, res, munge) => {
27
+ const pipethroughReadAfterWrite = async (ctx, reqCtx, munge) => {
28
+ const { req, auth } = reqCtx;
29
+ const requester = auth.credentials.did;
30
+ const streamRes = await (0, pipethrough_1.pipethrough)(ctx, req, { iss: requester });
31
+ const rev = (0, exports.getRepoRev)(streamRes.headers);
32
+ if (!rev)
33
+ return streamRes;
34
+ if ((0, pipethrough_1.isJsonContentType)(streamRes.headers['content-type']) === false) {
35
+ // content-type is present but not JSON, we can't munge this
36
+ return streamRes;
37
+ }
38
+ // if the munging fails, we can't return the original response because the
39
+ // stream will already have been read. If we end-up buffering the response,
40
+ // we'll return the buffered response in case of an error.
41
+ let bufferRes;
25
42
  try {
26
- return await (0, exports.readAfterWriteInternal)(ctx, nsid, requester, res, munge);
43
+ const lxm = (0, xrpc_server_1.parseReqNsid)(req);
44
+ return await ctx.actorStore.read(requester, async (store) => {
45
+ const local = await (0, viewer_1.getRecordsSinceRev)(store, rev);
46
+ if (local.count === 0)
47
+ return streamRes;
48
+ const { buffer } = (bufferRes = await (0, pipethrough_1.asPipeThroughBuffer)(streamRes));
49
+ const lex = (0, lexicon_1.jsonToLex)(JSON.parse(buffer.toString('utf8')));
50
+ const parsedRes = lexicons_1.lexicons.assertValidXrpcOutput(lxm, lex);
51
+ const localViewer = ctx.localViewer(store);
52
+ const data = await munge(localViewer, parsedRes, local, requester);
53
+ return (0, exports.formatMungedResponse)(data, (0, exports.getLocalLag)(local));
54
+ });
27
55
  }
28
56
  catch (err) {
57
+ // The error occurred while reading the stream, this is non-recoverable
58
+ if (!bufferRes && !streamRes.stream.readable)
59
+ throw err;
29
60
  logger_1.readStickyLogger.warn({ err, requester }, 'error in read after write munge');
30
- return res;
61
+ return bufferRes ?? streamRes;
31
62
  }
32
63
  };
33
- exports.handleReadAfterWrite = handleReadAfterWrite;
34
- const readAfterWriteInternal = async (ctx, nsid, requester, res, munge) => {
35
- const rev = (0, exports.getRepoRev)(res.headers ?? {});
36
- if (!rev)
37
- return res;
38
- return ctx.actorStore.read(requester, async (store) => {
39
- const local = await (0, viewer_1.getRecordsSinceRev)(store, rev);
40
- if (local.count === 0) {
41
- return res;
42
- }
43
- const localViewer = ctx.localViewer(store);
44
- const parsedRes = (0, pipethrough_1.parseRes)(nsid, res);
45
- const data = await munge(localViewer, parsedRes, local, requester);
46
- return (0, exports.formatMungedResponse)(data, (0, exports.getLocalLag)(local));
47
- });
48
- };
49
- exports.readAfterWriteInternal = readAfterWriteInternal;
64
+ exports.pipethroughReadAfterWrite = pipethroughReadAfterWrite;
50
65
  const formatMungedResponse = (body, lag) => ({
51
66
  encoding: 'application/json',
52
67
  body,
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/read-after-write/util.ts"],"names":[],"mappings":";;;AACA,sCAAmD;AAGnD,qCAA6C;AAE7C,gDAAyC;AAEzC,MAAM,eAAe,GAAG,kBAAkB,CAAA;AAEnC,MAAM,UAA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,IAAI,SAAS,CAAA;IAC/B,CAAC;AACH,CAAC,CAAA;AAhDY,QAAA,yBAAyB,6BAgDrC;AAEM,MAAM,oBAAoB,GAAG,CAClC,IAAO,EACP,GAAY,EACQ,EAAE,CAAC,CAAC;IACxB,QAAQ,EAAE,kBAAkB;IAC5B,IAAI;IACJ,OAAO,EACL,GAAG,KAAK,SAAS;QACf,CAAC,CAAC;YACE,sBAAsB,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;SACzC;QACH,CAAC,CAAC,SAAS;CAChB,CAAC,CAAA;AAZW,QAAA,oBAAoB,wBAY/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/pds",
3
- "version": "0.4.59",
3
+ "version": "0.4.60",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of atproto Personal Data Server (PDS)",
6
6
  "keywords": [
@@ -42,19 +42,20 @@
42
42
  "sharp": "^0.32.6",
43
43
  "typed-emitter": "^2.1.0",
44
44
  "uint8arrays": "3.0.0",
45
+ "undici": "^6.19.8",
45
46
  "zod": "^3.23.8",
46
- "@atproto-labs/fetch-node": "0.1.0",
47
- "@atproto/api": "^0.13.7",
48
- "@atproto/aws": "^0.2.5",
49
- "@atproto/common": "^0.4.2",
47
+ "@atproto/api": "^0.13.8",
48
+ "@atproto/aws": "^0.2.6",
49
+ "@atproto/common": "^0.4.3",
50
50
  "@atproto/crypto": "^0.4.1",
51
- "@atproto/identity": "^0.4.1",
52
- "@atproto/lexicon": "^0.4.1",
53
- "@atproto/oauth-provider": "^0.2.1",
54
- "@atproto/repo": "^0.5.1",
55
- "@atproto/syntax": "^0.3.0",
56
- "@atproto/xrpc": "^0.6.2",
57
- "@atproto/xrpc-server": "^0.6.4"
51
+ "@atproto/identity": "^0.4.2",
52
+ "@atproto-labs/fetch-node": "0.1.1",
53
+ "@atproto/lexicon": "^0.4.2",
54
+ "@atproto/oauth-provider": "^0.2.2",
55
+ "@atproto/repo": "^0.5.2",
56
+ "@atproto/xrpc": "^0.6.3",
57
+ "@atproto/xrpc-server": "^0.7.0",
58
+ "@atproto/syntax": "^0.3.0"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@atproto/pds-entryway": "npm:@atproto/pds@0.3.0-entryway.3",
@@ -72,9 +73,9 @@
72
73
  "jest": "^28.1.2",
73
74
  "ts-node": "^10.8.2",
74
75
  "ws": "^8.12.0",
75
- "@atproto/api": "^0.13.7",
76
- "@atproto/bsky": "^0.0.83",
77
- "@atproto/lex-cli": "^0.5.0"
76
+ "@atproto/api": "^0.13.8",
77
+ "@atproto/bsky": "^0.0.84",
78
+ "@atproto/lex-cli": "^0.5.1"
78
79
  },
79
80
  "scripts": {
80
81
  "codegen": "lex gen-server --yes ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/* ../../lexicons/tools/ozone/*/*",
@@ -4,30 +4,16 @@ import { OutputSchema } from '../../../../lexicon/types/app/bsky/actor/getProfil
4
4
  import {
5
5
  LocalViewer,
6
6
  LocalRecords,
7
- handleReadAfterWrite,
7
+ pipethroughReadAfterWrite,
8
8
  } from '../../../../read-after-write'
9
- import { pipethrough } from '../../../../pipethrough'
10
-
11
- const METHOD_NSID = 'app.bsky.actor.getProfile'
12
9
 
13
10
  export default function (server: Server, ctx: AppContext) {
14
11
  const { bskyAppView } = ctx.cfg
15
12
  if (!bskyAppView) return
16
13
  server.app.bsky.actor.getProfile({
17
14
  auth: ctx.authVerifier.accessStandard(),
18
- handler: async ({ req, auth }) => {
19
- const requester = auth.credentials.did
20
- const res = await pipethrough(ctx, req, requester)
21
- if (!requester) {
22
- return res
23
- }
24
- return handleReadAfterWrite(
25
- ctx,
26
- METHOD_NSID,
27
- requester,
28
- res,
29
- getProfileMunge,
30
- )
15
+ handler: async (reqCtx) => {
16
+ return pipethroughReadAfterWrite(ctx, reqCtx, getProfileMunge)
31
17
  },
32
18
  })
33
19
  }
@@ -1,31 +1,19 @@
1
1
  import AppContext from '../../../../context'
2
2
  import { Server } from '../../../../lexicon'
3
3
  import { OutputSchema } from '../../../../lexicon/types/app/bsky/actor/getProfiles'
4
- import { pipethrough } from '../../../../pipethrough'
5
4
  import {
6
5
  LocalViewer,
7
- handleReadAfterWrite,
6
+ pipethroughReadAfterWrite,
8
7
  LocalRecords,
9
8
  } from '../../../../read-after-write'
10
9
 
11
- const METHOD_NSID = 'app.bsky.actor.getProfiles'
12
-
13
10
  export default function (server: Server, ctx: AppContext) {
14
11
  const { bskyAppView } = ctx.cfg
15
12
  if (!bskyAppView) return
16
13
  server.app.bsky.actor.getProfiles({
17
14
  auth: ctx.authVerifier.accessStandard(),
18
- handler: async ({ req, auth }) => {
19
- const requester = auth.credentials.did
20
-
21
- const res = await pipethrough(ctx, req, requester)
22
- return handleReadAfterWrite(
23
- ctx,
24
- METHOD_NSID,
25
- requester,
26
- res,
27
- getProfilesMunge,
28
- )
15
+ handler: async (reqCtx) => {
16
+ return pipethroughReadAfterWrite(ctx, reqCtx, getProfilesMunge)
29
17
  },
30
18
  })
31
19
  }
@@ -3,33 +3,17 @@ import AppContext from '../../../../context'
3
3
  import { OutputSchema } from '../../../../lexicon/types/app/bsky/feed/getAuthorFeed'
4
4
  import {
5
5
  LocalViewer,
6
- handleReadAfterWrite,
6
+ pipethroughReadAfterWrite,
7
7
  LocalRecords,
8
8
  } from '../../../../read-after-write'
9
- import { pipethrough } from '../../../../pipethrough'
10
-
11
- const METHOD_NSID = 'app.bsky.feed.getActorLikes'
12
9
 
13
10
  export default function (server: Server, ctx: AppContext) {
14
11
  const { bskyAppView } = ctx.cfg
15
12
  if (!bskyAppView) return
16
13
  server.app.bsky.feed.getActorLikes({
17
14
  auth: ctx.authVerifier.accessStandard(),
18
- handler: async ({ req, auth }) => {
19
- const requester = auth.credentials.did
20
- const res = await pipethrough(ctx, req, requester)
21
-
22
- if (!requester) {
23
- return res
24
- }
25
-
26
- return await handleReadAfterWrite(
27
- ctx,
28
- METHOD_NSID,
29
- requester,
30
- res,
31
- getAuthorMunge,
32
- )
15
+ handler: async (reqCtx) => {
16
+ return pipethroughReadAfterWrite(ctx, reqCtx, getAuthorMunge)
33
17
  },
34
18
  })
35
19
  }
@@ -4,31 +4,17 @@ import { OutputSchema } from '../../../../lexicon/types/app/bsky/feed/getAuthorF
4
4
  import { isReasonRepost } from '../../../../lexicon/types/app/bsky/feed/defs'
5
5
  import {
6
6
  LocalViewer,
7
- handleReadAfterWrite,
7
+ pipethroughReadAfterWrite,
8
8
  LocalRecords,
9
9
  } from '../../../../read-after-write'
10
- import { pipethrough } from '../../../../pipethrough'
11
-
12
- const METHOD_NSID = 'app.bsky.feed.getAuthorFeed'
13
10
 
14
11
  export default function (server: Server, ctx: AppContext) {
15
12
  const { bskyAppView } = ctx.cfg
16
13
  if (!bskyAppView) return
17
14
  server.app.bsky.feed.getAuthorFeed({
18
15
  auth: ctx.authVerifier.accessStandard(),
19
- handler: async ({ req, auth }) => {
20
- const requester = auth.credentials.did
21
- const res = await pipethrough(ctx, req, requester)
22
- if (!requester) {
23
- return res
24
- }
25
- return await handleReadAfterWrite(
26
- ctx,
27
- METHOD_NSID,
28
- requester,
29
- res,
30
- getAuthorMunge,
31
- )
16
+ handler: async (reqCtx) => {
17
+ return pipethroughReadAfterWrite(ctx, reqCtx, getAuthorMunge)
32
18
  },
33
19
  })
34
20
  }
@@ -20,7 +20,9 @@ export default function (server: Server, ctx: AppContext) {
20
20
  ids.AppBskyFeedGetFeedGenerator,
21
21
  ),
22
22
  )
23
- return pipethrough(ctx, req, requester, {
23
+
24
+ return pipethrough(ctx, req, {
25
+ iss: requester,
24
26
  aud: feed.view.did,
25
27
  lxm: ids.AppBskyFeedGetFeedSkeleton,
26
28
  })
@@ -1,6 +1,7 @@
1
1
  import assert from 'node:assert'
2
2
  import { AtUri } from '@atproto/syntax'
3
- import { Headers, XRPCError } from '@atproto/xrpc'
3
+ import { XRPCError } from '@atproto/xrpc'
4
+
4
5
  import { Server } from '../../../../lexicon'
5
6
  import AppContext from '../../../../context'
6
7
  import {
@@ -18,35 +19,30 @@ import {
18
19
  getRepoRev,
19
20
  LocalRecords,
20
21
  RecordDescript,
21
- handleReadAfterWrite,
22
+ pipethroughReadAfterWrite,
22
23
  formatMungedResponse,
23
24
  } from '../../../../read-after-write'
24
- import { pipethrough } from '../../../../pipethrough'
25
25
  import { ids } from '../../../../lexicon/lexicons'
26
26
 
27
- const METHOD_NSID = 'app.bsky.feed.getPostThread'
28
-
29
27
  export default function (server: Server, ctx: AppContext) {
30
28
  const { bskyAppView } = ctx.cfg
31
29
  if (!bskyAppView) return
32
30
  server.app.bsky.feed.getPostThread({
33
31
  auth: ctx.authVerifier.accessStandard(),
34
- handler: async ({ req, auth, params }) => {
35
- const requester = auth.credentials.did
36
-
32
+ handler: async (reqCtx) => {
37
33
  try {
38
- const res = await pipethrough(ctx, req, requester)
39
-
40
- return await handleReadAfterWrite(
41
- ctx,
42
- METHOD_NSID,
43
- requester,
44
- res,
45
- getPostThreadMunge,
46
- )
34
+ return await pipethroughReadAfterWrite(ctx, reqCtx, getPostThreadMunge)
47
35
  } catch (err) {
48
36
  if (err instanceof XRPCError && err.error === 'NotFound') {
49
- const headers = err.headers
37
+ const { auth, params } = reqCtx
38
+ const requester = auth.credentials.did
39
+
40
+ const rev = err.headers && getRepoRev(err.headers)
41
+ if (!rev) throw err
42
+
43
+ const uri = new AtUri(params.uri)
44
+ if (uri.hostname !== requester) throw err
45
+
50
46
  const local = await ctx.actorStore.read(requester, (store) => {
51
47
  const localViewer = ctx.localViewer(store)
52
48
  return readAfterWriteNotFound(
@@ -54,7 +50,7 @@ export default function (server: Server, ctx: AppContext) {
54
50
  localViewer,
55
51
  params,
56
52
  requester,
57
- headers,
53
+ rev,
58
54
  )
59
55
  })
60
56
  if (local === null) {
@@ -168,11 +164,8 @@ const readAfterWriteNotFound = async (
168
164
  localViewer: LocalViewer,
169
165
  params: QueryParams,
170
166
  requester: string,
171
- headers?: Headers,
167
+ rev: string,
172
168
  ): Promise<{ data: OutputSchema; lag?: number } | null> => {
173
- if (!headers) return null
174
- const rev = getRepoRev(headers)
175
- if (!rev) return null
176
169
  const uri = new AtUri(params.uri)
177
170
  if (uri.hostname !== requester) {
178
171
  return null
@@ -3,28 +3,17 @@ import AppContext from '../../../../context'
3
3
  import { OutputSchema } from '../../../../lexicon/types/app/bsky/feed/getTimeline'
4
4
  import {
5
5
  LocalViewer,
6
- handleReadAfterWrite,
6
+ pipethroughReadAfterWrite,
7
7
  LocalRecords,
8
8
  } from '../../../../read-after-write'
9
- import { pipethrough } from '../../../../pipethrough'
10
-
11
- const METHOD_NSID = 'app.bsky.feed.getTimeline'
12
9
 
13
10
  export default function (server: Server, ctx: AppContext) {
14
11
  const { bskyAppView } = ctx.cfg
15
12
  if (!bskyAppView) return
16
13
  server.app.bsky.feed.getTimeline({
17
14
  auth: ctx.authVerifier.accessStandard(),
18
- handler: async ({ req, auth }) => {
19
- const requester = auth.credentials.did
20
- const res = await pipethrough(ctx, req, requester)
21
- return await handleReadAfterWrite(
22
- ctx,
23
- METHOD_NSID,
24
- requester,
25
- res,
26
- getTimelineMunge,
27
- )
15
+ handler: async (reqCtx) => {
16
+ return pipethroughReadAfterWrite(ctx, reqCtx, getTimelineMunge)
28
17
  },
29
18
  })
30
19
  }
@@ -32,6 +32,6 @@ export default function (server: Server, ctx: AppContext) {
32
32
  throw new InvalidRequestError(`Could not locate record`)
33
33
  }
34
34
 
35
- return await pipethrough(ctx, req, null)
35
+ return pipethrough(ctx, req)
36
36
  })
37
37
  }
@@ -40,7 +40,7 @@ export default function (server: Server, ctx: AppContext) {
40
40
  'reset_password',
41
41
  )
42
42
  await ctx.mailer.sendResetPassword(
43
- { identifier: account.handle ?? account.email, token },
43
+ { handle: account.handle ?? account.email, token },
44
44
  { to: account.email },
45
45
  )
46
46
  },
@@ -236,7 +236,16 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
236
236
  const crawlersCfg: ServerConfig['crawlers'] = env.crawlers ?? []
237
237
 
238
238
  const fetchCfg: ServerConfig['fetch'] = {
239
- disableSsrfProtection: env.fetchDisableSsrfProtection ?? false,
239
+ disableSsrfProtection: env.disableSsrfProtection ?? env.devMode ?? false,
240
+ maxResponseSize: env.fetchMaxResponseSize ?? 512 * 1024, // 512kb
241
+ }
242
+
243
+ const proxyCfg: ServerConfig['proxy'] = {
244
+ disableSsrfProtection: env.disableSsrfProtection ?? env.devMode ?? false,
245
+ allowHTTP2: env.proxyAllowHTTP2 ?? false,
246
+ headersTimeout: env.proxyHeadersTimeout ?? 10e3,
247
+ bodyTimeout: env.proxyBodyTimeout ?? 30e3,
248
+ maxResponseSize: env.proxyMaxResponseSize ?? 10 * 1024 * 1024, // 10mb
240
249
  }
241
250
 
242
251
  const oauthCfg: ServerConfig['oauth'] = entrywayCfg
@@ -302,6 +311,7 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
302
311
  rateLimits: rateLimitsCfg,
303
312
  crawlers: crawlersCfg,
304
313
  fetch: fetchCfg,
314
+ proxy: proxyCfg,
305
315
  oauth: oauthCfg,
306
316
  }
307
317
  }
@@ -324,6 +334,7 @@ export type ServerConfig = {
324
334
  rateLimits: RateLimitsConfig
325
335
  crawlers: string[]
326
336
  fetch: FetchConfig
337
+ proxy: ProxyConfig
327
338
  oauth: OAuthConfig
328
339
  }
329
340
 
@@ -393,6 +404,15 @@ export type EntrywayConfig = {
393
404
 
394
405
  export type FetchConfig = {
395
406
  disableSsrfProtection: boolean
407
+ maxResponseSize: number
408
+ }
409
+
410
+ export type ProxyConfig = {
411
+ disableSsrfProtection: boolean
412
+ allowHTTP2: boolean
413
+ headersTimeout: number
414
+ bodyTimeout: number
415
+ maxResponseSize: number
396
416
  }
397
417
 
398
418
  export type OAuthConfig = {
package/src/config/env.ts CHANGED
@@ -117,8 +117,17 @@ export const readEnv = (): ServerEnvironment => {
117
117
  'PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX',
118
118
  ),
119
119
 
120
+ // user provided url http requests
121
+ disableSsrfProtection: envBool('PDS_DISABLE_SSRF_PROTECTION'),
122
+
120
123
  // fetch
121
- fetchDisableSsrfProtection: envBool('PDS_DISABLE_SSRF_PROTECTION'),
124
+ fetchMaxResponseSize: envInt('PDS_FETCH_MAX_RESPONSE_SIZE'),
125
+
126
+ // proxy
127
+ proxyAllowHTTP2: envBool('PDS_PROXY_ALLOW_HTTP2'),
128
+ proxyHeadersTimeout: envInt('PDS_PROXY_HEADERS_TIMEOUT'),
129
+ proxyBodyTimeout: envInt('PDS_PROXY_BODY_TIMEOUT'),
130
+ proxyMaxResponseSize: envInt('PDS_PROXY_MAX_RESPONSE_SIZE'),
122
131
  }
123
132
  }
124
133
 
@@ -233,6 +242,15 @@ export type ServerEnvironment = {
233
242
  plcRotationKeyKmsKeyId?: string
234
243
  plcRotationKeyK256PrivateKeyHex?: string
235
244
 
245
+ // user provided url http requests
246
+ disableSsrfProtection?: boolean
247
+
236
248
  // fetch
237
- fetchDisableSsrfProtection?: boolean
249
+ fetchMaxResponseSize?: number
250
+
251
+ // proxy
252
+ proxyAllowHTTP2?: boolean
253
+ proxyHeadersTimeout?: number
254
+ proxyBodyTimeout?: number
255
+ proxyMaxResponseSize?: number
238
256
  }