@forge/lint 5.10.0-next.8 → 5.10.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 +106 -0
- package/out/lint/linters/permission-linter/verifiers/image-url-verifier.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/verifiers/image-url-verifier.js +2 -1
- package/out/lint/linters/permission-linter/verifiers/product-verifier.d.ts +1 -1
- package/out/lint/linters/permission-linter/verifiers/product-verifier.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts +1 -0
- package/out/lint/linters/permission-linter/visitors/image-url-visitor.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/visitors/image-url-visitor.js +31 -14
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,111 @@
|
|
|
1
1
|
# @forge/lint
|
|
2
2
|
|
|
3
|
+
## 5.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0402460: Upgraded archiver from 6.0.2 to 7.0.1, moved atlassian-openapi to @atlassian/atlassian-openapi, bumped get-folder-size from 2.0.1 to 5.0.0
|
|
8
|
+
- e002ecd: Added checking for image strings in conditionals
|
|
9
|
+
- cfde21e: Add CSP Urls for IC environment
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a26c603: revert package upgrades
|
|
14
|
+
- Updated dependencies [0402460]
|
|
15
|
+
- Updated dependencies [8d843ca]
|
|
16
|
+
- Updated dependencies [cfde21e]
|
|
17
|
+
- Updated dependencies [4623865]
|
|
18
|
+
- Updated dependencies [5144b15]
|
|
19
|
+
- Updated dependencies [5069c3c]
|
|
20
|
+
- Updated dependencies [e118b07]
|
|
21
|
+
- Updated dependencies [a26c603]
|
|
22
|
+
- Updated dependencies [8e9a8b5]
|
|
23
|
+
- Updated dependencies [73f3108]
|
|
24
|
+
- Updated dependencies [d544fc6]
|
|
25
|
+
- Updated dependencies [5bfa872]
|
|
26
|
+
- Updated dependencies [13e5daa]
|
|
27
|
+
- Updated dependencies [e029de1]
|
|
28
|
+
- Updated dependencies [426dfe1]
|
|
29
|
+
- @forge/cli-shared@8.2.0
|
|
30
|
+
- @forge/csp@4.2.0
|
|
31
|
+
- @forge/manifest@10.2.0
|
|
32
|
+
|
|
33
|
+
## 5.10.0-next.16
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- e002ecd: Added checking for image strings in conditionals
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [5bfa872]
|
|
42
|
+
- @forge/manifest@10.2.0-next.5
|
|
43
|
+
- @forge/cli-shared@8.2.0-next.16
|
|
44
|
+
|
|
45
|
+
## 5.10.0-next.15
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [5144b15]
|
|
50
|
+
- @forge/manifest@10.2.0-next.4
|
|
51
|
+
- @forge/cli-shared@8.2.0-next.15
|
|
52
|
+
|
|
53
|
+
## 5.10.0-next.14
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [13e5daa]
|
|
58
|
+
- @forge/manifest@10.1.1-next.3
|
|
59
|
+
- @forge/cli-shared@8.2.0-next.14
|
|
60
|
+
|
|
61
|
+
## 5.10.0-next.13
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies [4623865]
|
|
66
|
+
- @forge/cli-shared@8.2.0-next.13
|
|
67
|
+
|
|
68
|
+
## 5.10.0-next.12
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- Updated dependencies [8d843ca]
|
|
73
|
+
- @forge/cli-shared@8.2.0-next.12
|
|
74
|
+
|
|
75
|
+
## 5.10.0-next.11
|
|
76
|
+
|
|
77
|
+
### Minor Changes
|
|
78
|
+
|
|
79
|
+
- 0402460: Upgraded archiver from 6.0.2 to 7.0.1, moved atlassian-openapi to @atlassian/atlassian-openapi, bumped get-folder-size from 2.0.1 to 5.0.0
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [0402460]
|
|
84
|
+
- @forge/cli-shared@8.2.0-next.11
|
|
85
|
+
|
|
86
|
+
## 5.10.0-next.10
|
|
87
|
+
|
|
88
|
+
### Minor Changes
|
|
89
|
+
|
|
90
|
+
- cfde21e: Add CSP Urls for IC environment
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- Updated dependencies [cfde21e]
|
|
95
|
+
- @forge/cli-shared@8.2.0-next.10
|
|
96
|
+
- @forge/csp@4.2.0-next.0
|
|
97
|
+
|
|
98
|
+
## 5.10.0-next.9
|
|
99
|
+
|
|
100
|
+
### Minor Changes
|
|
101
|
+
|
|
102
|
+
- 0402460: Upgraded archiver from 6.0.2 to 7.0.1, moved atlassian-openapi to @atlassian/atlassian-openapi, bumped get-folder-size from 2.0.1 to 5.0.0
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- Updated dependencies [0402460]
|
|
107
|
+
- @forge/cli-shared@8.2.0-next.9
|
|
108
|
+
|
|
3
109
|
## 5.10.0-next.8
|
|
4
110
|
|
|
5
111
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-url-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/image-url-verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAiBjD,qBAAa,gBAAiB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IAClG,OAAO,CAAC,sBAAsB,CAAyB;gBAE3C,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"image-url-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/image-url-verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAiBjD,qBAAa,gBAAiB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IAClG,OAAO,CAAC,sBAAsB,CAAyB;gBAE3C,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAoBnD,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAcvE"}
|
|
@@ -31,9 +31,10 @@ class ImageUrlVerifier extends verifier_interface_1.BaseLintIssueVerifier {
|
|
|
31
31
|
const allowList = (this.manifest?.permissions?.external?.images ?? [])
|
|
32
32
|
.map((item) => (typeof item === 'object' && 'address' in item ? item.address : item))
|
|
33
33
|
.filter((item) => typeof item === 'string');
|
|
34
|
+
const icOptions = { icLabel: '*', serviceName: 'forge-cdn' };
|
|
34
35
|
const collectedUrls = [
|
|
35
36
|
...allowList,
|
|
36
|
-
...csp_1.
|
|
37
|
+
...(0, csp_1.getAtlassianImageHost)(microsEnv, icOptions),
|
|
37
38
|
...csp_1.EXTERNAL_ALLOW_LISTED_IMAGES_HOSTS
|
|
38
39
|
].filter((item) => typeof item === 'string');
|
|
39
40
|
this.egressFilteringService = new egress_1.EgressFilteringService(collectedUrls);
|
|
@@ -2,7 +2,7 @@ import { LintResultRule, LintClass } from '../../../linter-interface';
|
|
|
2
2
|
import { ApiCall, ProductApiCall } from '../api-call-interface';
|
|
3
3
|
import { LintIssueVerifier, BaseLintIssueVerifier } from '../../verifier-interface';
|
|
4
4
|
import { ManifestSchema as Manifest } from '@forge/manifest';
|
|
5
|
-
import { Swagger } from 'atlassian-openapi';
|
|
5
|
+
import { Swagger } from '@atlassian/atlassian-openapi';
|
|
6
6
|
import OAuth2ScopesWithState = Swagger.OAuth2ScopesWithState;
|
|
7
7
|
export interface ProductMethod {
|
|
8
8
|
originalPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/product-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGpF,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAoB,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"product-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/product-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAG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AsC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAA0B,MAAM,uBAAuB,CAAC;AAExE,qBAAa,eAAgB,YAAW,WAAW,CAAC,OAAO,CAAC;IAC1D,MAAM,CAAC,kBAAkB,SAAyB;IAE3C,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"image-url-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/visitors/image-url-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAA0B,MAAM,uBAAuB,CAAC;AAExE,qBAAa,eAAgB,YAAW,WAAW,CAAC,OAAO,CAAC;IAC1D,MAAM,CAAC,kBAAkB,SAAyB;IAE3C,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAmCjH,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,mBAAmB;CAkB5B"}
|
|
@@ -11,20 +11,23 @@ class ImageUrlVisitor {
|
|
|
11
11
|
return undefined;
|
|
12
12
|
}
|
|
13
13
|
if (imageUrlNode?.type === typescript_estree_1.AST_NODE_TYPES.JSXAttribute) {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
const imageUrlNodeAttribute = imageUrlNode.value;
|
|
15
|
+
if (!imageUrlNodeAttribute)
|
|
16
|
+
return;
|
|
17
|
+
this.addUrlToLintingList(imageUrlNodeAttribute, imageUrlNodeAttribute, callback);
|
|
18
|
+
if (imageUrlNodeAttribute.type === typescript_estree_1.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
19
|
+
const imageUlrNodeAttributeExpression = imageUrlNodeAttribute.expression;
|
|
20
|
+
if (imageUlrNodeAttributeExpression.type === typescript_estree_1.AST_NODE_TYPES.ConditionalExpression) {
|
|
21
|
+
const consequentExpression = imageUlrNodeAttributeExpression.consequent;
|
|
22
|
+
this.addUrlToLintingList(consequentExpression, imageUrlNodeAttribute, callback);
|
|
23
|
+
const alternateExpression = imageUlrNodeAttributeExpression.alternate;
|
|
24
|
+
this.addUrlToLintingList(alternateExpression, imageUrlNodeAttribute, callback);
|
|
25
|
+
}
|
|
26
|
+
if (imageUlrNodeAttributeExpression.type === typescript_estree_1.AST_NODE_TYPES.LogicalExpression) {
|
|
27
|
+
const leftExpression = imageUlrNodeAttributeExpression.left;
|
|
28
|
+
this.addUrlToLintingList(leftExpression, imageUrlNodeAttribute, callback);
|
|
29
|
+
const rightExpression = imageUlrNodeAttributeExpression.right;
|
|
30
|
+
this.addUrlToLintingList(rightExpression, imageUrlNodeAttribute, callback);
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
}
|
|
@@ -53,5 +56,19 @@ class ImageUrlVisitor {
|
|
|
53
56
|
isAbsoluteUrl(url) {
|
|
54
57
|
return ImageUrlVisitor.ABSOLUTE_URL_REGEX.test(url);
|
|
55
58
|
}
|
|
59
|
+
addUrlToLintingList(expression, imageUrlAttribute, callback) {
|
|
60
|
+
if (expression && expression.type === typescript_estree_1.AST_NODE_TYPES.Literal && typeof expression.value === 'string') {
|
|
61
|
+
const url = expression.value;
|
|
62
|
+
if (url.trim() !== '' && !this.isBundledUri(url) && this.isAbsoluteUrl(url)) {
|
|
63
|
+
const imageUrl = {
|
|
64
|
+
type: api_call_interface_1.ApiCallTypes.IMAGE,
|
|
65
|
+
url: url,
|
|
66
|
+
line: imageUrlAttribute.loc.start.line,
|
|
67
|
+
column: imageUrlAttribute.loc.start.column
|
|
68
|
+
};
|
|
69
|
+
callback(imageUrl);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
56
73
|
}
|
|
57
74
|
exports.ImageUrlVisitor = ImageUrlVisitor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/lint",
|
|
3
|
-
"version": "5.10.0
|
|
3
|
+
"version": "5.10.0",
|
|
4
4
|
"description": "Linting for forge apps",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@atlassian/xen-test-util": "^4.2.0",
|
|
14
|
-
"@forge/api": "^6.0.2
|
|
14
|
+
"@forge/api": "^6.0.2",
|
|
15
15
|
"@types/array.prototype.flatmap": "^1.2.6",
|
|
16
16
|
"@types/cross-spawn": "^6.0.6",
|
|
17
17
|
"@types/eslint": "8.56.12",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"eslint-plugin-import": "^2.29.1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@forge/cli-shared": "8.2.0
|
|
23
|
-
"@forge/csp": "4.
|
|
22
|
+
"@forge/cli-shared": "8.2.0",
|
|
23
|
+
"@forge/csp": "4.2.0",
|
|
24
24
|
"@forge/egress": "2.0.1",
|
|
25
|
-
"@forge/manifest": "10.
|
|
25
|
+
"@forge/manifest": "10.2.0",
|
|
26
26
|
"@typescript-eslint/typescript-estree": "^5.62.0",
|
|
27
27
|
"array.prototype.flatmap": "^1.3.3",
|
|
28
|
-
"atlassian-openapi": "^1.0.
|
|
28
|
+
"@atlassian/atlassian-openapi": "^1.0.6",
|
|
29
29
|
"cross-spawn": "^7.0.6",
|
|
30
30
|
"node-fetch": "2.7.0"
|
|
31
31
|
},
|