@forge/manifest 12.1.0-next.2-experimental-d997307 → 12.1.0-next.3-experimental-44a932f
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 +9 -1
- package/out/processor/full-validation-processor.d.ts.map +1 -1
- package/out/processor/full-validation-processor.js +2 -0
- package/out/text/errors.d.ts +2 -0
- package/out/text/errors.d.ts.map +1 -1
- package/out/text/errors.js +4 -0
- package/out/validators/permissions-validator.d.ts +1 -0
- package/out/validators/permissions-validator.d.ts.map +1 -1
- package/out/validators/permissions-validator.js +25 -0
- package/out/validators/twg-preview-scopes-validator.d.ts +7 -0
- package/out/validators/twg-preview-scopes-validator.d.ts.map +1 -0
- package/out/validators/twg-preview-scopes-validator.js +32 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
# @forge/manifest
|
|
2
2
|
|
|
3
|
-
## 12.1.0-next.
|
|
3
|
+
## 12.1.0-next.3-experimental-44a932f
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- e4c143c: Do not allow wildcard remote endpoints
|
|
8
|
+
- 42e069d: Add lint warning for backend fetch egress with path
|
|
8
9
|
- 19807bf: Changed schema for container resources
|
|
9
10
|
|
|
10
11
|
### Patch Changes
|
|
11
12
|
|
|
13
|
+
- 6247657: Add TWG preview scopes validator that warns when manifest contains Teamwork Graph scopes (read:graph:jira, read:graph:confluence)
|
|
12
14
|
- fa9b5aa: Update manifest definitions
|
|
13
15
|
|
|
16
|
+
## 12.1.0-next.3
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 42e069d: Add lint warning for backend fetch egress with path
|
|
21
|
+
|
|
14
22
|
## 12.1.0-next.2
|
|
15
23
|
|
|
16
24
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full-validation-processor.d.ts","sourceRoot":"","sources":["../../src/processor/full-validation-processor.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"full-validation-processor.d.ts","sourceRoot":"","sources":["../../src/processor/full-validation-processor.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUpD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,qBAAa,uBAAwB,SAAQ,2BAA2B,CAAC,cAAc,CAAC;gBAC1E,WAAW,EAAE,WAAW;CA6BrC"}
|
|
@@ -14,6 +14,7 @@ const remotes_is_configurable_validator_1 = require("../validators/remotes-is-co
|
|
|
14
14
|
const remote_regions_validator_1 = require("../validators/remote-regions-validator");
|
|
15
15
|
const remote_auth_scopes_validator_1 = require("../validators/remote-auth-scopes-validator");
|
|
16
16
|
const runtime_version_validator_1 = require("../validators/runtime-version-validator");
|
|
17
|
+
const twg_preview_scopes_validator_1 = require("../validators/twg-preview-scopes-validator");
|
|
17
18
|
const llm_validator_1 = require("../validators/llm-validator");
|
|
18
19
|
class FullValidationProcessor extends abstract_validation_processor_1.AbstractValidationProcessor {
|
|
19
20
|
constructor(lintOptions) {
|
|
@@ -40,6 +41,7 @@ class FullValidationProcessor extends abstract_validation_processor_1.AbstractVa
|
|
|
40
41
|
new remote_regions_validator_1.RemoteRegionsValidator(),
|
|
41
42
|
new remote_auth_scopes_validator_1.RemoteAuthScopesValidator(),
|
|
42
43
|
new runtime_version_validator_1.RuntimeVersionValidator(lintOptions),
|
|
44
|
+
new twg_preview_scopes_validator_1.TwgPreviewScopesValidator(),
|
|
43
45
|
new llm_validator_1.LLMValidator(),
|
|
44
46
|
new validators_1.CompatibilityValidator()
|
|
45
47
|
]);
|
package/out/text/errors.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type ForgeSupportedLocaleCode } from '../schema/manifest';
|
|
|
2
2
|
import { AllModuleTypes } from '../types';
|
|
3
3
|
export declare const errors: {
|
|
4
4
|
invalidManifest: (reason: string) => string;
|
|
5
|
+
twgPreviewScopes: (scopes: string[]) => string;
|
|
5
6
|
missingManifest: () => string;
|
|
6
7
|
schemaError: (value: string | undefined, path: string[], reason: string | undefined) => string;
|
|
7
8
|
schema: {
|
|
@@ -26,6 +27,7 @@ export declare const errors: {
|
|
|
26
27
|
globalUrlNotRecommended: (element: string) => string;
|
|
27
28
|
imageUrlNotRecommended: (element: string, value: string) => string;
|
|
28
29
|
fontAndStylesNotRecommended: (element: string) => string;
|
|
30
|
+
backendEgressPathIgnored: (url: string) => string;
|
|
29
31
|
malformedScope: (index: number) => string;
|
|
30
32
|
};
|
|
31
33
|
connectModules: {
|
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":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,eAAO,MAAM,MAAM;8BACS,MAAM,KAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/text/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,eAAO,MAAM,MAAM;8BACS,MAAM,KAAG,MAAM;+BACd,MAAM,EAAE,KAAG,MAAM;2BAIvB,MAAM;yBAEN,MAAM,GAAG,SAAS,QAAQ,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,KAAG,MAAM;;uBAO3E,MAAM,EAAE,EAAE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,MAAM,KAAG,MAAM;qCAEnB,MAAM;;6CAGA,MAAM;;;mDAIE,MAAM,KAAG,MAAM;iDAEnB,MAAM;;;;4CAKX,MAAM,SAAS,MAAM,KAAG,MAAM;4CAE9B,MAAM,KAAG,MAAM;4CACf,MAAM,SAAS,MAAM,KAAG,MAAM;+CAE3B,MAAM,aAAa,MAAM,SAAS,MAAM,KAAG,MAAM;yCAEvD,MAAM,SAAS,MAAM,KAAG,MAAM;4CAE3B,MAAM,SAAS,MAAM,KAAG,MAAM;gDAE1B,MAAM,aAAa,MAAM,KAAG,MAAM;4CAEtC,MAAM,SAAS,MAAM,KAAG,MAAM;;;;;gCAM1C,MAAM;;;;;;;;;0DAWwB,wBAAwB,KAAG,MAAM;sDAErC,wBAAwB,KAAG,MAAM;kDAErC,wBAAwB,QAAQ,MAAM,KAAG,MAAM;mDAE9C,wBAAwB,KAAG,MAAM;mCAEjD,MAAM,KAAG,MAAM;;oDAEE,MAAM,aAAa,MAAM,KAAG,MAAM;4CAE1C,MAAM,sBAAsB,wBAAwB,YAAY,MAAM;;;;mCAKjF,MAAM;;;CAQlC,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,SAAS,4BAA4B;IACrC,SAAS,4BAA4B;IACrC,UAAU,wBAAwB;IAClC,GAAG,8BAA8B;CAClC"}
|
package/out/text/errors.js
CHANGED
|
@@ -5,6 +5,9 @@ const types_1 = require("../types");
|
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
exports.errors = {
|
|
7
7
|
invalidManifest: (reason) => `manifest.yml failed to parse content - ${reason}`,
|
|
8
|
+
twgPreviewScopes: (scopes) => `This app requests Teamwork Graph scopes (${scopes.join(', ')}), which grant org-wide read access ` +
|
|
9
|
+
`across Jira, Confluence, Compass, JSM, Teams, Goals, Projects, and users. ` +
|
|
10
|
+
`End-user permissions are respected, but access is not limited to a single site or product.`,
|
|
8
11
|
missingManifest: () => `To run this command, make sure you're in the top-level directory of your app, and the manifest.yml file is in the same directory.`,
|
|
9
12
|
schemaError: (value, path, reason) => {
|
|
10
13
|
if (value) {
|
|
@@ -38,6 +41,7 @@ exports.errors = {
|
|
|
38
41
|
globalUrlNotRecommended: (element) => `Global URL usage detected for '${element}' permission in the manifest.yml file. We recommend using a more specific URL.`,
|
|
39
42
|
imageUrlNotRecommended: (element, value) => `Unnecessary URL detected for '${element}' permission in the manifest.yml file. Your app should not need the URL '${value}' to work properly.`,
|
|
40
43
|
fontAndStylesNotRecommended: (element) => `Unnecessary usage of '${element}' permission in the manifest.yml file. You can avoid using this permission by packaging the fonts and styles with your app code.`,
|
|
44
|
+
backendEgressPathIgnored: (url) => `Detected a backend egress URL with a path in manifest.yml: '${url}'. Currently, backend egress only validates domains, so the path is ignored.`,
|
|
41
45
|
malformedScope: (index) => `The scope definition at index '${index}' is malformed. Use either a string with the scope key, or an object with the scope key as the only key`
|
|
42
46
|
},
|
|
43
47
|
connectModules: {
|
|
@@ -6,6 +6,7 @@ export declare class PermissionsValidator implements ValidatorInterface<Manifest
|
|
|
6
6
|
private remotesHasValidEntryForKey;
|
|
7
7
|
private isValidURL;
|
|
8
8
|
private isValidHash;
|
|
9
|
+
private hasPathComponent;
|
|
9
10
|
private addValidationErrors;
|
|
10
11
|
private validateExternalPermissionURLs;
|
|
11
12
|
validate(manifest: ManifestObject<ManifestSchema> | undefined): Promise<ManifestValidationResult<ManifestSchema>>;
|
|
@@ -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;AAQ3D,eAAO,MAAM,kBAAkB,UAa9B,CAAC;AAEF,qBAAa,oBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEzF,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,UAAU;IAwClB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,8BAA8B;
|
|
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;AAQ3D,eAAO,MAAM,kBAAkB,UAa9B,CAAC;AAEF,qBAAa,oBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEzF,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,UAAU;IAwClB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,8BAA8B;IA2DhC,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CAkNrD"}
|
|
@@ -70,6 +70,18 @@ class PermissionsValidator {
|
|
|
70
70
|
];
|
|
71
71
|
return BASE_64_HASH_PATTERNS.some((pattern) => pattern.test(cspString));
|
|
72
72
|
}
|
|
73
|
+
hasPathComponent(url) {
|
|
74
|
+
try {
|
|
75
|
+
const protocolRegex = /^(.*?:\/\/)/;
|
|
76
|
+
const urlWithProtocol = protocolRegex.test(url) ? url : `https://${url}`;
|
|
77
|
+
const parsedUrl = new url_1.URL(urlWithProtocol);
|
|
78
|
+
const pathname = parsedUrl.pathname;
|
|
79
|
+
return pathname.length > 0 && pathname !== '/';
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
73
85
|
addValidationErrors(result, element, values, manifest) {
|
|
74
86
|
values.forEach((value) => {
|
|
75
87
|
result.push({
|
|
@@ -115,6 +127,19 @@ class PermissionsValidator {
|
|
|
115
127
|
});
|
|
116
128
|
}
|
|
117
129
|
}
|
|
130
|
+
if (extPermType === 'external.fetch.backend') {
|
|
131
|
+
const urlsWithPaths = perms?.filter((key) => this.hasPathComponent(key));
|
|
132
|
+
if (urlsWithPaths?.length) {
|
|
133
|
+
urlsWithPaths.forEach((url) => {
|
|
134
|
+
result.push({
|
|
135
|
+
message: text_1.errors.permissions.backendEgressPathIgnored(url),
|
|
136
|
+
reference: text_1.References.Permissions,
|
|
137
|
+
level: 'warning',
|
|
138
|
+
...(0, utils_1.findPosition)(url, manifest.yamlContentByLine)
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
118
143
|
}
|
|
119
144
|
async validate(manifest) {
|
|
120
145
|
if (!manifest || !manifest.typedContent || !manifest.typedContent.permissions) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ValidatorInterface } from './validator-interface';
|
|
2
|
+
import { ManifestObject, ManifestValidationResult } from '../types';
|
|
3
|
+
import { ManifestSchema } from '../schema/manifest';
|
|
4
|
+
export declare class TwgPreviewScopesValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
|
|
5
|
+
validate(manifest: ManifestObject<ManifestSchema> | undefined): Promise<ManifestValidationResult<ManifestSchema>>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=twg-preview-scopes-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twg-preview-scopes-validator.d.ts","sourceRoot":"","sources":["../../src/validators/twg-preview-scopes-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAepD,qBAAa,yBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEnF,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CAyBrD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TwgPreviewScopesValidator = void 0;
|
|
4
|
+
const text_1 = require("../text");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const scopes_1 = require("../utils/scopes");
|
|
7
|
+
const TWG_PREVIEW_SCOPES = ['read:graph:jira', 'read:graph:confluence'];
|
|
8
|
+
class TwgPreviewScopesValidator {
|
|
9
|
+
async validate(manifest) {
|
|
10
|
+
if (!manifest?.typedContent?.permissions?.scopes) {
|
|
11
|
+
return { success: true, manifestObject: manifest };
|
|
12
|
+
}
|
|
13
|
+
const manifestScopes = (0, scopes_1.getAllScopeKeys)(manifest.typedContent.permissions.scopes);
|
|
14
|
+
const foundTwgScopes = manifestScopes.filter((scope) => TWG_PREVIEW_SCOPES.includes(scope));
|
|
15
|
+
if (foundTwgScopes.length > 0) {
|
|
16
|
+
return {
|
|
17
|
+
success: true,
|
|
18
|
+
manifestObject: manifest,
|
|
19
|
+
errors: [
|
|
20
|
+
{
|
|
21
|
+
message: text_1.errors.twgPreviewScopes(foundTwgScopes),
|
|
22
|
+
reference: text_1.References.Deprecated,
|
|
23
|
+
level: 'warning',
|
|
24
|
+
...(0, utils_1.findPosition)('scopes', manifest?.yamlContentByLine)
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return { success: true, manifestObject: manifest };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.TwgPreviewScopesValidator = TwgPreviewScopesValidator;
|
package/package.json
CHANGED