@forge/manifest 0.0.0-experimental-7c72fec → 0.0.0-experimental-c3d0263
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 +221 -3
- package/out/mapping/product-event-to-scope-mapping.json +334 -110
- package/out/schema/basic-manifest-schema.json +23 -0
- package/out/schema/basic-manifest.d.ts +9 -0
- package/out/schema/manifest-schema.json +1494 -261
- package/out/schema/manifest.d.ts +1254 -544
- package/out/scopes/shipyard-scopes.json +2 -0
- package/out/text/errors.d.ts +4 -0
- package/out/text/errors.d.ts.map +1 -1
- package/out/text/errors.js +4 -0
- package/out/types/egress-types.d.ts +1 -1
- package/out/types/egress-types.d.ts.map +1 -1
- package/out/types/egress-types.js +3 -1
- package/out/types/module-types.d.ts +1 -1
- package/out/types/module-types.d.ts.map +1 -1
- package/out/types/module-types.js +1 -1
- package/out/validators/modules-validator.d.ts.map +1 -1
- package/out/validators/modules-validator.js +12 -3
- package/out/validators/permissions-validator.d.ts +6 -0
- package/out/validators/permissions-validator.d.ts.map +1 -1
- package/out/validators/permissions-validator.js +76 -73
- package/out/validators/product-trigger-scopes-validator.d.ts +4 -1
- package/out/validators/product-trigger-scopes-validator.d.ts.map +1 -1
- package/out/validators/product-trigger-scopes-validator.js +23 -7
- package/package.json +3 -3
|
@@ -214,6 +214,7 @@
|
|
|
214
214
|
"read:user:confluence",
|
|
215
215
|
"read:user:jira",
|
|
216
216
|
"read:user.columns:jira",
|
|
217
|
+
"read:user.property:confluence",
|
|
217
218
|
"read:user.property:jira",
|
|
218
219
|
"read:watcher:confluence",
|
|
219
220
|
"read:webhook:jira",
|
|
@@ -326,6 +327,7 @@
|
|
|
326
327
|
"write:sprint:jira-software",
|
|
327
328
|
"write:template:confluence",
|
|
328
329
|
"write:user-configuration:jira",
|
|
330
|
+
"write:user.property:confluence",
|
|
329
331
|
"write:user.property:jira",
|
|
330
332
|
"write:watcher:confluence",
|
|
331
333
|
"write:webhook:jira",
|
package/out/text/errors.d.ts
CHANGED
|
@@ -42,6 +42,10 @@ export declare const errors: {
|
|
|
42
42
|
customFields: {
|
|
43
43
|
searchAlias: (aliases: string[]) => string;
|
|
44
44
|
};
|
|
45
|
+
subPages: {
|
|
46
|
+
subPagesWithUIKit: (key: string) => string;
|
|
47
|
+
invalidPagesAndSections: (key: string) => string;
|
|
48
|
+
};
|
|
45
49
|
function: {
|
|
46
50
|
invalidKeyLength: (key: string) => string;
|
|
47
51
|
handler: {
|
package/out/text/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/text/errors.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;8BACS,MAAM,KAAG,MAAM;2BACpB,MAAM;yBAEN,MAAM,GAAG,SAAS,QAAQ,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,KAAG,MAAM;;uBAO3E,MAAM,EAAE,EAAE,GAAG,SAAS,KAAG,MAAM;4BAI1B,MAAM,EAAE,KAAG,MAAM;mCACV,MAAM,SAAS,MAAM,0CAA4B,MAAM;mDAIvC,MAAM,KAAG,MAAM;;;qCAI7B,MAAM,SAAS,MAAM,KAAG,MAAM;4CAEvB,MAAM,SAAS,MAAM,KAAG,MAAM;wCAElC,MAAM,SAAS,MAAM,EAAE,KAAG,MAAM;;;uCAMjC,MAAM,KAAG,MAAM;oCACpB,MAAM;iCAEP,MAAM,KAAG,MAAM;4CACJ,MAAM,KAAG,MAAM;;;gCAG3B,MAAM,KAAG,MAAM;6BACpB,MAAM;+BACJ,MAAM;iCACF,MAAM,KAAG,MAAM;yCACP,MAAM,eAAe,MAAM,KAAG,MAAM;yCAEpC,MAAM,eAAe,MAAM,KAAG,MAAM;;yCAGtC,MAAM,KAAG,MAAM;iCAEvB,MAAM,KAAG,MAAM;4CACJ,MAAM,gBAAgB,MAAM,KAAG,MAAM;sCAE3C,MAAM,gBAAgB,MAAM,gBAAgB,MA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M,SAAS,MAAM,KAAG,MAAM;qCAI7B,MAAM,YAAY,MAAM,KAAG,MAAM;;;;;mCAQ/B,MAAM,OAAO,MAAM,KAAG,MAAM;iCAE9B,MAAM,OAAO,MAAM,KAAG,MAAM;oCAEzB,MAAM,OAAO,MAAM,KAAG,MAAM;gDAEhB,MAAM,KAAG,MAAM;uCAExB,MAAM,KAAG,MAAM;;;;;;;;kCAQpB,MAAM,UAAU,MAAM,KAAG,MAAM;gCAEjC,MAAM,KAAG,MAAM;2CAEJ,MAAM,eAAe,MAAM,KAAG,MAAM;;;uCAI1C,MAAM;uCAEJ,MAAM,KAAG,MAAM;qCAEnB,MAAM;;CAGpC,CAAC;AAEF,oBAAY,UAAU;IACpB,eAAe,2BAA2B;IAC1C,eAAe,wBAAwB;IACvC,WAAW,4BAA4B;IACvC,WAAW,+BAA+B;IAC1C,aAAa,8BAA8B;IAC3C,OAAO,0BAA0B;IACjC,cAAc,kCAAkC;IAChD,mBAAmB,0BAA0B;IAC7C,SAAS,4BAA4B;IACrC,SAAS,4BAA4B;IACrC,UAAU,wBAAwB;IAClC,GAAG,8BAA8B;CAClC"}
|
package/out/text/errors.js
CHANGED
|
@@ -54,6 +54,10 @@ exports.errors = {
|
|
|
54
54
|
customFields: {
|
|
55
55
|
searchAlias: (aliases) => `Search alias should be always unique per field. Found duplicates: ${aliases.join(', ')}.`
|
|
56
56
|
},
|
|
57
|
+
subPages: {
|
|
58
|
+
subPagesWithUIKit: (key) => `Subpages in UI kit are not supported. Use Custom UI in the '${key}' module instead.`,
|
|
59
|
+
invalidPagesAndSections: (key) => `'pages' cannot be used with 'sections' in the module '${key}'.`
|
|
60
|
+
},
|
|
57
61
|
function: {
|
|
58
62
|
invalidKeyLength: (key) => `The function key exceeds 23 characters: ‘${key}’.`,
|
|
59
63
|
handler: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"egress-types.d.ts","sourceRoot":"","sources":["../../src/types/egress-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"egress-types.d.ts","sourceRoot":"","sources":["../../src/types/egress-types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;CAExB,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EGRESS_TYPES = void 0;
|
|
4
|
+
const ALLOWED_CSP_UNSAFE_SOURCES = ['unsafe-eval', 'unsafe-hashes', 'unsafe-inline'];
|
|
5
|
+
const ALLOWED_CSP_SCHEMA_SOURCES = ['blob:'];
|
|
4
6
|
exports.EGRESS_TYPES = {
|
|
5
|
-
|
|
7
|
+
ALLOWED_CSP_TYPES: [...ALLOWED_CSP_UNSAFE_SOURCES, ...ALLOWED_CSP_SCHEMA_SOURCES]
|
|
6
8
|
};
|
|
@@ -35,7 +35,7 @@ export declare enum AllModuleTypes {
|
|
|
35
35
|
JiraServiceManagementPortalHeader = "jiraServiceManagement:portalHeader",
|
|
36
36
|
JiraServiceManagementPortalSubheader = "jiraServiceManagement:portalSubheader",
|
|
37
37
|
JiraServiceManagementPortalFooter = "jiraServiceManagement:portalFooter",
|
|
38
|
-
|
|
38
|
+
JiraServiceManagementPortalProfilePanel = "jiraServiceManagement:portalProfilePanel",
|
|
39
39
|
ConnectJiraAdminPages = "connect-jira:adminPages",
|
|
40
40
|
ConnectJiraJiraBackgroundScripts = "connect-jira:jiraBackgroundScripts",
|
|
41
41
|
ConnectJiraGeneralPages = "connect-jira:generalPages",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-types.d.ts","sourceRoot":"","sources":["../../src/types/module-types.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,YAAY,kBAAkB;IAC9B,WAAW,iBAAiB;IAC5B,cAAc,oBAAoB;IAClC,YAAY,kBAAkB;IAC9B,oBAAoB,0BAA0B;IAC9C,QAAQ,cAAc;IACtB,uBAAuB,6BAA6B;IACpD,2BAA2B,iCAAiC;IAC5D,qBAAqB,2BAA2B;IAChD,wBAAwB,8BAA8B;IACtD,oBAAoB,0BAA0B;IAC9C,sBAAsB,4BAA4B;IAClD,mBAAmB,yBAAyB;IAC5C,uBAAuB,6BAA6B;IACpD,qBAAqB,2BAA2B;IAChD,eAAe,qBAAqB;IACpC,mBAAmB,yBAAyB;IAC5C,eAAe,qBAAqB;IACpC,iBAAiB,uBAAuB;IACxC,eAAe,qBAAqB;IACpC,cAAc,oBAAoB;IAClC,aAAa,mBAAmB;IAChC,eAAe,qBAAqB;IACpC,uBAAuB,6BAA6B;IACpD,cAAc,oBAAoB;IAClC,mBAAmB,yBAAyB;IAC5C,gBAAgB,sBAAsB;IACtC,oBAAoB,0BAA0B;IAC9C,iBAAiB,uBAAuB;IAExC,8BAA8B,oCAAoC;IAClE,wCAAwC,8CAA8C;IACtF,6CAA6C,mDAAmD;IAChG,sCAAsC,4CAA4C;IAClF,iCAAiC,uCAAuC;IACxE,oCAAoC,0CAA0C;IAC9E,iCAAiC,uCAAuC;IACxE,
|
|
1
|
+
{"version":3,"file":"module-types.d.ts","sourceRoot":"","sources":["../../src/types/module-types.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,YAAY,kBAAkB;IAC9B,WAAW,iBAAiB;IAC5B,cAAc,oBAAoB;IAClC,YAAY,kBAAkB;IAC9B,oBAAoB,0BAA0B;IAC9C,QAAQ,cAAc;IACtB,uBAAuB,6BAA6B;IACpD,2BAA2B,iCAAiC;IAC5D,qBAAqB,2BAA2B;IAChD,wBAAwB,8BAA8B;IACtD,oBAAoB,0BAA0B;IAC9C,sBAAsB,4BAA4B;IAClD,mBAAmB,yBAAyB;IAC5C,uBAAuB,6BAA6B;IACpD,qBAAqB,2BAA2B;IAChD,eAAe,qBAAqB;IACpC,mBAAmB,yBAAyB;IAC5C,eAAe,qBAAqB;IACpC,iBAAiB,uBAAuB;IACxC,eAAe,qBAAqB;IACpC,cAAc,oBAAoB;IAClC,aAA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,sCAAsC;IACrE,sCAAsC,6CAA6C;IACnF,4BAA4B,mCAAmC;IAC/D,6BAA6B,oCAAoC;IACjE,yBAAyB,gCAAgC;IACzD,2BAA2B,kCAAkC;IAC7D,iCAAiC,wCAAwC;IACzE,sBAAsB,6BAA6B;IACnD,iCAAiC,wCAAwC;IACzE,oCAAoC,2CAA2C;IAC/E,iCAAiC,wCAAwC;IACzE,0BAA0B,iCAAiC;IAC3D,oBAAoB,2BAA2B;IAC/C,sBAAsB,6BAA6B;IACnD,mBAAmB,0BAA0B;IAC7C,0BAA0B,iCAAiC;CAC5D;AAED,eAAO,MAAM,iBAAiB,kBAAgC,CAAC;AAE/D,eAAO,MAAM,uBAAuB,UAAwE,CAAC"}
|
|
@@ -39,7 +39,7 @@ var AllModuleTypes;
|
|
|
39
39
|
AllModuleTypes["JiraServiceManagementPortalHeader"] = "jiraServiceManagement:portalHeader";
|
|
40
40
|
AllModuleTypes["JiraServiceManagementPortalSubheader"] = "jiraServiceManagement:portalSubheader";
|
|
41
41
|
AllModuleTypes["JiraServiceManagementPortalFooter"] = "jiraServiceManagement:portalFooter";
|
|
42
|
-
AllModuleTypes["
|
|
42
|
+
AllModuleTypes["JiraServiceManagementPortalProfilePanel"] = "jiraServiceManagement:portalProfilePanel";
|
|
43
43
|
AllModuleTypes["ConnectJiraAdminPages"] = "connect-jira:adminPages";
|
|
44
44
|
AllModuleTypes["ConnectJiraJiraBackgroundScripts"] = "connect-jira:jiraBackgroundScripts";
|
|
45
45
|
AllModuleTypes["ConnectJiraGeneralPages"] = "connect-jira:generalPages";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules-validator.d.ts","sourceRoot":"","sources":["../../src/validators/modules-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,wBAAwB,EAAsC,MAAM,UAAU,CAAC;AAGxH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D,qBAAa,gBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IACzF,OAAO,CAAC,oBAAoB,CAA0C;IAEtE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,wBAAwB,CAAC,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"modules-validator.d.ts","sourceRoot":"","sources":["../../src/validators/modules-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,wBAAwB,EAAsC,MAAM,UAAU,CAAC;AAGxH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D,qBAAa,gBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IACzF,OAAO,CAAC,oBAAoB,CAA0C;IAEtE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,wBAAwB,CAAC,cAAc,CAAC;CA4NzG"}
|
|
@@ -92,9 +92,18 @@ class ModulesValidator {
|
|
|
92
92
|
types_1.AllModuleTypes.JiraProjectSettingsPage,
|
|
93
93
|
types_1.AllModuleTypes.JiraGlobalPage
|
|
94
94
|
].forEach((moduleType) => {
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
validationErrors.push(Object.assign({ message: text_1.errors.modules.fullPage.children(moduleType), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition(
|
|
95
|
+
const moduleArray = modules[moduleType];
|
|
96
|
+
if (moduleArray && moduleArray.length > 1) {
|
|
97
|
+
validationErrors.push(Object.assign({ message: text_1.errors.modules.fullPage.children(moduleType), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition(moduleArray[1].key, yamlContentByLine)));
|
|
98
|
+
}
|
|
99
|
+
if (moduleArray && moduleArray.length === 1) {
|
|
100
|
+
const module = moduleArray[0];
|
|
101
|
+
if (module && (module.pages || module.sections) && module.function) {
|
|
102
|
+
validationErrors.push(Object.assign({ message: text_1.errors.modules.subPages.subPagesWithUIKit(module.key), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition(module.key, yamlContentByLine)));
|
|
103
|
+
}
|
|
104
|
+
if (module && module.pages && module.sections) {
|
|
105
|
+
validationErrors.push(Object.assign({ message: text_1.errors.modules.subPages.invalidPagesAndSections(module.key), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition(module.key, yamlContentByLine)));
|
|
106
|
+
}
|
|
98
107
|
}
|
|
99
108
|
});
|
|
100
109
|
[types_1.AllModuleTypes.JiraCustomField, types_1.AllModuleTypes.JiraCustomFieldType].forEach((moduleType) => {
|
|
@@ -2,6 +2,12 @@ import { ManifestObject, ManifestValidationResult } from '../types';
|
|
|
2
2
|
import { ManifestSchema } from '../schema/manifest';
|
|
3
3
|
import { ValidatorInterface } from './validator-interface';
|
|
4
4
|
export declare class PermissionsValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
|
|
5
|
+
private validationErrors;
|
|
6
|
+
constructor();
|
|
7
|
+
private isValidURL;
|
|
8
|
+
private isValidHash;
|
|
9
|
+
private addValidationErrors;
|
|
10
|
+
private validateExternalPermissionURLs;
|
|
5
11
|
validate(manifest: ManifestObject<ManifestSchema> | undefined): ManifestValidationResult<ManifestSchema>;
|
|
6
12
|
}
|
|
7
13
|
//# sourceMappingURL=permissions-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions-validator.d.ts","sourceRoot":"","sources":["../../src/validators/permissions-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAU,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAM3D,qBAAa,oBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IACzF,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,wBAAwB,CAAC,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"permissions-validator.d.ts","sourceRoot":"","sources":["../../src/validators/permissions-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAU,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAM3D,qBAAa,oBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IACzF,OAAO,CAAC,gBAAgB,CAAoB;;IAM5C,OAAO,CAAC,UAAU;IA+BlB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,8BAA8B;IAWtC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,wBAAwB,CAAC,cAAc,CAAC;CA8FzG"}
|
|
@@ -9,97 +9,100 @@ const url_1 = require("url");
|
|
|
9
9
|
const shipyard_scopes_json_1 = tslib_1.__importDefault(require("../scopes/shipyard-scopes.json"));
|
|
10
10
|
const deprecated_shipyard_scopes_json_1 = tslib_1.__importDefault(require("../scopes/deprecated-shipyard-scopes.json"));
|
|
11
11
|
class PermissionsValidator {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
constructor() {
|
|
13
|
+
this.validationErrors = [];
|
|
14
|
+
}
|
|
15
|
+
isValidURL(inputURL) {
|
|
16
|
+
const protocolRegex = /^(.*?:\/\/)/;
|
|
17
|
+
const validURI = /^(\*\.)?[.a-zA-Z0-9_\-\/:~#%?=&]+$/;
|
|
18
|
+
const allowedProtocols = ['https:', 'wss:'];
|
|
19
|
+
const MAX_URL_LENGTH = 1000;
|
|
20
|
+
if (inputURL.length > MAX_URL_LENGTH) {
|
|
21
|
+
return false;
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
validationErrors.push(Object.assign({ message: text_1.errors.permissions.invalidPermission(element, value), reference: text_1.References.Permissions, level: 'error' }, utils_1.findPosition(value, manifest.yamlContentByLine)));
|
|
23
|
+
if (inputURL === '*') {
|
|
24
|
+
return true;
|
|
23
25
|
}
|
|
26
|
+
if (!inputURL.includes('.') || inputURL.includes(' ')) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const domainOrUrlWithProtocol = protocolRegex.test(inputURL) ? inputURL : `https://${inputURL}`;
|
|
31
|
+
const parsedUrl = new url_1.URL(domainOrUrlWithProtocol);
|
|
32
|
+
if (!allowedProtocols.includes(parsedUrl.protocol)) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return validURI.test(parsedUrl.hostname);
|
|
36
|
+
}
|
|
37
|
+
catch (_) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
isValidHash(cspString) {
|
|
24
42
|
const BASE_64_HASH_PATTERNS = [
|
|
25
43
|
/^sha256-[a-zA-Z0-9=+/]{44}$/,
|
|
26
44
|
/^sha384-[a-zA-Z0-9=+/]{64}$/,
|
|
27
45
|
/^sha512-[a-zA-Z0-9=+/]{88}$/
|
|
28
46
|
];
|
|
29
|
-
|
|
30
|
-
|
|
47
|
+
return BASE_64_HASH_PATTERNS.some((pattern) => pattern.test(cspString));
|
|
48
|
+
}
|
|
49
|
+
addValidationErrors(element, values, manifest) {
|
|
50
|
+
values.forEach((value) => {
|
|
51
|
+
this.validationErrors.push(Object.assign({ message: text_1.errors.permissions.invalidPermission(element, value), reference: text_1.References.Permissions, level: 'error' }, utils_1.findPosition(value, manifest.yamlContentByLine)));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
validateExternalPermissionURLs(extPermType, perms, manifest) {
|
|
55
|
+
const invalidPerms = perms === null || perms === void 0 ? void 0 : perms.filter((key) => !this.isValidURL(key));
|
|
56
|
+
if (invalidPerms === null || invalidPerms === void 0 ? void 0 : invalidPerms.length) {
|
|
57
|
+
this.addValidationErrors(extPermType, invalidPerms, manifest);
|
|
31
58
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
if (inputURL === '*') {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
if (!inputURL.includes('.') || inputURL.includes(' ')) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
const domainOrUrlWithProtocol = protocolRegex.test(inputURL) ? inputURL : `https://${inputURL}`;
|
|
48
|
-
const parsedUrl = new url_1.URL(domainOrUrlWithProtocol);
|
|
49
|
-
if (!allowedProtocols.includes(parsedUrl.protocol)) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return validURI.test(parsedUrl.hostname);
|
|
53
|
-
}
|
|
54
|
-
catch (_) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
59
|
+
}
|
|
60
|
+
validate(manifest) {
|
|
61
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
62
|
+
if (!manifest || !manifest.typedContent || !manifest.typedContent.permissions) {
|
|
63
|
+
return {
|
|
64
|
+
success: false,
|
|
65
|
+
manifestObject: manifest
|
|
66
|
+
};
|
|
57
67
|
}
|
|
58
68
|
const ALL_SCOPES = shipyard_scopes_json_1.default.concat(deprecated_shipyard_scopes_json_1.default);
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
|
|
69
|
+
const invalidScopes = (_a = manifest.typedContent.permissions.scopes) === null || _a === void 0 ? void 0 : _a.filter((key) => !ALL_SCOPES.includes(key));
|
|
70
|
+
if (invalidScopes === null || invalidScopes === void 0 ? void 0 : invalidScopes.length) {
|
|
71
|
+
this.addValidationErrors('scopes', invalidScopes, manifest);
|
|
62
72
|
}
|
|
63
|
-
const invalidScripts = (_c = (_b = manifest.typedContent.permissions.content) === null || _b === void 0 ? void 0 : _b.scripts) === null || _c === void 0 ? void 0 : _c.
|
|
64
|
-
if (invalidScripts) {
|
|
65
|
-
|
|
73
|
+
const invalidScripts = (_c = (_b = manifest.typedContent.permissions.content) === null || _b === void 0 ? void 0 : _b.scripts) === null || _c === void 0 ? void 0 : _c.filter((key) => !egress_types_1.EGRESS_TYPES.ALLOWED_CSP_TYPES.includes(key) && !this.isValidHash(key));
|
|
74
|
+
if (invalidScripts === null || invalidScripts === void 0 ? void 0 : invalidScripts.length) {
|
|
75
|
+
this.addValidationErrors('content.scripts', invalidScripts, manifest);
|
|
66
76
|
}
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
|
|
77
|
+
const invalidBackendStrings = (_f = (_e = (_d = manifest.typedContent.permissions.external) === null || _d === void 0 ? void 0 : _d.fetch) === null || _e === void 0 ? void 0 : _e.backend) === null || _f === void 0 ? void 0 : _f.filter((item) => typeof item === 'string' && !this.isValidURL(item));
|
|
78
|
+
if (invalidBackendStrings === null || invalidBackendStrings === void 0 ? void 0 : invalidBackendStrings.length) {
|
|
79
|
+
this.addValidationErrors('external.fetch.backend', invalidBackendStrings, manifest);
|
|
70
80
|
}
|
|
71
81
|
const remoteMap = (_g = manifest.typedContent.remotes) === null || _g === void 0 ? void 0 : _g.reduce((prev, item) => prev.set(item.key, item.baseUrl), new Map());
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const invalidClientString = (_o = (_m = (_l = manifest.typedContent.permissions.external) === null || _l === void 0 ? void 0 : _l.fetch) === null || _m === void 0 ? void 0 : _m.client) === null || _o === void 0 ? void 0 : _o.filter((item) => typeof item === 'string').find((key) => !isValidURL(key));
|
|
77
|
-
if (invalidClientString) {
|
|
78
|
-
addValidationError('external.fetch.client', invalidClientString, manifest);
|
|
79
|
-
}
|
|
80
|
-
const invalidClient = (_r = (_q = (_p = manifest.typedContent.permissions.external) === null || _p === void 0 ? void 0 : _p.fetch) === null || _q === void 0 ? void 0 : _q.client) === null || _r === void 0 ? void 0 : _r.filter((item) => typeof item === 'object').find((item) => !remoteMap || !remoteMap.has(item.remote) || !isValidURL(remoteMap.get(item.remote)));
|
|
81
|
-
if (invalidClient) {
|
|
82
|
-
addValidationError('external.fetch.client', invalidClient.remote, manifest);
|
|
83
|
-
}
|
|
84
|
-
const invalidNavigation = (_t = (_s = manifest.typedContent.permissions.external) === null || _s === void 0 ? void 0 : _s.navigation) === null || _t === void 0 ? void 0 : _t.find((key) => !isValidURL(key));
|
|
85
|
-
if (invalidNavigation) {
|
|
86
|
-
addValidationError('external.navigation', invalidNavigation, manifest);
|
|
87
|
-
}
|
|
88
|
-
const invalidImages = (_v = (_u = manifest.typedContent.permissions.external) === null || _u === void 0 ? void 0 : _u.images) === null || _v === void 0 ? void 0 : _v.find((key) => !isValidURL(key));
|
|
89
|
-
if (invalidImages) {
|
|
90
|
-
addValidationError('external.images', invalidImages, manifest);
|
|
82
|
+
const invalidBackendRemotes = (_k = (_j = (_h = manifest.typedContent.permissions.external) === null || _h === void 0 ? void 0 : _h.fetch) === null || _j === void 0 ? void 0 : _j.backend) === null || _k === void 0 ? void 0 : _k.filter((item) => typeof item === 'object' &&
|
|
83
|
+
(!remoteMap || !remoteMap.has(item.remote) || !this.isValidURL(remoteMap.get(item.remote)))).map((item) => item.remote);
|
|
84
|
+
if (invalidBackendRemotes === null || invalidBackendRemotes === void 0 ? void 0 : invalidBackendRemotes.length) {
|
|
85
|
+
this.addValidationErrors('external.fetch.backend', invalidBackendRemotes, manifest);
|
|
91
86
|
}
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
|
|
87
|
+
const invalidClientStrings = (_o = (_m = (_l = manifest.typedContent.permissions.external) === null || _l === void 0 ? void 0 : _l.fetch) === null || _m === void 0 ? void 0 : _m.client) === null || _o === void 0 ? void 0 : _o.filter((item) => typeof item === 'string' && !this.isValidURL(item));
|
|
88
|
+
if (invalidClientStrings) {
|
|
89
|
+
this.addValidationErrors('external.fetch.client', invalidClientStrings, manifest);
|
|
95
90
|
}
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
const invalidClients = (_r = (_q = (_p = manifest.typedContent.permissions.external) === null || _p === void 0 ? void 0 : _p.fetch) === null || _q === void 0 ? void 0 : _q.client) === null || _r === void 0 ? void 0 : _r.filter((item) => typeof item === 'object' &&
|
|
92
|
+
(!remoteMap || !remoteMap.has(item.remote) || !this.isValidURL(remoteMap.get(item.remote)))).map((item) => item.remote);
|
|
93
|
+
if (invalidClients) {
|
|
94
|
+
this.addValidationErrors('external.fetch.client', invalidClients, manifest);
|
|
99
95
|
}
|
|
96
|
+
this.validateExternalPermissionURLs('external.navigation', (_s = manifest.typedContent.permissions.external) === null || _s === void 0 ? void 0 : _s.navigation, manifest);
|
|
97
|
+
this.validateExternalPermissionURLs('external.images', (_t = manifest.typedContent.permissions.external) === null || _t === void 0 ? void 0 : _t.images, manifest);
|
|
98
|
+
this.validateExternalPermissionURLs('external.frames', (_u = manifest.typedContent.permissions.external) === null || _u === void 0 ? void 0 : _u.frames, manifest);
|
|
99
|
+
this.validateExternalPermissionURLs('external.scripts', (_v = manifest.typedContent.permissions.external) === null || _v === void 0 ? void 0 : _v.scripts, manifest);
|
|
100
|
+
this.validateExternalPermissionURLs('external.styles', (_w = manifest.typedContent.permissions.external) === null || _w === void 0 ? void 0 : _w.styles, manifest);
|
|
101
|
+
this.validateExternalPermissionURLs('external.media', (_x = manifest.typedContent.permissions.external) === null || _x === void 0 ? void 0 : _x.media, manifest);
|
|
102
|
+
this.validateExternalPermissionURLs('external.fonts', (_y = manifest.typedContent.permissions.external) === null || _y === void 0 ? void 0 : _y.fonts, manifest);
|
|
100
103
|
return {
|
|
101
|
-
success: validationErrors.length === 0,
|
|
102
|
-
errors: validationErrors
|
|
104
|
+
success: this.validationErrors.length === 0,
|
|
105
|
+
errors: this.validationErrors
|
|
103
106
|
};
|
|
104
107
|
}
|
|
105
108
|
}
|
|
@@ -3,7 +3,10 @@ import { ValidatorInterface } from './validator-interface';
|
|
|
3
3
|
import { ManifestSchema } from '../schema/manifest';
|
|
4
4
|
export interface MappingEntry {
|
|
5
5
|
productEvent: string;
|
|
6
|
-
oAuthScopes:
|
|
6
|
+
oAuthScopes: {
|
|
7
|
+
current: string[];
|
|
8
|
+
deprecated?: string[];
|
|
9
|
+
};
|
|
7
10
|
}
|
|
8
11
|
export interface MappingConfig {
|
|
9
12
|
mapping: MappingEntry[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-trigger-scopes-validator.d.ts","sourceRoot":"","sources":["../../src/validators/product-trigger-scopes-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"product-trigger-scopes-validator.d.ts","sourceRoot":"","sources":["../../src/validators/product-trigger-scopes-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE;QACX,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,qBAAa,6BAA6B,CAAC,CAAC,CAC1C,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAElD,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,wBAAwB,CAAC,cAAc,CAAC;CAsEzG"}
|
|
@@ -16,9 +16,9 @@ class ProductTriggerScopesValidator {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
const validationErrors = [];
|
|
19
|
-
const
|
|
19
|
+
const getRequiredScopes = (productEvent, status) => {
|
|
20
20
|
var _a;
|
|
21
|
-
return (
|
|
21
|
+
return (_a = this.config.mapping.find((value) => value.productEvent == productEvent)) === null || _a === void 0 ? void 0 : _a.oAuthScopes[status];
|
|
22
22
|
};
|
|
23
23
|
const addValidationError = (scope, event) => {
|
|
24
24
|
validationErrors.push(Object.assign({ message: text_1.errors.permissions.missingPermissionFromScope(scope, event), reference: text_1.References.MissingScopes, level: 'error', metadata: {
|
|
@@ -33,11 +33,27 @@ class ProductTriggerScopesValidator {
|
|
|
33
33
|
}
|
|
34
34
|
const manifestScopes = ((_a = manifest.typedContent.permissions) === null || _a === void 0 ? void 0 : _a.scopes) || [];
|
|
35
35
|
manifest.typedContent.modules.trigger.forEach((element) => {
|
|
36
|
-
element.events
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
for (const event of element.events) {
|
|
37
|
+
const currentScopes = getRequiredScopes(event, 'current');
|
|
38
|
+
if (!currentScopes)
|
|
39
|
+
continue;
|
|
40
|
+
const missingCurrentScopes = currentScopes.filter((scope) => !manifestScopes.includes(scope));
|
|
41
|
+
if (missingCurrentScopes.length === 0)
|
|
42
|
+
continue;
|
|
43
|
+
const deprecatedScopes = getRequiredScopes(event, 'deprecated');
|
|
44
|
+
const missingDeprecatedScopes = deprecatedScopes === null || deprecatedScopes === void 0 ? void 0 : deprecatedScopes.filter((scope) => !manifestScopes.includes(scope));
|
|
45
|
+
if ((missingDeprecatedScopes === null || missingDeprecatedScopes === void 0 ? void 0 : missingDeprecatedScopes.length) === 0)
|
|
46
|
+
continue;
|
|
47
|
+
if (missingCurrentScopes.length < currentScopes.length) {
|
|
48
|
+
missingCurrentScopes.forEach((scope) => addValidationError(scope, event));
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (missingDeprecatedScopes && deprecatedScopes && missingDeprecatedScopes.length < deprecatedScopes.length) {
|
|
52
|
+
missingDeprecatedScopes.forEach((scope) => addValidationError(scope, event));
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
missingCurrentScopes.forEach((scope) => addValidationError(scope, event));
|
|
56
|
+
}
|
|
41
57
|
});
|
|
42
58
|
return {
|
|
43
59
|
success: validationErrors.length === 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/manifest",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-c3d0263",
|
|
4
4
|
"description": "Definitions and validations of the Forge manifest",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"author": "Atlassian",
|
|
24
24
|
"license": "UNLICENSED",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@forge/util": "
|
|
26
|
+
"@forge/util": "0.0.0-experimental-c3d0263",
|
|
27
27
|
"ajv": "^6.12.5",
|
|
28
28
|
"cheerio": "^0.22.0",
|
|
29
29
|
"js-yaml": "^3.13.1",
|
|
30
30
|
"json-schema-to-typescript": "^9.1.1",
|
|
31
|
-
"node-fetch": "
|
|
31
|
+
"node-fetch": "2.6.1",
|
|
32
32
|
"typescript-json-schema": "^0.45.1"
|
|
33
33
|
}
|
|
34
34
|
}
|