@forge/lint 5.9.2-next.1 → 5.10.0-experimental-a6c1d53

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,5 +1,176 @@
1
1
  # @forge/lint
2
2
 
3
+ ## 5.10.0-experimental-a6c1d53
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [aebd633]
8
+ - Updated dependencies [abf0bb1]
9
+ - @forge/csp@4.2.0-experimental-a6c1d53
10
+
11
+ ## 5.10.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 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
16
+ - e002ecd: Added checking for image strings in conditionals
17
+ - cfde21e: Add CSP Urls for IC environment
18
+
19
+ ### Patch Changes
20
+
21
+ - a26c603: revert package upgrades
22
+ - Updated dependencies [0402460]
23
+ - Updated dependencies [8d843ca]
24
+ - Updated dependencies [cfde21e]
25
+ - Updated dependencies [4623865]
26
+ - Updated dependencies [5144b15]
27
+ - Updated dependencies [5069c3c]
28
+ - Updated dependencies [e118b07]
29
+ - Updated dependencies [a26c603]
30
+ - Updated dependencies [8e9a8b5]
31
+ - Updated dependencies [73f3108]
32
+ - Updated dependencies [d544fc6]
33
+ - Updated dependencies [5bfa872]
34
+ - Updated dependencies [13e5daa]
35
+ - Updated dependencies [e029de1]
36
+ - Updated dependencies [426dfe1]
37
+ - @forge/cli-shared@8.2.0
38
+ - @forge/csp@4.2.0
39
+ - @forge/manifest@10.2.0
40
+
41
+ ## 5.10.0-next.16
42
+
43
+ ### Minor Changes
44
+
45
+ - e002ecd: Added checking for image strings in conditionals
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [5bfa872]
50
+ - @forge/manifest@10.2.0-next.5
51
+ - @forge/cli-shared@8.2.0-next.16
52
+
53
+ ## 5.10.0-next.15
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [5144b15]
58
+ - @forge/manifest@10.2.0-next.4
59
+ - @forge/cli-shared@8.2.0-next.15
60
+
61
+ ## 5.10.0-next.14
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [13e5daa]
66
+ - @forge/manifest@10.1.1-next.3
67
+ - @forge/cli-shared@8.2.0-next.14
68
+
69
+ ## 5.10.0-next.13
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [4623865]
74
+ - @forge/cli-shared@8.2.0-next.13
75
+
76
+ ## 5.10.0-next.12
77
+
78
+ ### Patch Changes
79
+
80
+ - Updated dependencies [8d843ca]
81
+ - @forge/cli-shared@8.2.0-next.12
82
+
83
+ ## 5.10.0-next.11
84
+
85
+ ### Minor Changes
86
+
87
+ - 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
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies [0402460]
92
+ - @forge/cli-shared@8.2.0-next.11
93
+
94
+ ## 5.10.0-next.10
95
+
96
+ ### Minor Changes
97
+
98
+ - cfde21e: Add CSP Urls for IC environment
99
+
100
+ ### Patch Changes
101
+
102
+ - Updated dependencies [cfde21e]
103
+ - @forge/cli-shared@8.2.0-next.10
104
+ - @forge/csp@4.2.0-next.0
105
+
106
+ ## 5.10.0-next.9
107
+
108
+ ### Minor Changes
109
+
110
+ - 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
111
+
112
+ ### Patch Changes
113
+
114
+ - Updated dependencies [0402460]
115
+ - @forge/cli-shared@8.2.0-next.9
116
+
117
+ ## 5.10.0-next.8
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies [8e9a8b5]
122
+ - Updated dependencies [426dfe1]
123
+ - @forge/cli-shared@8.2.0-next.8
124
+ - @forge/manifest@10.1.1-next.2
125
+
126
+ ## 5.10.0-next.7
127
+
128
+ ### Patch Changes
129
+
130
+ - Updated dependencies [5069c3c]
131
+ - @forge/manifest@10.1.1-next.1
132
+ - @forge/cli-shared@8.2.0-next.7
133
+
134
+ ## 5.10.0-next.6
135
+
136
+ ### Patch Changes
137
+
138
+ - Updated dependencies [e118b07]
139
+ - @forge/cli-shared@8.2.0-next.6
140
+
141
+ ## 5.10.0-next.5
142
+
143
+ ### Patch Changes
144
+
145
+ - Updated dependencies [d544fc6]
146
+ - @forge/cli-shared@8.2.0-next.5
147
+
148
+ ## 5.10.0-next.4
149
+
150
+ ### Patch Changes
151
+
152
+ - Updated dependencies [73f3108]
153
+ - @forge/cli-shared@8.2.0-next.4
154
+
155
+ ## 5.10.0-next.3
156
+
157
+ ### Patch Changes
158
+
159
+ - a26c603: revert package upgrades
160
+ - Updated dependencies [a26c603]
161
+ - @forge/cli-shared@8.2.0-next.3
162
+
163
+ ## 5.10.0-next.2
164
+
165
+ ### Minor Changes
166
+
167
+ - 05d33ea: 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
168
+
169
+ ### Patch Changes
170
+
171
+ - Updated dependencies [05d33ea]
172
+ - @forge/cli-shared@8.2.0-next.2
173
+
3
174
  ## 5.9.2-next.1
