@sasjs/api 0.48.0 → 0.48.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/README.md CHANGED
@@ -124,6 +124,12 @@ Refreshing the API surface: regenerate `api/public/swagger.yaml` in `sasjs/serve
124
124
 
125
125
  Re-vendoring is a two-repository change and the server half merges first: the document is only true once the controllers it is generated from answer what it states, so a copy taken from an unmerged server branch describes a server that does not exist yet. Take the copy from a released tag of `sasjs/server` rather than from its `main`, and the document and the code a host runs cannot disagree.
126
126
 
127
+ ### Dependency audit
128
+
129
+ `npm run audit:gate` uses `@sasjs/release` to judge the full tree, including development dependencies, from **info** upwards. This deliberately tightens the old low floor: even an unwaived info finding fails. Whenever a waiver exists the gate also audits production at info; production findings cannot be waived. This preserves the old dev-only rule even if a waived source appears in production at info. CI retains the separate production `npm audit --omit=dev --audit-level=low` and the independent `tools/viya-capture` audit.
130
+
131
+ `scripts/audit-allowlist.json` is empty because the former picomatch source 1247710 no longer appears. A future exemption must name its GHSA `id`, exact numeric `source`, exact `severity`, `recheckBy` date and a reason; `packages` can restrict its scope. A changed source or severity requires review. Unlike the old gate, a stale exemption fails: remove it when the finding clears. See the [shared gate documentation](https://github.com/sasjs/release#the-audit-gate) for the schema and replay options.
132
+
127
133
  ### The coverage ratchet
128
134
 
129
135
  `jest.config.js` carries a floor, and a floor only moves when somebody remembers to move it - so it passes a pull request that drops two points as long as it stays above the number. The ratchet is the other half:
package/build/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @sasjs/api 0.48.0 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
1
+ /* @sasjs/api 0.48.1 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
2
2
  "use strict";
3
3
  var SASjsApi = (() => {
4
4
  var __defProp = Object.defineProperty;
@@ -10037,6 +10037,11 @@ var SASjsApi = (() => {
10037
10037
  };
10038
10038
  var CODE_LIFETIME_SECONDS = 30;
10039
10039
  var live = (issued, now) => issued && (issued.expiresAt === void 0 || issued.expiresAt > now) ? issued.subject : void 0;
10040
+ var PUBLIC_CLIENT = {
10041
+ clientId: "sas.cli",
10042
+ accessTokenExpiration: 86400,
10043
+ refreshTokenExpiration: 86400 * 30
10044
+ };
10040
10045
  var MemoryIdentityStore = class {
10041
10046
  constructor(fixture = DEFAULT_IDENTITY) {
10042
10047
  this.userList = [];
@@ -10144,7 +10149,9 @@ var SASjsApi = (() => {
10144
10149
  return this.passwords.get(user3.uid) === password;
10145
10150
  }
10146
10151
  async client(clientId) {
10147
- return this.clientMap.get(clientId);
10152
+ const declared = this.clientMap.get(clientId);
10153
+ if (declared) return declared;
10154
+ return clientId === PUBLIC_CLIENT.clientId ? { ...PUBLIC_CLIENT } : void 0;
10148
10155
  }
10149
10156
  async issue(subject, client) {
10150
10157
  const issuedAt = Date.now();
@@ -34,6 +34,21 @@ const CODE_LIFETIME_SECONDS = 30;
34
34
  const live = (issued, now) => issued && (issued.expiresAt === undefined || issued.expiresAt > now)
35
35
  ? issued.subject
36
36
  : undefined;
37
+ /**
38
+ * The public OAuth client every Viya deployment ships.
39
+ *
40
+ * `@sasjs/adapter` falls back to it whenever a target names no client, and
41
+ * sasjs/server binds its password grant - and the refresh that follows - to this
42
+ * id with an empty secret, as a rule rather than a stored record, because a
43
+ * client record carries a secret and a public client has none. The lifetimes are
44
+ * the ones the server mints with, so a pair bought here expires when it would
45
+ * there.
46
+ */
47
+ const PUBLIC_CLIENT = {
48
+ clientId: 'sas.cli',
49
+ accessTokenExpiration: 86400,
50
+ refreshTokenExpiration: 86400 * 30
51
+ };
37
52
  /**
38
53
  * Whether a token minted for one subject names the same user and client.
39
54
  *
@@ -151,7 +166,19 @@ class MemoryIdentityStore {
151
166
  return this.passwords.get(user.uid) === password;
152
167
  }
153
168
  async client(clientId) {
154
- return this.clientMap.get(clientId);
169
+ const declared = this.clientMap.get(clientId);
170
+ if (declared)
171
+ return declared;
172
+ // The public client is never a record, because a record carries a secret and
173
+ // a public client has none. The platform ships it, sasjs/server binds its
174
+ // password grant to exactly this id with an empty secret, and
175
+ // `@sasjs/adapter` falls back to it whenever a target names no client.
176
+ // Resolving it here lets a host answer the sign-in a server answers, while
177
+ // leaving `clients()` - the administration listing - to the fixture: what a
178
+ // site reports about its own clients must not depend on a rule of the estate.
179
+ return clientId === PUBLIC_CLIENT.clientId
180
+ ? { ...PUBLIC_CLIENT }
181
+ : undefined;
155
182
  }
156
183
  async issue(subject, client) {
157
184
  // The lifetimes are the client's, recorded against the instant of issue: a
@@ -1 +1 @@
1
- {"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../../src/identity/memory-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,aAAa,EACb,OAAO,EACP,OAAO,EACP,SAAS,EACT,UAAU,EACX,MAAM,YAAY,CAAA;AACnB,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,cAAc,CAAA;AA+DrB;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,aAAa;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IACtD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyC;IACnE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA8C;IAC7E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IACxE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoC;IAC9D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IACnD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4B;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAo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AC;IAI1C,YAAY,CAChB,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,oBAAoB,CAAC;IAUhC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,IAAI,eAAe;CA4B5B"}
@@ -31,6 +31,21 @@ const CODE_LIFETIME_SECONDS = 30;
31
31
  const live = (issued, now) => issued && (issued.expiresAt === undefined || issued.expiresAt > now)
32
32
  ? issued.subject
33
33
  : undefined;
34
+ /**
35
+ * The public OAuth client every Viya deployment ships.
36
+ *
37
+ * `@sasjs/adapter` falls back to it whenever a target names no client, and
38
+ * sasjs/server binds its password grant - and the refresh that follows - to this
39
+ * id with an empty secret, as a rule rather than a stored record, because a
40
+ * client record carries a secret and a public client has none. The lifetimes are
41
+ * the ones the server mints with, so a pair bought here expires when it would
42
+ * there.
43
+ */
44
+ const PUBLIC_CLIENT = {
45
+ clientId: 'sas.cli',
46
+ accessTokenExpiration: 86400,
47
+ refreshTokenExpiration: 86400 * 30
48
+ };
34
49
  /**
35
50
  * Whether a token minted for one subject names the same user and client.
36
51
  *
@@ -148,7 +163,19 @@ export class MemoryIdentityStore {
148
163
  return this.passwords.get(user.uid) === password;
149
164
  }
150
165
  async client(clientId) {
151
- return this.clientMap.get(clientId);
166
+ const declared = this.clientMap.get(clientId);
167
+ if (declared)
168
+ return declared;
169
+ // The public client is never a record, because a record carries a secret and
170
+ // a public client has none. The platform ships it, sasjs/server binds its
171
+ // password grant to exactly this id with an empty secret, and
172
+ // `@sasjs/adapter` falls back to it whenever a target names no client.
173
+ // Resolving it here lets a host answer the sign-in a server answers, while
174
+ // leaving `clients()` - the administration listing - to the fixture: what a
175
+ // site reports about its own clients must not depend on a rule of the estate.
176
+ return clientId === PUBLIC_CLIENT.clientId
177
+ ? { ...PUBLIC_CLIENT }
178
+ : undefined;
152
179
  }
153
180
  async issue(subject, client) {
154
181
  // The lifetimes are the client's, recorded against the instant of issue: a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/api",
3
- "version": "0.48.0",
3
+ "version": "0.48.1",
4
4
  "description": "The SASjs Server API, described once - a generated route table, the services behind it, and the conformance corpus both hosts run",
5
5
  "license": "MIT",
6
6
  "author": "SASjs",
@@ -49,14 +49,14 @@
49
49
  "check:viya": "node scripts/viya-generate.mjs --check",
50
50
  "check:builds": "node scripts/check-builds.mjs",
51
51
  "check:package": "node scripts/check-package.mjs",
52
- "audit:gate": "node scripts/audit.mjs",
52
+ "audit:gate": "sasjs-release --audit --audit-level info --audit-require-source --audit-require-severity",
53
53
  "check:appstream": "node scripts/appstream-browser-check.cjs",
54
54
  "conformance": "node tools/viya-conformance/conformance.mjs",
55
55
  "release": "sasjs-release",
56
56
  "prepublishOnly": "node -e \"const v=require('./package.json').version; if (/^0\\.0\\.0/.test(v)) { console.error('refusing to publish ' + v + ': the version is stamped from the tag by @sasjs/release --prepare-publish'); process.exit(1) }\""
57
57
  },
58
58
  "devDependencies": {
59
- "@sasjs/release": "0.11.1",
59
+ "@sasjs/release": "0.18.0",
60
60
  "@types/jest": "30.0.0",
61
61
  "@types/node": "22.20.5",
62
62
  "deepmerge": "file:./vendor/deepmerge",