@adobe/helix-config 5.6.11 → 5.7.0

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,10 @@
1
+ # [5.7.0](https://github.com/adobe/helix-config/compare/v5.6.11...v5.7.0) (2025-11-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * include org and site apiKeys into admin scope ([#337](https://github.com/adobe/helix-config/issues/337)) ([ceed54e](https://github.com/adobe/helix-config/commit/ceed54ed5533da5cf9cd4702946af2165290722e))
7
+
1
8
  ## [5.6.11](https://github.com/adobe/helix-config/compare/v5.6.10...v5.6.11) (2025-11-05)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "5.6.11",
3
+ "version": "5.7.0",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -44,7 +44,7 @@
44
44
  "eslint": "9.4.0",
45
45
  "husky": "9.1.7",
46
46
  "junit-report-builder": "5.1.1",
47
- "lint-staged": "16.2.5",
47
+ "lint-staged": "16.2.6",
48
48
  "mocha": "11.7.4",
49
49
  "mocha-multi-reporters": "1.5.1",
50
50
  "mocha-suppress-logs": "0.6.0",
@@ -392,6 +392,25 @@ function computeOrgAdminRoles(adminConfig, orgConfig) {
392
392
  }
393
393
  }
394
394
 
395
+ /**
396
+ * Apply org config apiKeys.
397
+ * @param adminConfig
398
+ * @param orgConfig
399
+ */
400
+ function applyOrgAPIKeys(adminConfig, orgConfig) {
401
+ const orgKeys = Object.keys(orgConfig.apiKeys ?? {});
402
+ if (orgKeys.length) {
403
+ const admin = deepGetOrCreate(adminConfig, ['access', 'admin'], true);
404
+ const apiKeyId = new Set([
405
+ ...admin.apiKeyId ?? [],
406
+ ...orgKeys,
407
+ ]);
408
+ if (apiKeyId.size) {
409
+ admin.apiKeyId = Array.from(apiKeyId).sort();
410
+ }
411
+ }
412
+ }
413
+
395
414
  /**
396
415
  * Extract the email addresses of the users for the given group.
397
416
  * @param groups
@@ -500,9 +519,14 @@ async function computeSiteAdminRoles(ctx, siteConfig, admin, orgConfig, configGr
500
519
  role: roles,
501
520
  };
502
521
 
503
- const apiKeyId = new Set([...admin.apiKeyId ?? [], ...orgConfig?.access?.admin?.apiKeyId ?? []]);
522
+ const apiKeyId = new Set([
523
+ ...admin.apiKeyId ?? [],
524
+ ...orgConfig?.access?.admin?.apiKeyId ?? [],
525
+ ...Object.keys(orgConfig?.apiKeys || {}),
526
+ ...Object.keys(siteConfig?.apiKeys || {}),
527
+ ]);
504
528
  if (apiKeyId.size) {
505
- ret.apiKeyId = Array.from(apiKeyId);
529
+ ret.apiKeyId = Array.from(apiKeyId).sort();
506
530
  }
507
531
  // if there are only roles from the org, ensure that they don't enforce auth
508
532
  if (hasOrgUsers && !hasRoles && (!admin.requireAuth || admin.requireAuth === 'auto')) {
@@ -732,6 +756,7 @@ export async function getOrgConfigResponse(ctx, opts) {
732
756
  };
733
757
 
734
758
  computeOrgAdminRoles(adminConfig, orgConfig);
759
+ applyOrgAPIKeys(adminConfig, orgConfig);
735
760
  delete adminConfig.tokens;
736
761
  delete adminConfig.users;
737
762
  delete adminConfig.groups;