4
175
 
5
176
  ### 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;IAkBnD,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAcvE"}
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.ATLASSIAN_IMAGES_HOSTS[microsEnv],
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,mBAAmB,CAAC;AAC5C,OAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,QAAQ,EAAE,aAAa,EAAE,CAAC;QAC1B,2BAA2B,CAAC,EAAE,qBAAqB,EAAE,CAAC;KACvD,CAAC;CACH;AAED,UAAU,aAAa;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC9B;AAED,oBAAY,uBAAuB,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAEjE,qBAAa,eAAgB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,OAAO,EAAE,CAAC;IAI9F,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAHxB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,EACD,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,MAAM;IAKlC,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAuC3E,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,0BAA0B;IAOlC,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,aAAa;CAWtB"}
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,8BAA8B,CAAC;AACvD,OAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,QAAQ,EAAE,aAAa,EAAE,CAAC;QAC1B,2BAA2B,CAAC,EAAE,qBAAqB,EAAE,CAAC;KACvD,CAAC;CACH;AAED,UAAU,aAAa;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC9B;AAED,oBAAY,uBAAuB,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAEjE,qBAAa,eAAgB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,OAAO,EAAE,CAAC;IAI9F,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAHxB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,EACD,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,MAAM;IAKlC,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAuC3E,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,0BAA0B;IAOlC,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,aAAa;CAWtB"}
@@ -7,5 +7,6 @@ export declare class ImageUrlVisitor implements NodeVisitor<ApiCall> {
7
7
  private getImageUrlNode;
8
8
  private isBundledUri;
9
9
  private isAbsoluteUrl;
10
+ private addUrlToLintingList;
10
11
  }
11
12
  //# sourceMappingURL=image-url-visitor.d.ts.map
@@ -1 +1 @@
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;IAgCjH,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,aAAa;CAGtB"}
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 imageUrlAttribute = imageUrlNode.value;
15
- if (imageUrlAttribute &&
16
- imageUrlAttribute.type === typescript_estree_1.AST_NODE_TYPES.Literal &&
17
- typeof imageUrlAttribute.value === 'string') {
18
- if (imageUrlAttribute.value.trim() !== '' &&
19
- !this.isBundledUri(imageUrlAttribute.value) &&
20
- this.isAbsoluteUrl(imageUrlAttribute.value)) {
21
- const imageUrl = {
22
- type: api_call_interface_1.ApiCallTypes.IMAGE,
23
- url: imageUrlAttribute.value,
24
- line: imageUrlAttribute.loc.start.line,
25
- column: imageUrlAttribute.loc.start.column
26
- };
27
- callback(imageUrl);
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.9.2-next.1",
3
+ "version": "5.10.0-experimental-a6c1d53",
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-next.0",
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.1.1-next.1",
23
- "@forge/csp": "4.1.0",
22
+ "@forge/cli-shared": "8.2.0",
23
+ "@forge/csp": "4.2.0-experimental-a6c1d53",
24
24
  "@forge/egress": "2.0.1",
25
- "@forge/manifest": "10.1.1-next.0",
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.21",
28
+ "@atlassian/atlassian-openapi": "^1.0.6",
29
29
  "cross-spawn": "^7.0.6",
30
30
  "node-fetch": "2.7.0"
31
31
  },