@adobe/helix-config-storage 2.2.6 → 2.2.8

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,17 @@
1
+ ## [2.2.8](https://github.com/adobe/helix-config-storage/compare/v2.2.7...v2.2.8) (2025-05-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update adobe fixes ([#128](https://github.com/adobe/helix-config-storage/issues/128)) ([1b65a25](https://github.com/adobe/helix-config-storage/commit/1b65a2561eee4d340cd200f3d6e9d125eaaca61c))
7
+
8
+ ## [2.2.7](https://github.com/adobe/helix-config-storage/compare/v2.2.6...v2.2.7) (2025-05-16)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * stricter apikey handling ([b533b1f](https://github.com/adobe/helix-config-storage/commit/b533b1fccd94cfd02d6cc1462220ac36682e9557))
14
+
1
15
  ## [2.2.6](https://github.com/adobe/helix-config-storage/compare/v2.2.5...v2.2.6) (2025-05-13)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config-storage",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "Helix Config Storage",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -47,11 +47,11 @@
47
47
  "json-schema-to-typescript": "15.0.4",
48
48
  "junit-report-builder": "5.1.1",
49
49
  "lint-staged": "16.0.0",
50
- "mocha": "11.2.2",
50
+ "mocha": "11.4.0",
51
51
  "mocha-multi-reporters": "1.5.1",
52
52
  "mocha-suppress-logs": "0.5.1",
53
53
  "nock": "13.5.6",
54
- "semantic-release": "24.2.3",
54
+ "semantic-release": "24.2.4",
55
55
  "xml2js": "0.6.2"
56
56
  },
57
57
  "lint-staged": {
@@ -39,6 +39,7 @@ const ROOT_PROPERTIES = {
39
39
  groups: {},
40
40
  features: {},
41
41
  limits: {},
42
+ apiKeys: {},
42
43
  };
43
44
 
44
45
  const FORCED_TYPES = {
@@ -594,32 +594,32 @@ export class ConfigStore {
594
594
  delete ret.hash;
595
595
  }
596
596
  if (frag.type === 'apiKeys') {
597
- if (data.jwt) {
598
- try {
599
- const payload = await decodeJwt(data.jwt);
600
- data.id = payload.jti;
601
- data.roles = payload.roles;
602
- data.subject = payload.sub;
603
- data.expiration = new Date(payload.exp * 1000).toISOString();
604
- delete data.jwt;
605
- } catch (e) {
606
- throw new StatusCodeError(400, e.message);
607
- }
597
+ if (!data.jwt) {
598
+ throw new StatusCodeError(400, 'jwt missing for new keys');
599
+ }
600
+ try {
601
+ const payload = await decodeJwt(data.jwt);
602
+ data.id = payload.jti;
603
+ data.roles = payload.roles;
604
+ data.subject = payload.sub;
605
+ data.expiration = new Date(payload.exp * 1000).toISOString();
606
+ delete data.jwt;
607
+ } catch (e) {
608
+ throw new StatusCodeError(400, e.message);
608
609
  }
610
+ data.created = new Date().toISOString();
609
611
  frag.name = base64ToBase64Url(data.id);
610
612
  frag.type = 'apiKey';
611
613
  frag.relPath.push(frag.name);
612
- }
613
- if (frag.type === 'apiKey') {
614
- if (data.jwt) {
615
- throw new StatusCodeError(400, 'jwt not allowed in existing apiKey');
614
+ } else if (frag.type === 'apiKey') {
615
+ if (Object.keys(data).some((key) => key !== 'description')) {
616
+ throw new StatusCodeError(400, 'not allowed to alter properties other than "description" in apiKey');
616
617
  }
617
- const oldData = deepGetOrCreate(old, frag.relPath, true);
618
- data.created = oldData.created || new Date().toISOString();
619
- // ensure that the name is equal to the sanitized id
620
- if (frag.name !== base64ToBase64Url(data.id)) {
621
- throw new StatusCodeError(400, 'apiKey id mismatch');
618
+ const oldData = deepGetOrCreate(old, frag.relPath, false);
619
+ if (!oldData) {
620
+ throw new StatusCodeError(404, 'object not found.');
622
621
  }
622
+ data = Object.assign(oldData, data);
623
623
  }
624
624
  if (frag.type === 'secrets') {
625
625
  // create new secret with random id