camstack 1.2.33 → 1.2.34

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/cli.js CHANGED
@@ -38,7 +38,7 @@ async function runServe(args) {
38
38
  ...typeof values.data === "string" ? { data: values.data } : {}
39
39
  };
40
40
  Object.assign(process.env, buildServeEnv(opts));
41
- await import("./launcher-LXP37XH2.js");
41
+ await import("./launcher-CSBOA3IK.js");
42
42
  }
43
43
 
44
44
  // src/commands/agent.ts
@@ -83,7 +83,7 @@ async function runAgent(args) {
83
83
  ...typeof values.port === "string" ? { port: values.port } : {}
84
84
  };
85
85
  Object.assign(process.env, buildAgentEnv(opts));
86
- await import("./launcher-LXP37XH2.js");
86
+ await import("./launcher-CSBOA3IK.js");
87
87
  }
88
88
 
89
89
  // src/commands/setup.ts
@@ -396909,7 +396909,7 @@ var require_trpc_context = __commonJS({
396909
396909
  }
396910
396910
  return null;
396911
396911
  }
396912
- async function resolveUser(token2, authService, addonRegistry, shareTokens = null) {
396912
+ async function resolveUser(token2, authService, addonRegistry, shareTokens = null, logger = null) {
396913
396913
  if (!token2)
396914
396914
  return null;
396915
396915
  if (token2.startsWith(share_token_service_js_1.SHARE_TOKEN_PREFIX)) {
@@ -396971,8 +396971,14 @@ var require_trpc_context = __commonJS({
396971
396971
  if (typeof payload.isAdmin !== "boolean") {
396972
396972
  return null;
396973
396973
  }
396974
- const credential = (0, trpc_error_principal_js_1.readCredentialIdentity)(payload);
396975
396974
  const principal = (0, types_1.classifyBearerPrincipal)(payload);
396975
+ if (principal.kind === "not-a-credential") {
396976
+ logger?.warn("trpc: refused a bearer that is not an API credential", {
396977
+ meta: { reason: principal.reason, userId: payload.userId ?? payload.keyId ?? "unknown" }
396978
+ });
396979
+ return null;
396980
+ }
396981
+ const credential = (0, trpc_error_principal_js_1.readCredentialIdentity)(payload);
396976
396982
  return {
396977
396983
  id: payload.userId ?? payload.keyId ?? "unknown",
396978
396984
  username: payload.username ?? "unknown",
@@ -397035,19 +397041,19 @@ var require_trpc_context = __commonJS({
397035
397041
  };
397036
397042
  return { user };
397037
397043
  }
397038
- async function createTrpcContext(req, authService, addonRegistry, shareTokens = null) {
397044
+ async function createTrpcContext(req, authService, addonRegistry, shareTokens = null, logger = null) {
397039
397045
  const token2 = extractTokenFromRequest(req);
397040
397046
  return {
397041
- user: await resolveUser(token2, authService, addonRegistry, shareTokens),
397047
+ user: await resolveUser(token2, authService, addonRegistry, shareTokens, logger),
397042
397048
  req,
397043
397049
  deviceScopeLookup: makeDeviceScopeLookup(addonRegistry),
397044
397050
  deviceFleet: () => addonRegistry.getPersistedDeviceList()
397045
397051
  };
397046
397052
  }
397047
- async function createWsTrpcContext(opts, authService, addonRegistry, shareTokens = null) {
397053
+ async function createWsTrpcContext(opts, authService, addonRegistry, shareTokens = null, logger = null) {
397048
397054
  const paramToken = opts.info.connectionParams?.["token"];
397049
397055
  const token2 = (typeof paramToken === "string" ? paramToken : null) ?? extractTokenFromRequest(opts.req);
397050
- const user = await resolveUser(token2, authService, addonRegistry, shareTokens);
397056
+ const user = await resolveUser(token2, authService, addonRegistry, shareTokens, logger);
397051
397057
  return {
397052
397058
  user,
397053
397059
  req: opts.req,
@@ -408917,7 +408923,16 @@ var require_main4 = __commonJS({
408917
408923
  prefix: "/trpc",
408918
408924
  trpcOptions: {
408919
408925
  router: appRouter,
408920
- createContext: ({ req }) => (0, trpc_context_1.createTrpcContext)(req, authService, addonRegistry, shareTokenService),
408926
+ createContext: ({ req }) => (0, trpc_context_1.createTrpcContext)(
408927
+ req,
408928
+ authService,
408929
+ addonRegistry,
408930
+ shareTokenService,
408931
+ // A bearer refused for NOT being an API credential never reaches a
408932
+ // procedure, so `onError` below never sees it — the refusal would
408933
+ // be silent without this. Same reason `gateAddonJwt` logs (D103).
408934
+ app.get(logging_service_1.LoggingService).createLogger("tRPC")
408935
+ ),
408921
408936
  onError: ({ path: trpcPath, error, ctx }) => {
408922
408937
  const trpcLogger = app.get(logging_service_1.LoggingService).createLogger("tRPC");
408923
408938
  trpcLogger.warn("tRPC error", {
@@ -409311,7 +409326,7 @@ var require_main4 = __commonJS({
409311
409326
  (0, ws_1.applyWSSHandler)({
409312
409327
  wss,
409313
409328
  router: appRouter,
409314
- createContext: (opts) => (0, trpc_context_1.createWsTrpcContext)(opts, authService, addonRegistry, shareTokenService),
409329
+ createContext: (opts) => (0, trpc_context_1.createWsTrpcContext)(opts, authService, addonRegistry, shareTokenService, app.get(logging_service_1.LoggingService).createLogger("tRPC:ws")),
409315
409330
  onError: ({ path: trpcPath, error, ctx }) => {
409316
409331
  const trpcLogger = app.get(logging_service_1.LoggingService).createLogger("tRPC:ws");
409317
409332
  trpcLogger.warn("tRPC error", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstack",
3
- "version": "1.2.33",
3
+ "version": "1.2.34",
4
4
  "description": "CLI tool for managing and running CamStack server",
5
5
  "keywords": [
6
6
  "camstack",