@pikku/inspector 0.12.88 → 0.12.89

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/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## 0.12.89
2
+
3
+ ### Patch Changes
4
+
5
+ - bc488cf: fix(inspector): an explicit `auth: false` declares an exposed sessionless function public, so PKU574 no longer warns about it
6
+
7
+ A genuinely public endpoint — a published programme, a health check — had no
8
+ honest way to quiet PKU574: the only options were an always-true permission or
9
+ `permissionsInBody: true`, both of which claim a gate that does not exist. The
10
+ inspector now records `auth` on function meta exactly as written instead of
11
+ dropping `false`, and the check treats an explicit `auth: false` as the author
12
+ declaring the function public on purpose. A sessionless function that leaves
13
+ `auth` out still warns.
14
+
15
+ - Updated dependencies [50b59a3]
16
+ - Updated dependencies [2b946e9]
17
+ - Updated dependencies [bc488cf]
18
+ - @pikku/core@0.12.123
19
+
1
20
  ## 0.12.88
2
21
 
3
22
  ### Patch Changes
@@ -397,10 +397,11 @@ export const addFunctions = (logger, node, checker, state, options) => {
397
397
  let remote;
398
398
  let mcp;
399
399
  /**
400
- * A sessionless function's own `auth: true`. `sessionless` records the
401
- * baseline — a `pikkuFunc` always needs a session — while this records the
402
- * tightening a `pikkuSessionlessFunc` applies to itself, which is otherwise
403
- * invisible to anything reading meta.
400
+ * A sessionless function's own `auth`, exactly as written. `sessionless`
401
+ * records the baseline — a `pikkuFunc` always needs a session — while this
402
+ * records what a `pikkuSessionlessFunc` says about itself: `true` tightens it
403
+ * to require a session, `false` declares it public on purpose. Both are
404
+ * otherwise invisible to anything reading meta; left out, it stays undefined.
404
405
  */
405
406
  let auth;
406
407
  /** The author's claim that the body authorizes its own callers. */
@@ -998,7 +999,7 @@ export const addFunctions = (logger, node, checker, state, options) => {
998
999
  inputs: inputNames.filter((n) => n !== 'void') ?? null,
999
1000
  outputs: outputNames.filter((n) => n !== 'void') ?? null,
1000
1001
  expose: expose || undefined,
1001
- auth: auth || undefined,
1002
+ auth: typeof auth === 'boolean' ? auth : undefined,
1002
1003
  permissionsInBody: permissionsInBody || undefined,
1003
1004
  audit,
1004
1005
  remote: remote || undefined,
@@ -64,8 +64,9 @@ export function validateExposedFunctionsGated(logger, state) {
64
64
  (rest > 0 ? `, and ${rest} more` : '') +
65
65
  `. Add permissions to the function, set \`auth: true\` if a session is ` +
66
66
  `required after all, gate the whole addon with ` +
67
- `wireAddon({ auth: true }), or drop \`expose: true\` if ` +
68
- `${one ? 'it was' : 'they were'} not meant to be callable from outside.`,
67
+ `wireAddon({ auth: true }), drop \`expose: true\` if ` +
68
+ `${one ? 'it was' : 'they were'} not meant to be callable from outside, ` +
69
+ `or set \`auth: false\` to declare ${one ? 'it' : 'them'} public on purpose.`,
69
70
  });
70
71
  }
71
72
  const gatesItself = (meta) =>
@@ -79,6 +80,11 @@ meta.sessionless === false ||
79
80
  // and a warning that is usually wrong stops being read.
80
81
  meta.permissionsInBody === true ||
81
82
  meta.auth === true ||
83
+ // The author wrote `auth: false` on a sessionless function: public on
84
+ // purpose — a health check, a sign-up, a published catalogue. A declaration,
85
+ // like `permissionsInBody`, so the default-open function nobody thought
86
+ // about still warns and the one somebody decided about does not.
87
+ meta.auth === false ||
82
88
  (meta.scopes?.length ?? 0) > 0 ||
83
89
  (meta.permissions?.length ?? 0) > 0;
84
90
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/inspector",
3
- "version": "0.12.88",
3
+ "version": "0.12.89",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pikkujs/pikku.git",
@@ -55,10 +55,10 @@
55
55
  "zod-to-ts": "^2.1.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@pikku/core": "^0.12.121"
58
+ "@pikku/core": "^0.12.123"
59
59
  },
60
60
  "devDependencies": {
61
- "@pikku/core": "^0.12.121",
61
+ "@pikku/core": "^0.12.123",
62
62
  "@types/node": "^24.13.3"
63
63
  },
64
64
  "engines": {