@hazem3500/palette 0.9.110 → 0.9.111

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/setup.js CHANGED
@@ -1 +1 @@
1
- import{a as n,d as o}from"./chunk-U55ASP2Y.js";import"./chunk-KLPQTFVH.js";import"./chunk-RBHY7UDS.js";import"./chunk-LMXFSXO6.js";import"./chunk-DU7H4TEX.js";import"./chunk-5HZI7HRR.js";import"./chunk-2BS2OWWH.js";import"./chunk-J47R52WX.js";import"./chunk-VX6XCU4E.js";import"./chunk-4HBBEVFK.js";function r(r){return(t={})=>o(n({...r,...t}))}var t=r;export{t as defineKomo,r as definePalette};
1
+ import{a as n,d as o}from"./chunk-DDYHX4RZ.js";import"./chunk-KLPQTFVH.js";import"./chunk-RBHY7UDS.js";import"./chunk-LMXFSXO6.js";import"./chunk-DU7H4TEX.js";import"./chunk-5HZI7HRR.js";import"./chunk-2BS2OWWH.js";import"./chunk-J47R52WX.js";import"./chunk-VX6XCU4E.js";import"./chunk-4HBBEVFK.js";function r(r){return(t={})=>o(n({...r,...t}))}var t=r;export{t as defineKomo,r as definePalette};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hazem3500/palette",
3
- "version": "0.9.110",
3
+ "version": "0.9.111",
4
4
  "description": "Point, area, and threaded comments for website branches.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/server/index.ts CHANGED
@@ -286,12 +286,10 @@ async function authenticate(
286
286
  .get("Authorization")
287
287
  ?.match(/^Bearer (.{1,200})$/)?.[1];
288
288
  check(bearer, 401, "Enter your name to comment.");
289
- const { proxy, sessionMaxAge, allowGuests } = authOptions(env);
289
+ const { proxy, proxyAccessTokens, sessionMaxAge, allowGuests } = authOptions(env);
290
290
  if (isPersonalToken(bearer)) {
291
- // A token would outlive the proxy's own sign-in checks; agents exchange
292
- // their proxy identity for a session instead.
293
291
  check(
294
- !proxy,
292
+ !proxy || proxyAccessTokens,
295
293
  403,
296
294
  "Access tokens are off behind the sign-in proxy. Use /auth/proxy/session."
297
295
  );
@@ -1055,7 +1053,7 @@ async function route(
1055
1053
  }
1056
1054
  if (accountRoute) {
1057
1055
  check(
1058
- !auth.proxy,
1056
+ !auth.proxy || auth.proxyAccessTokens,
1059
1057
  403,
1060
1058
  "Access tokens are off behind the sign-in proxy. Use /auth/proxy/session."
1061
1059
  );
@@ -1072,6 +1070,7 @@ async function route(
1072
1070
  tokens: await listTokens(env, user.id),
1073
1071
  projects: await accountProjects(env, user.id),
1074
1072
  scopes: PAT_SCOPES,
1073
+ ...(auth.proxy ? { policy: { explicitProjects: true, maxLifetimeDays: 365 } } : {}),
1075
1074
  });
1076
1075
  if (url.pathname === "/account/tokens" && request.method === "POST") {
1077
1076
  await limit(env, `pat:create:${user.id}`, 10, 3600);
@@ -1147,9 +1146,7 @@ async function route(
1147
1146
  !(await privateAccess(env, project)),
1148
1147
  private: await privateAccess(env, project),
1149
1148
  guestResolve: config.allowGuestResolve !== false,
1150
- // Signed-in Google accounts can manage personal access tokens here,
1151
- // except behind a sign-in proxy.
1152
- tokens: !auth.proxy,
1149
+ tokens: !auth.proxy || auth.proxyAccessTokens,
1153
1150
  // Element snapshots are opt-in on the client; guests need project consent.
1154
1151
  snapshots: {
1155
1152
  guests: auth.allowGuests && config.allowGuestSnapshots === true,
@@ -27,6 +27,7 @@ export type AuthOptions = {
27
27
  signInPrefix: string;
28
28
  requireSessionForReads: boolean;
29
29
  allowGuests: boolean;
30
+ proxyAccessTokens: boolean;
30
31
  /** Session lifetime cap in milliseconds; undefined keeps the default. */
31
32
  sessionMaxAge?: number;
32
33
  };
@@ -95,6 +96,7 @@ function resolve(env: OptionEnv): AuthOptions {
95
96
  const allowGuests = flag(env, "PALETTE_ALLOW_GUESTS", true);
96
97
  return {
97
98
  proxy,
99
+ proxyAccessTokens: flag(env, "PALETTE_PROXY_ACCESS_TOKENS", false),
98
100
  signInPrefix,
99
101
  requireSessionForReads: !!proxy || requireSessionForReads,
100
102
  allowGuests: !proxy && allowGuests,
@@ -20,6 +20,8 @@ export interface ServerEnv {
20
20
  PALETTE_PAUSED?: string;
21
21
  /** Trusted identity proxy that signs reviewers in, e.g. "gcp-iap". Off unless set. */
22
22
  PALETTE_PROXY_AUTH?: string;
23
+ /** Explicitly allow bounded, project-scoped access tokens behind a proxy. */
24
+ PALETTE_PROXY_ACCESS_TOKENS?: string;
23
25
  /** The audience the proxy signs its assertions for. */
24
26
  PALETTE_PROXY_AUDIENCE?: string;
25
27
  /** Older name: setting it alone turns on "gcp-iap" with this audience. */
@@ -53,6 +55,8 @@ export interface ServerEnv {
53
55
  KOMO_PAUSED?: string;
54
56
  /** @deprecated Read when PALETTE_PROXY_AUTH is unset. */
55
57
  KOMO_PROXY_AUTH?: string;
58
+ /** @deprecated Read when PALETTE_PROXY_ACCESS_TOKENS is unset. */
59
+ KOMO_PROXY_ACCESS_TOKENS?: string;
56
60
  /** @deprecated Read when PALETTE_PROXY_AUDIENCE is unset. */
57
61
  KOMO_PROXY_AUDIENCE?: string;
58
62
  /** @deprecated Read when PALETTE_IAP_AUDIENCE is unset. */