@framers/agentos 0.12.22 → 0.12.23

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.
@@ -9,7 +9,11 @@
9
9
  * The host application forwards the request to {@link handleIncomingWebhook},
10
10
  * which verifies Plivo's inbound-message signature before emitting. Inbound
11
11
  * messaging is signed under `X-Plivo-Signature-MA-V3`; the plain V3 and the
12
- * V2 family are accepted as well.
12
+ * V2 family are accepted as well. Each callback is accepted once: the nonce
13
+ * of an accepted callback is remembered and a request that reuses it is
14
+ * dropped. A V2 signature covers the URL and the nonce, not the body, so it
15
+ * does not authenticate `From` or `Text` (see
16
+ * {@link PlivoSmsChannelAdapter.handleIncomingWebhook}).
13
17
  *
14
18
  * The adapter does NOT start its own HTTP server; the host wires a route
15
19
  * (Express/Fastify/etc.) that forwards inbound requests here — the same
@@ -54,19 +58,30 @@ export declare class PlivoSmsChannelAdapter extends BaseChannelAdapter<PlivoSmsA
54
58
  private phoneNumber;
55
59
  /** Externally-visible message URL Plivo signs, for inbound verification. */
56
60
  private webhookUrl;
57
- /** When true (default), inbound webhooks must carry a valid V3 signature. */
61
+ /** When true (default), inbound webhooks must carry a valid Plivo signature. */
58
62
  private verifySignatureEnabled;
59
63
  /** Pre-computed `Authorization: Basic ...` header value. */
60
64
  private authHeader;
61
65
  /** Fetch implementation (injectable for tests). */
62
66
  private readonly fetchImpl;
67
+ /**
68
+ * Nonces of the callbacks accepted so far, so a request that reuses one is
69
+ * refused. Kept across reconnects.
70
+ */
71
+ private readonly seenNonces;
63
72
  /**
64
73
  * @param opts.fetchImpl - Override the global fetch (inject a mock in tests).
65
74
  * @param opts.retryConfig - Connection retry tuning (see BaseChannelAdapter).
75
+ * @param opts.nonceTtlMs - How long the nonce of an accepted callback is
76
+ * remembered, in milliseconds. Default: 24 hours.
77
+ * @param opts.maxNonces - How many nonces are remembered at once; past it
78
+ * the oldest is forgotten first. Default: 10,000.
66
79
  */
67
80
  constructor(opts?: {
68
81
  fetchImpl?: typeof fetch;
69
82
  retryConfig?: Partial<RetryConfig>;
83
+ nonceTtlMs?: number;
84
+ maxNonces?: number;
70
85
  });
