@tensile-tools/auth 0.3.0 → 0.4.1

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.
package/dist/core.d.ts CHANGED
@@ -6,7 +6,7 @@ import { serverURL } from './transport.ts';
6
6
  import { type HookAnswer, type WebhookEvent, type WebhookOptions } from './webhooks.ts';
7
7
  export type { Action, Agent, ApprovalCreated, CheckRequestInfo, CheckResult, Credential, Delegated, Meta, Principal, Session, User, WireNeed };
8
8
  /** The SDK's version, sent as `Tensile-Auth-SDK`. It is the version of the Go module, the image, and the browser client. */
9
- export declare const sdkVersion = "0.3.0";
9
+ export declare const sdkVersion = "0.4.1";
10
10
  /** The API version the SDK was written against. */
11
11
  export declare const apiVersion = "v1";
12
12
  /** The name of the session cookie. */
package/dist/core.js CHANGED
@@ -7,7 +7,7 @@ import { createProxy } from "./proxy.js";
7
7
  import { serverURL } from "./transport.js";
8
8
  import { answerHook, verifyWebhook } from "./webhooks.js";
9
9
  /** The SDK's version, sent as `Tensile-Auth-SDK`. It is the version of the Go module, the image, and the browser client. */
10
- export const sdkVersion = '0.3.0';
10
+ export const sdkVersion = '0.4.1';
11
11
  /** The API version the SDK was written against. */
12
12
  export const apiVersion = 'v1';
13
13
  /** The name of the session cookie. */
package/dist/rebuild.js CHANGED
@@ -44,5 +44,15 @@ export function methodOf(h) {
44
44
  export function rebuildRequest(h, appUrl) {
45
45
  const path = h.get(pathHeader);
46
46
  const origin = appUrl ?? `${h.get('x-forwarded-proto')?.split(',')[0] ?? 'http'}://${h.get('x-forwarded-host') ?? h.get('host')}`;
47
- return new Request(new URL(path?.startsWith('/') && !path.startsWith('//') ? path : '/', origin), { method: methodOf(h), headers: h });
47
+ return new Request(sameOriginURL(path, origin), { method: methodOf(h), headers: h });
48
+ }
49
+ // The URL of path on origin, or of "/" when path isn't a plain path on
50
+ // origin. URL parsing reads "\" as "/" and drops tabs and newlines, so
51
+ // "/\evil.example" would otherwise resolve to another host.
52
+ function sameOriginURL(path, origin) {
53
+ const base = new URL('/', origin);
54
+ if (!path?.startsWith('/') || /[\u0000-\u001f\u007f\\]/.test(path))
55
+ return base;
56
+ const u = new URL(path, base);
57
+ return u.origin === base.origin ? u : base;
48
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tensile-tools/auth",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Backend SDK for the tensile-auth server, like Better Auth but built for AI agents: check requests with one call, proxy the browser routes, verify webhooks, and act for a person, with adapters for Next.js, Express, and Hono.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -68,7 +68,7 @@
68
68
  "provenance": true
69
69
  },
70
70
  "peerDependencies": {
71
- "@tensile-tools/auth-client": "^0.3.0",
71
+ "@tensile-tools/auth-client": "^0.4.1",
72
72
  "express": "^5.0.0",
73
73
  "hono": "^4.0.0",
74
74
  "next": ">=16.0.0"