@adobe/helix-config 3.11.1 → 3.13.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 +14 -0
- package/package.json +5 -5
- package/src/config-view.js +35 -0
- package/src/schemas/content.schema.json +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [3.13.0](https://github.com/adobe/helix-config/compare/v3.12.0...v3.13.0) (2024-08-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* support content overlay in content schema ([bb45473](https://github.com/adobe/helix-config/commit/bb454730c20a882a9541f5e73a6b05d59391d250))
|
|
7
|
+
|
|
8
|
+
# [3.12.0](https://github.com/adobe/helix-config/compare/v3.11.1...v3.12.0) (2024-07-31)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* enforce original-site for admin config ([#157](https://github.com/adobe/helix-config/issues/157)) ([366328f](https://github.com/adobe/helix-config/commit/366328f8a918341d61239b7d32205eea1fa09f02))
|
|
14
|
+
|
|
1
15
|
## [3.11.1](https://github.com/adobe/helix-config/compare/v3.11.0...v3.11.1) (2024-07-29)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "Helix Config",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"ajv-cli": "5.0.0",
|
|
45
45
|
"c8": "10.1.2",
|
|
46
46
|
"eslint": "8.57.0",
|
|
47
|
-
"husky": "9.1.
|
|
47
|
+
"husky": "9.1.4",
|
|
48
48
|
"json-schema-to-typescript": "15.0.0",
|
|
49
|
-
"junit-report-builder": "
|
|
50
|
-
"lint-staged": "15.2.
|
|
51
|
-
"mocha": "10.7.
|
|
49
|
+
"junit-report-builder": "5.0.0",
|
|
50
|
+
"lint-staged": "15.2.8",
|
|
51
|
+
"mocha": "10.7.3",
|
|
52
52
|
"mocha-multi-reporters": "1.5.1",
|
|
53
53
|
"mocha-suppress-logs": "0.5.1",
|
|
54
54
|
"nock": "13.5.4",
|
package/src/config-view.js
CHANGED
|
@@ -185,6 +185,23 @@ async function loadMetadata(ctx, config, partition) {
|
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
+
/**
|
|
189
|
+
* loads the original site information from the `.hlx.json` file
|
|
190
|
+
* @param ctx the context
|
|
191
|
+
* @param contentBusId the content bus id
|
|
192
|
+
* @returns {Promise<string>} the original site.
|
|
193
|
+
*/
|
|
194
|
+
async function fetchOriginalSite(ctx, contentBusId) {
|
|
195
|
+
const key = `${contentBusId}/.hlx.json`;
|
|
196
|
+
const res = await ctx.loader.getObject(HELIX_CONTENT_BUS, key);
|
|
197
|
+
if (res.body) {
|
|
198
|
+
const json = res.json();
|
|
199
|
+
return json['original-site'] || json['original-repository'] || '';
|
|
200
|
+
}
|
|
201
|
+
ctx.log.error(`failed to load ${key}: ${res.status}`);
|
|
202
|
+
return '';
|
|
203
|
+
}
|
|
204
|
+
|
|
188
205
|
async function loadHeadHtml(ctx, config, ref) {
|
|
189
206
|
const key = `${config.code.owner}/${config.code.repo}/${ref}/head.html`;
|
|
190
207
|
const res = await ctx.loader.getObject(HELIX_CODE_BUS, key);
|
|
@@ -387,6 +404,24 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
387
404
|
},
|
|
388
405
|
});
|
|
389
406
|
}
|
|
407
|
+
// validate original-site
|
|
408
|
+
if (!config.legacy) {
|
|
409
|
+
const originalSite = await fetchOriginalSite(ctx, config.content.contentBusId);
|
|
410
|
+
if (originalSite && originalSite !== `${org}/${site}`) {
|
|
411
|
+
ctx.log.error(`original site ${originalSite} does not match requested ${org}/${site}.`);
|
|
412
|
+
if (scope === SCOPE_ADMIN) {
|
|
413
|
+
return new PipelineResponse('', {
|
|
414
|
+
status: 403,
|
|
415
|
+
headers: {
|
|
416
|
+
'x-error': 'original site mismatch',
|
|
417
|
+
...surrogateHeaders,
|
|
418
|
+
},
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
// todo: also send 403 for all scopes....but first observe only
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
390
425
|
if (config.extends && scope !== SCOPE_RAW) {
|
|
391
426
|
delete config.extends;
|
|
392
427
|
}
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
{ "$ref": "https://ns.adobe.com/helix/config/content-source/onedrive" },
|
|
16
16
|
{ "$ref": "https://ns.adobe.com/helix/config/content-source/markup" }
|
|
17
17
|
]
|
|
18
|
+
},
|
|
19
|
+
"overlay": {
|
|
20
|
+
"oneOf": [
|
|
21
|
+
{ "$ref": "https://ns.adobe.com/helix/config/content-source/markup" }
|
|
22
|
+
]
|
|
18
23
|
}
|
|
19
24
|
},
|
|
20
25
|
"required": [
|