71
86
  protected doConnect(auth: ChannelAuthConfig & {
72
87
  params?: PlivoSmsAuthParams;
@@ -74,47 +89,97 @@ export declare class PlivoSmsChannelAdapter extends BaseChannelAdapter<PlivoSmsA
74
89
  protected doSendMessage(conversationId: string, content: MessageContent): Promise<ChannelSendResult>;
75
90
  protected doShutdown(): Promise<void>;
76
91
  /**
77
- * Handle an inbound Plivo SMS webhook. The host forwards Plivo's POST here.
92
+ * Handle an inbound Plivo SMS webhook. The host forwards Plivo's request here.
78
93
  *
79
94
  * When signature verification is enabled (the default), the request must
80
- * carry valid `X-Plivo-Signature-V3` / `-Nonce` headers and the URL Plivo
81
- * signed; otherwise the message is dropped (fail closed).
95
+ * carry a valid Plivo signature over the URL Plivo requested, and each
96
+ * callback is accepted once: a request whose nonce was already accepted is
97
+ * dropped. Anything else is dropped as well (fail closed).
98
+ *
99
+ * What a valid signature proves depends on its family:
82
100
  *
83
- * @param body - Parsed form/JSON body of Plivo's inbound-message POST.
84
- * @param meta - Request metadata needed to verify the V3 signature.
101
+ * - **V3** covers the URL, its query, the params and the nonce, so `From`,
102
+ * `Text` and `MessageUUID` are the ones Plivo sent.
103
+ * - **V2** covers the URL and the nonce only. It does not authenticate
104
+ * `From`, `Text` or `MessageUUID`: whoever holds one callback's signature
105
+ * and nonce can send them again over a different body. Plivo's messaging
106
+ * documentation describes V2 for message callbacks.
107
+ *
108
+ * The nonce memory narrows that replay; it does not end it. It holds the
109
+ * callbacks this process accepted, for `nonceTtlMs` (24 hours by default)
110
+ * and `maxNonces` of them at most, and a restart empties it. Plivo's
111
+ * signatures carry no timestamp, so a callback sent again after its nonce is
112
+ * forgotten, or one this process never accepted, is accepted. Do not let an
113
+ * inbound message authorize an action by its sender number alone.
114
+ *
115
+ * @param body - Parsed form body of Plivo's inbound-message POST. For a GET
116
+ * callback the params are read from the query string of `meta.url`, whose
117
+ * values win over `body`.
118
+ * @param meta - Request metadata needed to verify the signature.
85
119
  */
86
120
  handleIncomingWebhook(body: Record<string, unknown>, meta?: {
87
121
  method?: string;
88
- /** The exact externally-visible URL Plivo POSTed to (must byte-match). */
122
+ /**
123
+ * The exact externally-visible URL Plivo requested (must byte-match);
124
+ * for a GET callback, with its query string.
125
+ */
89
126
  url?: string;
90
127
  headers?: Record<string, string | string[] | undefined>;
91
128
  }): void;
92
129
  /**
93
- * Verify an inbound request genuinely came from Plivo.
130
+ * Verify an inbound request's signature and return the nonces it proved, or
131
+ * `undefined` when no signature decides in its favour.
94
132
  *
95
133
  * Plivo sends more than one signature header and the one that matches depends
96
134
  * on the channel. Inbound messaging (SMS) is signed under
97
135
  * `X-Plivo-Signature-MA-V3`, while voice callbacks use the plain
98
136
  * `X-Plivo-Signature-V3`; Plivo's public docs also still document the older V2
99
- * scheme (`X-Plivo-Signature-MA-V2` / `X-Plivo-Signature-V2`). To be robust we
100
- * accept the request if ANY family validates: the V3 family (body params folded
101
- * into the signed string, keyed on `X-Plivo-Signature-V3-Nonce`) or the V2
102
- * family (URL + nonce only, keyed on `X-Plivo-Signature-V2-Nonce`). Every
103
- * candidate must still match cryptographically, so accepting several families
104
- * cannot produce a false accept.
137
+ * scheme (`X-Plivo-Signature-MA-V2` / `X-Plivo-Signature-V2`). Both families
138
+ * are accepted, and they do not prove the same thing:
139
+ *
140
+ * - The V3 family signs the URL, its query, the params and the V3 nonce
141
+ * (`X-Plivo-Signature-V3-Nonce`). A match covers the whole request.
142
+ * - The V2 family signs the URL and the V2 nonce
143
+ * (`X-Plivo-Signature-V2-Nonce`) and nothing else. A match shows that Plivo
144
+ * signed this URL with this nonce once; the body under it can be anything.
145
+ * Accepting V2 is accepting that weaker proof: a V2 signature and nonce
146
+ * taken from one callback verify over a forged `From` and `Text`.
105
147
  *
106
- * Fails closed: missing URL/token, or no family matches → not from Plivo.
148
+ * So V3 decides whenever the request carries a V3 header: a V3 signature
149
+ * that does not match is refused even if a V2 signature beside it matches.
150
+ * V2 decides only for a request with no V3 header. Nothing here stops a
151
+ * sender from leaving the V3 headers out; what limits a V2 replay is that
152
+ * {@link claimNonces} accepts a nonce once, which is why a request verified
153
+ * by V3 also returns its V2 nonce when its V2 signature is valid.
154
+ *
155
+ * Fails closed: missing URL/token, or the deciding family does not match →
156
+ * `undefined`.
157
+ */
158
+ private verifiedNonces;
159
+ /**
160
+ * Record the nonces of a verified callback as used.
161
+ *
162
+ * @returns `false`, recording nothing, when any of them was used already.
107
163
  */
108
- private isFromPlivo;
164
+ private claimNonces;
109
165
  }
110
166
  /**
111
- * Compute Plivo's X-Plivo-Signature-V3 for a callback, matching the algorithm
112
- * in `plivo-python`'s `signature_v3.py`.
167
+ * Compute Plivo's V3 signature for a callback as `plivo-python`'s
168
+ * `signature_v3.py` does: `base64(HMAC_SHA256(authToken, signedString))`,
169
+ * where the signed string ends in `.` + nonce.
170
+ *
171
+ * With `base` = `{scheme}://{host}{path}`, `query` = the URL's query as `k=v`
172
+ * pairs joined by `&` (names sorted, a repeated name's values sorted) and
173
+ * `fields` = the params as `key`+`value` with no separators (keys sorted):
174
+ *
175
+ * - **POST with params**: `base` + `?` + `query` + (`.` if there is a query)
176
+ * + `fields`.
177
+ * - **POST with no params**: `base`, then `?` + `query` if there is a query.
178
+ * - **GET**: the params are part of the query. Those passed in `params` are
179
+ * merged into the URL's own (the URL's value wins on a shared name), and the
180
+ * signed string is `base`, then `?` + the merged `query` if there is one.
113
181
  *
114
- * For a POST callback the signed string is:
115
- * `{scheme}://{host}{path}?` + (query as sorted `k=v&…` + `.` if present)
116
- * + sorted, separator-less `key`+`value` body params + `.` + nonce
117
- * then `base64(HMAC_SHA256(authToken, signedString))`.
182
+ * Any method other than GET is signed as a POST, as in the reference.
118
183
  */
119
184
  export declare function computePlivoV3Signature(input: {
120
185
  method: string;
@@ -1 +1 @@
1
- {"version":3,"file":"PlivoSmsChannelAdapter.d.ts","sourceRoot":"","s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,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
@@ -9,7 +9,11 @@
9
9
  * The host application forwards the request to {@link handleIncomingWebhook},
10
10
  * which verifies Plivo's inbound-message signature before emitting. Inbound
11
11
  * messaging is signed under `X-Plivo-Signature-MA-V3`; the plain V3 and the
12
- * V2 family are accepted as well.
12
+ * V2 family are accepted as well. Each callback is accepted once: the nonce
13
+ * of an accepted callback is remembered and a request that reuses it is
14
+ * dropped. A V2 signature covers the URL and the nonce, not the body, so it
15
+ * does not authenticate `From` or `Text` (see
16
+ * {@link PlivoSmsChannelAdapter.handleIncomingWebhook}).
13
17
  *
14
18
  * The adapter does NOT start its own HTTP server; the host wires a route
15
19
  * (Express/Fastify/etc.) that forwards inbound requests here — the same
@@ -48,15 +52,20 @@ export class PlivoSmsChannelAdapter extends BaseChannelAdapter {
48
52
  /**
49
53
  * @param opts.fetchImpl - Override the global fetch (inject a mock in tests).
50
54
  * @param opts.retryConfig - Connection retry tuning (see BaseChannelAdapter).
55
+ * @param opts.nonceTtlMs - How long the nonce of an accepted callback is
56
+ * remembered, in milliseconds. Default: 24 hours.
57
+ * @param opts.maxNonces - How many nonces are remembered at once; past it
58
+ * the oldest is forgotten first. Default: 10,000.
51
59
  */
52
60
  constructor(opts) {
53
61
  super(opts?.retryConfig);
54
62
  this.platform = 'plivo';
55
63
  this.displayName = 'Plivo SMS';
56
64
  this.capabilities = ['text'];
57
- /** When true (default), inbound webhooks must carry a valid V3 signature. */
65
+ /** When true (default), inbound webhooks must carry a valid Plivo signature. */
58
66
  this.verifySignatureEnabled = true;
59
67
  this.fetchImpl = opts?.fetchImpl ?? globalThis.fetch;
68
+ this.seenNonces = new SeenNonces(atLeastOneOr(opts?.nonceTtlMs, DEFAULT_NONCE_TTL_MS), atLeastOneOr(opts?.maxNonces, DEFAULT_MAX_NONCES));
60
69
  }
61
70
  // ── Abstract hook implementations ──
62
71
  async doConnect(auth) {
@@ -150,27 +159,59 @@ export class PlivoSmsChannelAdapter extends BaseChannelAdapter {
150
159
  }
151
160
  // ── Public: inbound webhook ──
152
161
  /**
153
- * Handle an inbound Plivo SMS webhook. The host forwards Plivo's POST here.
162
+ * Handle an inbound Plivo SMS webhook. The host forwards Plivo's request here.
154
163
  *
155
164
  * When signature verification is enabled (the default), the request must
156
- * carry valid `X-Plivo-Signature-V3` / `-Nonce` headers and the URL Plivo
157
- * signed; otherwise the message is dropped (fail closed).
165
+ * carry a valid Plivo signature over the URL Plivo requested, and each
166
+ * callback is accepted once: a request whose nonce was already accepted is
167
+ * dropped. Anything else is dropped as well (fail closed).
158
168
  *
159
- * @param body - Parsed form/JSON body of Plivo's inbound-message POST.
160
- * @param meta - Request metadata needed to verify the V3 signature.
169
+ * What a valid signature proves depends on its family:
170
+ *
171
+ * - **V3** covers the URL, its query, the params and the nonce, so `From`,
172
+ * `Text` and `MessageUUID` are the ones Plivo sent.
173
+ * - **V2** covers the URL and the nonce only. It does not authenticate
174
+ * `From`, `Text` or `MessageUUID`: whoever holds one callback's signature
175
+ * and nonce can send them again over a different body. Plivo's messaging
176
+ * documentation describes V2 for message callbacks.
177
+ *
178
+ * The nonce memory narrows that replay; it does not end it. It holds the
179
+ * callbacks this process accepted, for `nonceTtlMs` (24 hours by default)
180
+ * and `maxNonces` of them at most, and a restart empties it. Plivo's
181
+ * signatures carry no timestamp, so a callback sent again after its nonce is
182
+ * forgotten, or one this process never accepted, is accepted. Do not let an
183
+ * inbound message authorize an action by its sender number alone.
184
+ *
185
+ * @param body - Parsed form body of Plivo's inbound-message POST. For a GET
186
+ * callback the params are read from the query string of `meta.url`, whose
187
+ * values win over `body`.
188
+ * @param meta - Request metadata needed to verify the signature.
161
189
  */
162
190
  handleIncomingWebhook(body, meta) {
163
191
  if (this.status !== 'connected') {
164
192
  console.warn('[Plivo SMS] Dropping inbound webhook — adapter not connected.');
165
193
  return;
166
194
  }
167
- if (this.verifySignatureEnabled && !this.isFromPlivo(body, meta)) {
168
- console.warn('[Plivo SMS] Dropping inbound webhook — signature missing or invalid.');
169
- return;
195
+ const method = (meta?.method ?? 'POST').toUpperCase();
196
+ const url = meta?.url ?? this.webhookUrl;
197
+ // A GET callback carries its params in the query string, and that is the
198
+ // part a V3 signature covers. Reading them from the URL, over `body`,
199
+ // keeps a field the signature does not cover out of the event.
200
+ const fields = method === 'GET' && url ? { ...body, ...queryFields(url) } : body;
201
+ if (this.verifySignatureEnabled) {
202
+ const nonces = this.verifiedNonces(fields, { method, url, headers: meta?.headers ?? {} });
203
+ if (!nonces) {
204
+ console.warn('[Plivo SMS] Dropping inbound webhook — signature missing or invalid.');
205
+ return;
206
+ }
207
+ if (!this.claimNonces(nonces)) {
208
+ console.warn('[Plivo SMS] Dropping inbound webhook — its nonce was already used.');
209
+ return;
210
+ }
170
211
  }
171
- const from = String(body.From ?? '');
172
- const text = String(body.Text ?? '');
173
- const messageUuid = String(body.MessageUUID ?? '');
212
+ const from = String(fields.From ?? '');
213
+ const text = String(fields.Text ?? '');
214
+ const messageUuid = String(fields.MessageUUID ?? '');
174
215
  if (!from || !messageUuid) {
175
216
  console.warn('[Plivo SMS] Dropping inbound webhook — missing From or MessageUUID.');
176
217
  return;
@@ -184,7 +225,7 @@ export class PlivoSmsChannelAdapter extends BaseChannelAdapter {
184
225
  content: [{ type: 'text', text }],
185
226
  text,
186
227
  timestamp: new Date().toISOString(),
187
- rawEvent: body,
228
+ rawEvent: fields,
188
229
  };
189
230
  this.emit({
190
231
  type: 'message',
@@ -196,102 +237,143 @@ export class PlivoSmsChannelAdapter extends BaseChannelAdapter {
196
237
  }
197
238
  // ── Private: signature verification ──
198
239
  /**
199
- * Verify an inbound request genuinely came from Plivo.
240
+ * Verify an inbound request's signature and return the nonces it proved, or
241
+ * `undefined` when no signature decides in its favour.
200
242
  *
201
243
  * Plivo sends more than one signature header and the one that matches depends
202
244
  * on the channel. Inbound messaging (SMS) is signed under
203
245
  * `X-Plivo-Signature-MA-V3`, while voice callbacks use the plain
204
246
  * `X-Plivo-Signature-V3`; Plivo's public docs also still document the older V2
205
- * scheme (`X-Plivo-Signature-MA-V2` / `X-Plivo-Signature-V2`). To be robust we
206
- * accept the request if ANY family validates: the V3 family (body params folded
207
- * into the signed string, keyed on `X-Plivo-Signature-V3-Nonce`) or the V2
208
- * family (URL + nonce only, keyed on `X-Plivo-Signature-V2-Nonce`). Every
209
- * candidate must still match cryptographically, so accepting several families
210
- * cannot produce a false accept.
247
+ * scheme (`X-Plivo-Signature-MA-V2` / `X-Plivo-Signature-V2`). Both families
248
+ * are accepted, and they do not prove the same thing:
249
+ *
250
+ * - The V3 family signs the URL, its query, the params and the V3 nonce
251
+ * (`X-Plivo-Signature-V3-Nonce`). A match covers the whole request.
252
+ * - The V2 family signs the URL and the V2 nonce
253
+ * (`X-Plivo-Signature-V2-Nonce`) and nothing else. A match shows that Plivo
254
+ * signed this URL with this nonce once; the body under it can be anything.
255
+ * Accepting V2 is accepting that weaker proof: a V2 signature and nonce
256
+ * taken from one callback verify over a forged `From` and `Text`.
257
+ *
258
+ * So V3 decides whenever the request carries a V3 header: a V3 signature
259
+ * that does not match is refused even if a V2 signature beside it matches.
260
+ * V2 decides only for a request with no V3 header. Nothing here stops a
261
+ * sender from leaving the V3 headers out; what limits a V2 replay is that
262
+ * {@link claimNonces} accepts a nonce once, which is why a request verified
263
+ * by V3 also returns its V2 nonce when its V2 signature is valid.
211
264
  *
212
- * Fails closed: missing URL/token, or no family matches → not from Plivo.
265
+ * Fails closed: missing URL/token, or the deciding family does not match →
266
+ * `undefined`.
213
267
  */
214
- isFromPlivo(body, meta) {
215
- const headers = meta?.headers ?? {};
216
- const url = meta?.url ?? this.webhookUrl;
217
- const method = (meta?.method ?? 'POST').toUpperCase();
268
+ verifiedNonces(fields, request) {
269
+ const { method, url, headers } = request;
270
+ const authToken = this.authToken;
218
271
  if (!url) {
219
272
  console.warn('[Plivo SMS] Cannot verify inbound webhook — no request URL available. ' +
220
273
  'Set params.webhookUrl (or pass meta.url) when signature verification is enabled.');
221
- return false;
274
+ return undefined;
222
275
  }
223
- if (!this.authToken)
224
- return false;
225
- // V3 family: MA-V3 for inbound messaging, plain V3 for voice. Params folded
226
- // into the signed string, keyed on the V3 nonce.
276
+ if (!authToken)
277
+ return undefined;
227
278
  const v3 = joinHeaders(headers, ['x-plivo-signature-ma-v3', 'x-plivo-signature-v3']);
228
279
  const v3Nonce = headerValue(headers, 'x-plivo-signature-v3-nonce');
229
- if (v3 && v3Nonce) {
230
- try {
231
- const expected = computePlivoV3Signature({
232
- method,
233
- url,
234
- nonce: v3Nonce,
235
- authToken: this.authToken,
236
- params: body,
237
- });
238
- if (signatureMatches(v3, expected))
239
- return true;
240
- }
241
- catch {
242
- // malformed URL/input for V3 → fall through to the V2 family
243
- }
244
- }
245
- // V2 family: MA-V2 for messaging, plain V2 for voice. URL + nonce only (no
246
- // params), keyed on the V2 nonce.
247
280
  const v2 = joinHeaders(headers, ['x-plivo-signature-ma-v2', 'x-plivo-signature-v2']);
248
281
  const v2Nonce = headerValue(headers, 'x-plivo-signature-v2-nonce');
282
+ // V2 family: MA-V2 for messaging, plain V2 for voice. URL + nonce only (no
283
+ // params), keyed on the V2 nonce.
284
+ let v2Nonces = [];
249
285
  if (v2 && v2Nonce) {
250
286
  try {
251
- const expected = computePlivoV2Signature({ url, nonce: v2Nonce, authToken: this.authToken });
287
+ const expected = computePlivoV2Signature({ url, nonce: v2Nonce, authToken });
252
288
  if (signatureMatches(v2, expected))
253
- return true;
289
+ v2Nonces = [`v2:${v2Nonce}`];
254
290
  }
255
291
  catch {
256
- // malformed input → no family matched
292
+ // malformed URL → V2 does not match
257
293
  }
258
294
  }
259
- return false;
295
+ // No V3 header on the request: V2 decides.
296
+ if (!v3 && !v3Nonce)
297
+ return v2Nonces.length > 0 ? v2Nonces : undefined;
298
+ // V3 family: MA-V3 for inbound messaging, plain V3 for voice. Params folded
299
+ // into the signed string, keyed on the V3 nonce. V3 decides alone; a valid
300
+ // V2 signature only adds its nonce to the ones recorded.
301
+ if (!v3 || !v3Nonce)
302
+ return undefined;
303
+ try {
304
+ const expected = computePlivoV3Signature({
305
+ method,
306
+ url,
307
+ nonce: v3Nonce,
308
+ authToken,
309
+ params: fields,
310
+ });
311
+ if (signatureMatches(v3, expected))
312
+ return [`v3:${v3Nonce}`, ...v2Nonces];
313
+ }
314
+ catch {
315
+ // malformed URL/input → V3 does not match
316
+ }
317
+ return undefined;
318
+ }
319
+ /**
320
+ * Record the nonces of a verified callback as used.
321
+ *
322
+ * @returns `false`, recording nothing, when any of them was used already.
323
+ */
324
+ claimNonces(nonces) {
325
+ const now = Date.now();
326
+ if (nonces.some((nonce) => this.seenNonces.has(nonce, now)))
327
+ return false;
328
+ for (const nonce of nonces)
329
+ this.seenNonces.add(nonce, now);
330
+ return true;
260
331
  }
261
332
  }
262
333
  // ============================================================================
263
334
  // Signature helpers (exported for testing against the Plivo SDK golden fixture)
264
335
  // ============================================================================
265
336
  /**
266
- * Compute Plivo's X-Plivo-Signature-V3 for a callback, matching the algorithm
267
- * in `plivo-python`'s `signature_v3.py`.
337
+ * Compute Plivo's V3 signature for a callback as `plivo-python`'s
338
+ * `signature_v3.py` does: `base64(HMAC_SHA256(authToken, signedString))`,
339
+ * where the signed string ends in `.` + nonce.
340
+ *
341
+ * With `base` = `{scheme}://{host}{path}`, `query` = the URL's query as `k=v`
342
+ * pairs joined by `&` (names sorted, a repeated name's values sorted) and
343
+ * `fields` = the params as `key`+`value` with no separators (keys sorted):
268
344
  *
269
- * For a POST callback the signed string is:
270
- * `{scheme}://{host}{path}?` + (query as sorted `k=v&…` + `.` if present)
271
- * + sorted, separator-less `key`+`value` body params + `.` + nonce
272
- * then `base64(HMAC_SHA256(authToken, signedString))`.
345
+ * - **POST with params**: `base` + `?` + `query` + (`.` if there is a query)
346
+ * + `fields`.
347
+ * - **POST with no params**: `base`, then `?` + `query` if there is a query.
348
+ * - **GET**: the params are part of the query. Those passed in `params` are
349
+ * merged into the URL's own (the URL's value wins on a shared name), and the
350
+ * signed string is `base`, then `?` + the merged `query` if there is one.
351
+ *
352
+ * Any method other than GET is signed as a POST, as in the reference.
273
353
  */
274
354
  export function computePlivoV3Signature(input) {
275
355
  const { method, url, nonce, authToken, params } = input;
276
356
  const parsed = new URL(url);
277
- const base = `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
278
- const isPost = method.toUpperCase() === 'POST';
279
- let signed = base + '?';
280
- // If the URL carried a query string, append it as sorted k=v&k=v.
281
- if (parsed.search && parsed.search.length > 1) {
282
- signed += [...parsed.searchParams.entries()]
283
- .sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0))
284
- .map(([k, v]) => `${k}=${v}`)
285
- .join('&');
286
- if (isPost)
287
- signed += '.'; // separator between query and the POST params
357
+ const query = queryValues(parsed);
358
+ let signed = `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
359
+ if (method.toUpperCase() === 'GET') {
360
+ const merged = new Map(Object.entries(params));
361
+ for (const [name, values] of query)
362
+ merged.set(name, values);
363
+ const queryString = sortedQueryString(merged);
364
+ if (queryString)
365
+ signed += '?' + queryString;
288
366
  }
289
- // POST callbacks append sorted key+value body params, then '.' + nonce.
290
- // GET callbacks are signed over the query string alone (params ARE the query).
291
- if (isPost) {
292
- signed += sortedParamsString(params) + '.' + nonce;
367
+ else {
368
+ const queryString = sortedQueryString(query);
369
+ const hasParams = Object.keys(params).length > 0;
370
+ if (queryString || hasParams)
371
+ signed += '?' + queryString;
372
+ if (queryString && hasParams)
373
+ signed += '.'; // separator between query and params
374
+ signed += sortedParamsString(params);
293
375
  }
294
- return createHmac('sha256', authToken).update(signed).digest('base64');
376
+ return createHmac('sha256', authToken).update(`${signed}.${nonce}`).digest('base64');
295
377
  }
296
378
  /**
297
379
  * Compute Plivo's V2-family signature (`X-Plivo-Signature-MA-V2` for messaging,
@@ -305,6 +387,44 @@ export function computePlivoV2Signature(input) {
305
387
  const base = `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
306
388
  return createHmac('sha256', authToken).update(base + nonce).digest('base64');
307
389
  }
390
+ /** A URL's query values grouped by name, in the order they appear. */
391
+ function queryValues(parsed) {
392
+ const grouped = new Map();
393
+ for (const [name, value] of parsed.searchParams.entries()) {
394
+ const values = grouped.get(name);
395
+ if (values)
396
+ values.push(value);
397
+ else
398
+ grouped.set(name, [value]);
399
+ }
400
+ return grouped;
401
+ }
402
+ /**
403
+ * A URL's query fields by name: a string, or an array when the name repeats.
404
+ * Text that is not a URL has none (signature verification refuses it).
405
+ */
406
+ function queryFields(url) {
407
+ try {
408
+ return Object.fromEntries([...queryValues(new URL(url))].map(([name, values]) => [
409
+ name,
410
+ values.length === 1 ? values[0] : values,
411
+ ]));
412
+ }
413
+ catch {
414
+ return {};
415
+ }
416
+ }
417
+ /** `k=v` pairs joined by `&`: names sorted, a repeated name's values sorted. */
418
+ function sortedQueryString(fields) {
419
+ const pairs = [];
420
+ for (const name of [...fields.keys()].sort()) {
421
+ const value = fields.get(name);
422
+ const values = Array.isArray(value) ? value.map(String).sort() : [String(value)];
423
+ for (const item of values)
424
+ pairs.push(`${name}=${item}`);
425
+ }
426
+ return pairs.join('&');
427
+ }
308
428
  /** Sorted, separator-less `key`+`value` concatenation (recurses dicts, sorts lists). */
309
429
  function sortedParamsString(params) {
310
430
  let out = '';
@@ -351,4 +471,54 @@ function signatureMatches(candidates, expected) {
351
471
  return candBuf.length === expectedBuf.length && timingSafeEqual(candBuf, expectedBuf);
352
472
  });
353
473
  }
474
+ // ============================================================================
475
+ // Seen nonces
476
+ // ============================================================================
477
+ /** How long the nonce of an accepted callback is remembered by default: 24 hours. */
478
+ const DEFAULT_NONCE_TTL_MS = 24 * 60 * 60 * 1000;
479
+ /** How many nonces are remembered at once by default. */
480
+ const DEFAULT_MAX_NONCES = 10000;
481
+ /** `value` rounded down when it is a finite number of at least 1, else `fallback`. */
482
+ function atLeastOneOr(value, fallback) {
483
+ return typeof value === 'number' && Number.isFinite(value) && value >= 1
484
+ ? Math.floor(value)
485
+ : fallback;
486
+ }
487
+ /**
488
+ * The nonces of accepted callbacks, so a callback delivered again is refused.
489
+ *
490
+ * Held in memory, so a restart empties it, and bounded twice: a nonce is
491
+ * forgotten `ttlMs` after it was added, and once `maxEntries` are held the
492
+ * oldest is forgotten first. A forgotten nonce is accepted again, so this
493
+ * narrows replay to callbacks older than the window; Plivo's signatures carry
494
+ * no timestamp that would let an old callback be refused by its age.
495
+ */
496
+ class SeenNonces {
497
+ constructor(ttlMs, maxEntries) {
498
+ this.ttlMs = ttlMs;
499
+ this.maxEntries = maxEntries;
500
+ /** Nonce → when it expires (ms since the epoch). Insertion order is age order. */
501
+ this.expiresAt = new Map();
502
+ }
503
+ /** Whether `nonce` was added and has not expired at `now`. */
504
+ has(nonce, now) {
505
+ const expiry = this.expiresAt.get(nonce);
506
+ return expiry !== undefined && expiry > now;
507
+ }
508
+ /** Remember `nonce` from `now`, forgetting what expired and, past the cap, the oldest. */
509
+ add(nonce, now) {
510
+ // Every nonce has the same lifetime and they are added in time order, so
511
+ // the expired ones come first.
512
+ for (const [key, expiry] of this.expiresAt) {
513
+ if (expiry > now)
514
+ break;
515
+ this.expiresAt.delete(key);
516
+ }
517
+ this.expiresAt.delete(nonce);
518
+ this.expiresAt.set(nonce, now + this.ttlMs);
519
+ while (this.expiresAt.size > this.maxEntries) {
520
+ this.expiresAt.delete(this.expiresAt.keys().next().value);
521
+ }
522
+ }
523
+ }
354
524
  //# sourceMappingURL=PlivoSmsChannelAdapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlivoSmsChannelAdapter.js","sourceRoot":"","sources":["../../../../src/io/channels/adapters/PlivoSmsChannelAdapter.ts"],"names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SAAS,EAAE,CAAC;YAC3C,IAAI,MAAM,GAAG,GAAG;gBAAE,MAAM;YACxB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAC7C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAe,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@framers/agentos",
3
- "version": "0.12.22",
3
+ "version": "0.12.23",
4
4
  "description": "AgentOS: open-source TypeScript framework for autonomous AI agents. Unified graph orchestration, cognitive memory, runtime tool forging, multi-tier guardrails, voice pipeline, and 11 LLM providers.",
5
5
  "homepage": "https://agentos.sh",
6
6
  "repository": {