@forge/lint 0.0.0-experimental-d8cea00 → 0.0.0-experimental-64caa5a

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,16 +1,478 @@
1
1
  # @forge/lint
2
2
 
3
- ## 0.0.0-experimental-d8cea00
3
+ ## 0.0.0-experimental-64caa5a
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [0fe60df]
7
+ - c156c18: Reverting ui-hooks changes for Granular scopes since the release date is delayed by 2 weeks
8
+ - 69e25c2: Required permissions scope linter should read from the x-atlassian-oauth2-scopes. If it is not present then read from the security OAuth2 field. Combining Product DACIs https://hello.atlassian.net/wiki/spaces/redfox/pages/1046875420/RFC+OAuth+scopes+deprecation+in+Jira+-+DAC and https://hello.atlassian.net/wiki/spaces/redfox/pages/1304762888/OpenAPI+-+DAC+contract.
9
+ - Updated dependencies [bd6e025]
10
+ - Updated dependencies [a0a2c5b]
11
+ - Updated dependencies [22a488e]
12
+ - Updated dependencies [62089be]
13
+ - Updated dependencies [f4c23d3]
14
+ - Updated dependencies [5bf2ff0]
15
+ - Updated dependencies [04e4152]
16
+ - Updated dependencies [2338be5]
17
+ - Updated dependencies [689c09b]
18
+ - Updated dependencies [b97660c]
19
+ - Updated dependencies [7c0d2ee]
20
+ - Updated dependencies [06209fc]
21
+ - Updated dependencies [d3afe01]
22
+ - Updated dependencies [dfe9dd8]
23
+ - Updated dependencies [91ea057]
24
+ - Updated dependencies [3010f0e]
25
+ - Updated dependencies [2b7c32b]
26
+ - Updated dependencies [92d081d]
27
+ - Updated dependencies [d3c8c8d]
28
+ - Updated dependencies [36c7c8f]
29
+ - Updated dependencies [d2f6992]
30
+ - Updated dependencies [a017696]
31
+ - Updated dependencies [0a7725f]
32
+ - Updated dependencies [af1473c]
33
+ - Updated dependencies [e4a14c7]
34
+ - Updated dependencies [2bb89c5]
35
+ - Updated dependencies [b63af27]
36
+ - Updated dependencies [0a39c43]
37
+ - @forge/manifest@0.0.0-experimental-64caa5a
38
+ - @forge/cli-shared@0.0.0-experimental-64caa5a
39
+ - @forge/csp@0.0.0-experimental-64caa5a
40
+
41
+ ## 2.0.0-next.18
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies [e4a14c7]
46
+ - Updated dependencies [b63af27]
47
+ - @forge/manifest@2.6.0-next.15
48
+ - @forge/cli-shared@2.2.0-next.16
49
+
50
+ ## 2.0.0-next.17
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [2b7c32b]
55
+ - @forge/manifest@2.6.0-next.14
56
+ - @forge/cli-shared@2.1.6-next.15
57
+
58
+ ## 2.0.0-next.16
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies [a0a2c5b]
63
+ - Updated dependencies [689c09b]
64
+ - Updated dependencies [92d081d]
65
+ - Updated dependencies [36c7c8f]
66
+ - @forge/manifest@2.6.0-next.13
67
+ - @forge/cli-shared@2.1.6-next.14
68
+
69
+ ## 2.0.0-next.15
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [62089be]
74
+ - @forge/manifest@2.6.0-next.12
75
+ - @forge/cli-shared@2.1.6-next.13
76
+
77
+ ## 2.0.0-next.14
78
+
79
+ ### Patch Changes
80
+
81
+ - c156c18: Reverting ui-hooks changes for Granular scopes since the release date is delayed by 2 weeks
82
+ - Updated dependencies [dfe9dd8]
83
+ - Updated dependencies [d3c8c8d]
84
+ - Updated dependencies [0a7725f]
85
+ - Updated dependencies [2bb89c5]
86
+ - @forge/manifest@2.6.0-next.11
87
+ - @forge/cli-shared@2.1.6-next.12
88
+
89
+ ## 2.0.0-next.13
90
+
91
+ ### Patch Changes
92
+
93
+ - Updated dependencies [bd6e025]
94
+ - Updated dependencies [d2f6992]
95
+ - @forge/manifest@2.6.0-next.10
96
+ - @forge/cli-shared@2.1.6-next.11
97
+
98
+ ## 2.0.0-next.12
99
+
100
+ ### Patch Changes
101
+
102
+ - Updated dependencies [22a488ec]
103
+ - @forge/manifest@2.6.0-next.9
104
+ - @forge/cli-shared@2.1.6-next.10
105
+
106
+ ## 2.0.0-next.11
107
+
108
+ ### Patch Changes
109
+
110
+ - Updated dependencies [c0e5696]
111
+ - Updated dependencies [7c0d2ee]
112
+ - @forge/manifest@2.6.0-next.8
113
+ - @forge/cli-shared@2.1.6-next.9
114
+
115
+ ## 2.0.0-next.10
116
+
117
+ ### Major Changes
118
+
119
+ - cdf001f: Update ui-hooks to use new granular scopes
120
+
121
+ ### Patch Changes
122
+
123
+ - Updated dependencies [d3afe01]
124
+ - @forge/manifest@2.6.0-next.7
125
+ - @forge/cli-shared@2.1.6-next.8
126
+
127
+ ## 1.6.1-next.9
128
+
129
+ ### Patch Changes
130
+
131
+ - Updated dependencies [cdd8645]
132
+ - Updated dependencies [b97660c]
133
+ - @forge/manifest@2.6.0-next.6
134
+ - @forge/cli-shared@2.1.6-next.7
135
+
136
+ ## 1.6.1-next.8
137
+
138
+ ### Patch Changes
139
+
140
+ - Updated dependencies [0a39c43]
141
+ - @forge/manifest@2.6.0-next.5
142
+ - @forge/cli-shared@2.1.6-next.6
143
+
144
+ ## 1.6.1-next.7
145
+
146
+ ### Patch Changes
147
+
148
+ - 69e25c2: Required permissions scope linter should read from the x-atlassian-oauth2-scopes. If it is not present then read from the security OAuth2 field. Combining Product DACIs https://hello.atlassian.net/wiki/spaces/redfox/pages/1046875420/RFC+OAuth+scopes+deprecation+in+Jira+-+DAC and https://hello.atlassian.net/wiki/spaces/redfox/pages/1304762888/OpenAPI+-+DAC+contract.
149
+
150
+ ## 1.6.1-next.6
151
+
152
+ ### Patch Changes
153
+
154
+ - Updated dependencies [91ea057]
155
+ - @forge/manifest@2.5.1-next.4
156
+ - @forge/cli-shared@2.1.6-next.5
157
+
158
+ ## 1.6.1-next.5
159
+
160
+ ### Patch Changes
161
+
162
+ - Updated dependencies [3010f0e]
163
+ - @forge/manifest@2.5.1-next.3
164
+ - @forge/cli-shared@2.1.6-next.4
165
+
166
+ ## 1.6.1-next.4
167
+
168
+ ### Patch Changes
169
+
170
+ - Updated dependencies [04e4152]
171
+ - @forge/csp@1.8.1-next.0
172
+
173
+ ## 1.6.1-next.3
174
+
175
+ ### Patch Changes
176
+
177
+ - Updated dependencies [a017696]
178
+ - @forge/manifest@2.5.1-next.2
179
+ - @forge/cli-shared@2.1.6-next.3
180
+
181
+ ## 1.6.1-next.2
182
+
183
+ ### Patch Changes
184
+
185
+ - Updated dependencies [af1473c]
186
+ - @forge/manifest@2.5.1-next.1
187
+ - @forge/cli-shared@2.1.6-next.2
188
+
189
+ ## 1.6.1-next.1
190
+
191
+ ### Patch Changes
192
+
193
+ - Updated dependencies [06209fc]
194
+ - @forge/manifest@2.5.1-next.0
195
+ - @forge/cli-shared@2.1.6-next.1
196
+
197
+ ## 1.6.1-next.0
198
+
199
+ ### Patch Changes
200
+
201
+ - Updated dependencies [2338be5]
202
+ - @forge/cli-shared@2.1.6-next.0
203
+
204
+ ## 1.6.0
205
+
206
+ ### Minor Changes
207
+
208
+ - 70e9c8c: Support linting external auth api calls.
209
+
210
+ ### Patch Changes
211
+
212
+ - fc38deb: Fix bug on the auto-fix permissions linter
213
+ - Updated dependencies [4de9850]
214
+ - Updated dependencies [70e9c8c]
215
+ - Updated dependencies [fde4ba7]
216
+ - Updated dependencies [601527b]
217
+ - Updated dependencies [755e35e]
218
+ - Updated dependencies [a5656f6]
219
+ - Updated dependencies [cc8799c]
220
+ - Updated dependencies [f5eb8e0]
221
+ - Updated dependencies [f013199]
222
+ - Updated dependencies [78d682f]
223
+ - Updated dependencies [70e9c8c]
224
+ - Updated dependencies [dec8066]
225
+ - Updated dependencies [0e82242]
226
+ - @forge/manifest@2.5.0
227
+ - @forge/cli-shared@2.1.5
228
+
229
+ ## 1.6.0-next.11
230
+
231
+ ### Patch Changes
232
+
233
+ - Updated dependencies [fde4ba7]
234
+ - @forge/manifest@2.5.0-next.10
235
+ - @forge/cli-shared@2.1.5-next.10
236
+
237
+ ## 1.6.0-next.10
238
+
239
+ ### Patch Changes
240
+
241
+ - Updated dependencies [601527b]
242
+ - @forge/manifest@2.5.0-next.9
243
+ - @forge/cli-shared@2.1.5-next.9
244
+
245
+ ## 1.6.0-next.9
246
+
247
+ ### Patch Changes
248
+
249
+ - Updated dependencies [a5656f6]
250
+ - Updated dependencies [78d682f]
251
+ - @forge/manifest@2.5.0-next.8
252
+ - @forge/cli-shared@2.1.5-next.8
253
+
254
+ ## 1.6.0-next.8
255
+
256
+ ### Patch Changes
257
+
258
+ - Updated dependencies [cc8799c]
259
+ - @forge/manifest@2.5.0-next.7
260
+ - @forge/cli-shared@2.1.5-next.7
261
+
262
+ ## 1.6.0-next.7
263
+
264
+ ### Patch Changes
265
+
266
+ - Updated dependencies [0e82242]
267
+ - @forge/manifest@2.5.0-next.6
268
+ - @forge/cli-shared@2.1.5-next.6
269
+
270
+ ## 1.6.0-next.6
271
+
272
+ ### Patch Changes
273
+
274
+ - fc38deb: Fix bug on the auto-fix permissions linter
275
+ - Updated dependencies [f5eb8e0]
276
+ - @forge/manifest@2.5.0-next.5
277
+ - @forge/cli-shared@2.1.5-next.5
278
+
279
+ ## 1.6.0-next.5
280
+
281
+ ### Patch Changes
282
+
283
+ - Updated dependencies [4de9850]
284
+ - @forge/manifest@2.5.0-next.4
285
+ - @forge/cli-shared@2.1.5-next.4
286
+
287
+ ## 1.6.0-next.4
288
+
289
+ ### Patch Changes
290
+
291
+ - Updated dependencies [dec8066]
292
+ - @forge/manifest@2.5.0-next.3
293
+ - @forge/cli-shared@2.1.5-next.3
294
+
295
+ ## 1.6.0-next.3
296
+
297
+ ### Patch Changes
298
+
299
+ - Updated dependencies [755e35e]
300
+ - Updated dependencies [f013199]
301
+ - @forge/manifest@2.5.0-next.2
302
+ - @forge/cli-shared@2.1.5-next.2
303
+
304
+ ## 1.6.0-next.2
305
+
306
+ ### Patch Changes
307
+
308
+ - Updated dependencies [66f60f9]
309
+ - @forge/manifest@2.5.0-next.1
310
+ - @forge/cli-shared@2.1.5-next.1
311
+
312
+ ## 1.6.0-next.1
313
+
314
+ ### Minor Changes
315
+
316
+ - b8aa35d: Support linting external auth api calls.
317
+
318
+ ## 1.5.1-next.0
319
+
320
+ ### Patch Changes
321
+
322
+ - Updated dependencies [bc0c83b]
323
+ - @forge/manifest@2.4.1-next.0
324
+ - @forge/cli-shared@2.1.5-next.0
325
+
326
+ ## 1.5.0
327
+
328
+ ### Minor Changes
329
+
330
+ - fbcb4a3: Add linter detection & auto-fix of deprecated CSP
331
+
332
+ ### Patch Changes
333
+
334
+ - Updated dependencies [fbcb4a3]
335
+ - Updated dependencies [0bc8683]
336
+ - Updated dependencies [f08a9cb]
337
+ - Updated dependencies [e28cc2c]
338
+ - Updated dependencies [b415d76]
339
+ - Updated dependencies [b91d511]
340
+ - Updated dependencies [daa138b]
341
+ - Updated dependencies [33cbdba]
342
+ - Updated dependencies [ee3919d]
343
+ - Updated dependencies [ba6d463]
344
+ - Updated dependencies [1d7f9f1]
345
+ - Updated dependencies [82167f3]
346
+ - Updated dependencies [873f913]
347
+ - Updated dependencies [a9bdd4f]
348
+ - Updated dependencies [2ea75dd]
349
+ - @forge/manifest@2.4.0
350
+ - @forge/cli-shared@2.1.4
351
+
352
+ ## 1.5.0-next.9
353
+
354
+ ### Patch Changes
355
+
356
+ - Updated dependencies [ba6d463]
357
+ - @forge/manifest@2.4.0-next.9
358
+ - @forge/cli-shared@2.1.4-next.9
359
+
360
+ ## 1.5.0-next.8
361
+
362
+ ### Patch Changes
363
+
364
+ - Updated dependencies [e28cc2c]
365
+ - Updated dependencies [ee3919d]
366
+ - @forge/manifest@2.4.0-next.8
367
+ - @forge/cli-shared@2.1.4-next.8
368
+
369
+ ## 1.5.0-next.7
370
+
371
+ ### Patch Changes
372
+
373
+ - Updated dependencies [daa138b]
374
+ - Updated dependencies [2ea75dd]
375
+ - @forge/manifest@2.4.0-next.7
376
+ - @forge/cli-shared@2.1.4-next.7
377
+
378
+ ## 1.5.0-next.6
379
+
380
+ ### Patch Changes
381
+
382
+ - Updated dependencies [f08a9cb]
383
+ - Updated dependencies [873f913]
384
+ - @forge/manifest@2.4.0-next.6
385
+ - @forge/cli-shared@2.1.4-next.6
386
+
387
+ ## 1.5.0-next.5
388
+
389
+ ### Minor Changes
390
+
391
+ - fbcb4a3: Add linter detection & auto-fix of deprecated CSP
392
+
393
+ ### Patch Changes
394
+
395
+ - Updated dependencies [fbcb4a3]
396
+ - Updated dependencies [a9bdd4f]
397
+ - @forge/manifest@2.4.0-next.5
398
+ - @forge/cli-shared@2.1.4-next.5
399
+
400
+ ## 1.4.7-next.4
401
+
402
+ ### Patch Changes
403
+
404
+ - Updated dependencies [0bc8683]
405
+ - @forge/manifest@2.3.1-next.4
406
+ - @forge/cli-shared@2.1.4-next.4
407
+
408
+ ## 1.4.7-next.3
409
+
410
+ ### Patch Changes
411
+
412
+ - Updated dependencies [1d7f9f1]
413
+ - @forge/manifest@2.3.1-next.3
414
+ - @forge/cli-shared@2.1.4-next.3
415
+
416
+ ## 1.4.7-next.2
417
+
418
+ ### Patch Changes
419
+
420
+ - Updated dependencies [b415d76]
421
+ - Updated dependencies [33cbdba]
422
+ - @forge/manifest@2.3.1-next.2
423
+ - @forge/cli-shared@2.1.4-next.2
424
+
425
+ ## 1.4.7-next.1
426
+
427
+ ### Patch Changes
428
+
429
+ - Updated dependencies [b91d511]
430
+ - @forge/manifest@2.3.1-next.1
431
+ - @forge/cli-shared@2.1.4-next.1
432
+
433
+ ## 1.4.7-next.0
434
+
435
+ ### Patch Changes
436
+
437
+ - Updated dependencies [82167f3]
438
+ - @forge/manifest@2.3.1-next.0
439
+ - @forge/cli-shared@2.1.4-next.0
440
+
441
+ ## 1.4.6
442
+
443
+ ### Patch Changes
444
+
445
+ - Updated dependencies [f3c0748]
8
446
  - Updated dependencies [962582f]
9
447
  - Updated dependencies [bd2be7f]
448
+ - Updated dependencies [46240f3]
449
+ - Updated dependencies [18c799a]
450
+ - Updated dependencies [5ed2e3a]
10
451
  - Updated dependencies [7cfcd6c]
11
452
  - Updated dependencies [f0d3871]
12
- - @forge/manifest@0.0.0-experimental-d8cea00
13
- - @forge/cli-shared@0.0.0-experimental-d8cea00
453
+ - Updated dependencies [9b09fef]
454
+ - @forge/manifest@2.3.0
455
+ - @forge/cli-shared@2.1.3
456
+
457
+ ## 1.4.6-next.4
458
+
459
+ ### Patch Changes
460
+
461
+ - Updated dependencies [46240f3]
462
+ - Updated dependencies [5ed2e3a]
463
+ - @forge/manifest@2.3.0-next.3
464
+ - @forge/cli-shared@2.1.3-next.4
465
+
466
+ ## 1.4.6-next.3
467
+
468
+ ### Patch Changes
469
+
470
+ - Updated dependencies [f3c0748]
471
+ - Updated dependencies [18c799a]
472
+ - Updated dependencies [7cfcd6c]
473
+ - Updated dependencies [9b09fef]
474
+ - @forge/manifest@2.3.0-next.2
475
+ - @forge/cli-shared@2.1.3-next.3
14
476
 
15
477
  ## 1.4.6-next.2
16
478
 
@@ -1 +1 @@
1
- {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/lint/lint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,MAAM,IAAI,CAAC;AAIpB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAOxG,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,iBAAiB,WAAY,UAAU,eAAe,UAAU,EAAE,4BAAuB,IA6CrG,CAAC;AAEF,eAAO,MAAM,YAAY,gBAAiB,UAAU,EAAE,KAAG,YAQxD,CAAC;AAEF,eAAO,MAAM,eAAe,aAChB,MAAM,UACR,OAAO,QAAQ,oBACN,OAAO,EAAE,CAAC,QAAQ,CAAC,aAAa,KAChD,OAAO,CAAC,SAAS,CAOnB,CAAC;AAEF,eAAO,MAAM,IAAI,gBACF,MAAM,EAAE,YACX,QAAQ,eACL,MAAM,UACX,UAAU,6BAhBR,MAAM,UACR,OAAO,QAAQ,oBACN,OAAO,EAAE,CAAC,QAAQ,CAAC,aAAa,KAChD,OAAO,CAAC,SAAS,CAAC,YAeV,eAAe,EAAE,KAMzB,OAAO,CAAC,UAAU,EAAE,CAmCtB,CAAC;AAEF,eAAO,MAAM,QAAQ,WACX,UAAU,WACV,eAAe,KACtB,OAAO,CAAC,UAAU,EAAE,CAGtB,CAAC"}
1
+ {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/lint/lint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,MAAM,IAAI,CAAC;AAIpB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAQxG,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,iBAAiB,WAAY,UAAU,eAAe,UAAU,EAAE,4BAAuB,IA6CrG,CAAC;AAEF,eAAO,MAAM,YAAY,gBAAiB,UAAU,EAAE,KAAG,YAQxD,CAAC;AAEF,eAAO,MAAM,eAAe,aAChB,MAAM,UACR,OAAO,QAAQ,oBACN,OAAO,EAAE,CAAC,QAAQ,CAAC,aAAa,KAChD,OAAO,CAAC,SAAS,CAOnB,CAAC;AAEF,eAAO,MAAM,IAAI,gBACF,MAAM,EAAE,YACX,QAAQ,eACL,MAAM,UACX,UAAU,6BAhBR,MAAM,UACR,OAAO,QAAQ,oBACN,OAAO,EAAE,CAAC,QAAQ,CAAC,aAAa,KAChD,OAAO,CAAC,SAAS,CAAC,YAeV,eAAe,EAAE,KAOzB,OAAO,CAAC,UAAU,EAAE,CAmCtB,CAAC;AAEF,eAAO,MAAM,QAAQ,WACX,UAAU,WACV,eAAe,KACtB,OAAO,CAAC,UAAU,EAAE,CAGtB,CAAC"}
package/out/lint/lint.js CHANGED
@@ -12,6 +12,7 @@ const handler_linter_1 = require("./linters/handler-linter/handler-linter");
12
12
  const full_manifest_linter_1 = require("./linters/manifest-linter/full-manifest-linter");
13
13
  const permissions_manifest_linter_1 = require("./linters/manifest-linter/permissions-manifest-linter");
14
14
  const permission_linter_1 = require("./linters/permission-linter/permission-linter");
15
+ const deprecated_csp_permissions_manifest_linter_1 = require("./linters/manifest-linter/deprecated-csp-permissions-manifest-linter");
15
16
  class FailedLinterError extends Error {
16
17
  }
17
18
  exports.FailedLinterError = FailedLinterError;
@@ -74,6 +75,7 @@ exports.parseSourceFile = async (filepath, parser, readFilePromise = util_1.prom
74
75
  exports.lint = async (filesToLint, manifest, environment, logger, parseFunction = exports.parseSourceFile, linters = [
75
76
  new permission_linter_1.PermissionLinter(environment, manifest, logger),
76
77
  new permissions_manifest_linter_1.PermissionsManifestLinter(logger),
78
+ new deprecated_csp_permissions_manifest_linter_1.DeprecatedCspPermissionsManifestLinter(logger),
77
79
  new full_manifest_linter_1.FullManifestLinter(logger),
78
80
  new handler_linter_1.HandlerLinter(environment, manifest, logger)
79
81
  ]) => {
@@ -0,0 +1,9 @@
1
+ import { ManifestValidationResult, SchemaValidationError } from '@forge/manifest';
2
+ import { AbstractManifestLinter } from './abstract-manifest-linter';
3
+ import { LintResultRule, LintFixState, LintLogger } from '../../linter-interface';
4
+ export declare class DeprecatedCspPermissionsManifestLinter extends AbstractManifestLinter {
5
+ constructor(logger: LintLogger);
6
+ getFixer(): ((errors: LintResultRule[], warnings: LintResultRule[], state: LintFixState) => Promise<LintFixState>) | undefined;
7
+ getResultsForFixer(results: ManifestValidationResult<any>): SchemaValidationError[];
8
+ }
9
+ //# sourceMappingURL=deprecated-csp-permissions-manifest-linter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated-csp-permissions-manifest-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/manifest-linter/deprecated-csp-permissions-manifest-linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGlF,qBAAa,sCAAuC,SAAQ,sBAAsB;gBACpE,MAAM,EAAE,UAAU;IAI9B,QAAQ,IACJ,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC,GACtG,SAAS;IAIb,kBAAkB,CAAC,OAAO,EAAE,wBAAwB,CAAC,GAAG,CAAC,GAAG,qBAAqB,EAAE;CAGpF"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeprecatedCspPermissionsManifestLinter = void 0;
4
+ const manifest_1 = require("@forge/manifest");
5
+ const abstract_manifest_linter_1 = require("./abstract-manifest-linter");
6
+ const permission_linter_1 = require("../permission-linter/permission-linter");
7
+ class DeprecatedCspPermissionsManifestLinter extends abstract_manifest_linter_1.AbstractManifestLinter {
8
+ constructor(logger) {
9
+ super(manifest_1.ValidationTypes.DEPRECATED_CSP_METHOD, logger);
10
+ }
11
+ getFixer() {
12
+ return permission_linter_1.fixMissingPermissions;
13
+ }
14
+ getResultsForFixer(results) {
15
+ var _a;
16
+ return ((_a = results.errors) === null || _a === void 0 ? void 0 : _a.filter((error) => { var _a; return (_a = error.metadata) === null || _a === void 0 ? void 0 : _a.missingContentStylePermission; })) || [];
17
+ }
18
+ }
19
+ exports.DeprecatedCspPermissionsManifestLinter = DeprecatedCspPermissionsManifestLinter;
@@ -9,7 +9,7 @@ interface SwaggerFormat {
9
9
  };
10
10
  }
11
11
  export declare const NON_FWD_SLASH_REGEX = "[^\\/\\s]*";
12
- export declare const findMissingPermissions: (errors: LintResultRule[], warnings: LintResultRule[], permissionsType: 'missingPermission' | 'missingExternalFetchPermission', state?: LintFixState | undefined) => Set<string>;
12
+ export declare const findMissingPermissions: (errors: LintResultRule[], warnings: LintResultRule[], permissionsType: 'missingPermission' | 'missingExternalFetchPermission' | 'missingContentStylePermission', state?: LintFixState | undefined) => Set<string>;
13
13
  export declare const fixMissingPermissions: (errors: LintResultRule[], warnings: LintResultRule[], state: LintFixState) => Promise<LintFixState>;
14
14
  interface PermissionLintCriteriaMatches {
15
15
  [key: string]: ApiCall[];
@@ -1 +1 @@
1
- {"version":3,"file":"permission-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/permission-linter/permission-linter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAe,MAAM,iBAAiB,CAAC;AAE/E,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EACL,OAAO,EAEP,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAML,WAAW,EAGZ,MAAM,aAAa,CAAC;AASrB,UAAU,aAAa;IACrB,KAAK,EAAE;QACL,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;KAC7B,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAKhD,eAAO,MAAM,sBAAsB,WACzB,cAAc,EAAE,YACd,cAAc,EAAE,mBACT,mBAAmB,GAAG,gCAAgC,uCAEtE,GAAG,CAAC,MAAM,CAkBZ,CAAC;AAEF,eAAO,MAAM,qBAAqB,WACxB,cAAc,EAAE,YACd,cAAc,EAAE,SACnB,YAAY,KAClB,OAAO,CAAC,YAAY,CAqDtB,CAAC;AAEF,UAAU,6BAA6B;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CAAC;IACzB,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,OAAO,EAAE,6BAA6B,EAAE,OAAO,EAAE,CAAC;IAQhE,OAAO,CAAC,QAAQ;IAPjD,MAAM,CAAC,cAAc,SAAgC;IACrD,MAAM,CAAC,oBAAoB,SAAsC;IAEjE,OAAO,CAAC,IAAI,CAAC,CAA0B;IACvC,OAAO,CAAC,UAAU,CAAC,CAA0B;IAC7C,OAAO,CAAC,KAAK,CAAC,CAAa;gBAEf,WAAW,EAAE,MAAM,EAAU,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAIlE,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAmCvC,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAajD,SAAS,CAAC,QAAQ,IACd,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC,GACtG,SAAS;IAIb,SAAS,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAsB3D,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAWnF,OAAO,CAAC,YAAY;CAarB"}
1
+ {"version":3,"file":"permission-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/permission-linter/permission-linter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAe,MAAM,iBAAiB,CAAC;AAE/E,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EACL,OAAO,EAEP,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAML,WAAW,EAGZ,MAAM,aAAa,CAAC;AASrB,UAAU,aAAa;IACrB,KAAK,EAAE;QACL,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;KAC7B,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAKhD,eAAO,MAAM,sBAAsB,WACzB,cAAc,EAAE,YACd,cAAc,EAAE,mBACT,mBAAmB,GAAG,gCAAgC,GAAG,+BAA+B,uCAExG,GAAG,CAAC,MAAM,CAkBZ,CAAC;AAEF,eAAO,MAAM,qBAAqB,WACxB,cAAc,EAAE,YACd,cAAc,EAAE,SACnB,YAAY,KAClB,OAAO,CAAC,YAAY,CAsEtB,CAAC;AAEF,UAAU,6BAA6B;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CAAC;IACzB,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,OAAO,EAAE,6BAA6B,EAAE,OAAO,EAAE,CAAC;IAQhE,OAAO,CAAC,QAAQ;IAPjD,MAAM,CAAC,cAAc,SAAgC;IACrD,MAAM,CAAC,oBAAoB,SAAsC;IAEjE,OAAO,CAAC,IAAI,CAAC,CAA0B;IACvC,OAAO,CAAC,UAAU,CAAC,CAA0B;IAC7C,OAAO,CAAC,KAAK,CAAC,CAAa;gBAEf,WAAW,EAAE,MAAM,EAAU,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAIlE,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAmCvC,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAajD,SAAS,CAAC,QAAQ,IACd,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC,GACtG,SAAS;IAIb,SAAS,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAsB3D,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAWnF,OAAO,CAAC,YAAY;CAarB"}
@@ -30,13 +30,14 @@ exports.findMissingPermissions = (errors, warnings, permissionsType, state) => {
30
30
  return missingPermissions;
31
31
  };
32
32
  exports.fixMissingPermissions = async (errors, warnings, state) => {
33
- var _a, _b, _c, _d, _e, _f, _g, _h;
33
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
34
34
  const missingScopes = exports.findMissingPermissions(errors, warnings, 'missingPermission', state);
35
35
  const missingExternalFetchBackend = exports.findMissingPermissions(errors, warnings, 'missingExternalFetchPermission', state);
36
+ const missingContentStyle = exports.findMissingPermissions(errors, warnings, 'missingContentStylePermission', state);
36
37
  const currentPermissions = (_b = (_a = (await state.configFile.readConfig())) === null || _a === void 0 ? void 0 : _a.permissions) !== null && _b !== void 0 ? _b : {};
37
38
  const currentRemotes = (_d = (_c = (await state.configFile.readConfig())) === null || _c === void 0 ? void 0 : _c.remotes) !== null && _d !== void 0 ? _d : [];
38
39
  const currentScopes = (_e = currentPermissions === null || currentPermissions === void 0 ? void 0 : currentPermissions.scopes) !== null && _e !== void 0 ? _e : [];
39
- currentScopes.forEach(missingScopes.add, missingScopes);
40
+ currentScopes.forEach((e) => missingScopes.add(e));
40
41
  const currentExternalFetchBackend = (_h = (_g = (_f = currentPermissions === null || currentPermissions === void 0 ? void 0 : currentPermissions.external) === null || _f === void 0 ? void 0 : _f.fetch) === null || _g === void 0 ? void 0 : _g.backend) !== null && _h !== void 0 ? _h : [];
41
42
  currentExternalFetchBackend
42
43
  .map((item) => {
@@ -46,9 +47,12 @@ exports.fixMissingPermissions = async (errors, warnings, state) => {
46
47
  return (_a = currentRemotes.find((remote) => remote.key == item.remote)) === null || _a === void 0 ? void 0 : _a.baseUrl;
47
48
  })
48
49
  .filter((item) => typeof item === 'string')
49
- .forEach(missingExternalFetchBackend.add, missingExternalFetchBackend);
50
+ .forEach((e) => missingExternalFetchBackend.add(e));
50
51
  const arrayMissingExternalFetchBackend = [...missingExternalFetchBackend];
51
- await state.configFile.writeToConfigFile('permissions', Object.assign(Object.assign(Object.assign({}, currentPermissions), { scopes: [...missingScopes] }), (arrayMissingExternalFetchBackend.length > 0
52
+ const currentContentStyles = (_k = (_j = currentPermissions === null || currentPermissions === void 0 ? void 0 : currentPermissions.content) === null || _j === void 0 ? void 0 : _j.styles) !== null && _k !== void 0 ? _k : [];
53
+ currentContentStyles.forEach((e) => missingContentStyle.add(e));
54
+ const arrayMissingContentStyles = [...missingContentStyle];
55
+ await state.configFile.writeToConfigFile('permissions', Object.assign(Object.assign(Object.assign(Object.assign({}, currentPermissions), { scopes: [...missingScopes] }), (arrayMissingExternalFetchBackend.length > 0
52
56
  ? {
53
57
  external: currentPermissions.external
54
58
  ? Object.assign(Object.assign({}, currentPermissions.external), { fetch: currentPermissions.external.fetch
@@ -60,6 +64,13 @@ exports.fixMissingPermissions = async (errors, warnings, state) => {
60
64
  }
61
65
  }
62
66
  }
67
+ : {})), (arrayMissingContentStyles.length > 0
68
+ ? {
69
+ content: currentPermissions.content
70
+ ? Object.assign(Object.assign({}, currentPermissions.content), { styles: arrayMissingContentStyles }) : {
71
+ styles: arrayMissingContentStyles
72
+ }
73
+ }
63
74
  : {})));
64
75
  return state;
65
76
  };
@@ -2,6 +2,8 @@ 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';
6
+ import OAuth2ScopesWithState = Swagger.OAuth2ScopesWithState;
5
7
  export interface ProductMethod {
6
8
  originalPath: string;
7
9
  methods: PathMethods;
@@ -9,6 +11,7 @@ export interface ProductMethod {
9
11
  export interface PathMethods {
10
12
  [method: string]: {
11
13
  security: SecurityEntry[];
14
+ 'x-atlassian-oauth2-scopes'?: OAuth2ScopesWithState[];
12
15
  };
13
16
  }
14
17
  interface SecurityEntry {
@@ -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,EAAE,MAAM,iBAAiB,CAAC;AAG7D,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;KAC3B,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;IAoC3E,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,iBAAiB;CAY1B"}
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,EAAE,MAAM,iBAAiB,CAAC;AAE7D,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;IAoC3E,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,iBAAiB;CAoB1B"}
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductVerifier = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const linter_interface_1 = require("../../../linter-interface");
5
6
  const verifier_interface_1 = require("../../verifier-interface");
6
7
  const cli_shared_1 = require("@forge/cli-shared");
7
8
  const text_1 = require("../../../text");
9
+ const array_prototype_flatmap_1 = tslib_1.__importDefault(require("array.prototype.flatmap"));
8
10
  class ProductVerifier extends verifier_interface_1.BaseLintIssueVerifier {
9
11
  constructor(environment, manifest, pathMap, product) {
10
12
  super(environment, manifest);
@@ -58,10 +60,14 @@ class ProductVerifier extends verifier_interface_1.BaseLintIssueVerifier {
58
60
  return requiredScopes.filter((scope) => { var _a, _b; return !((_b = (_a = this.manifest.permissions) === null || _a === void 0 ? void 0 : _a.scopes) === null || _b === void 0 ? void 0 : _b.includes(scope)); });
59
61
  }
60
62
  getRequiredScopes({ regex, method }) {
61
- var _a, _b;
63
+ var _a, _b, _c;
62
64
  if (!regex)
63
65
  return [];
64
- const swaggerEntries = (_b = (_a = this.pathMap.get(regex)) === null || _a === void 0 ? void 0 : _a.methods[method]) === null || _b === void 0 ? void 0 : _b.security;
66
+ const oAuth2Scopes = (_a = this.pathMap.get(regex)) === null || _a === void 0 ? void 0 : _a.methods[method]['x-atlassian-oauth2-scopes'];
67
+ if (oAuth2Scopes) {
68
+ return array_prototype_flatmap_1.default(oAuth2Scopes.filter((scope) => scope.state === 'Current').map((scope) => scope.scopes), (x) => x);
69
+ }
70
+ const swaggerEntries = (_c = (_b = this.pathMap.get(regex)) === null || _b === void 0 ? void 0 : _b.methods[method]) === null || _c === void 0 ? void 0 : _c.security;
65
71
  if (!swaggerEntries)
66
72
  return [];
67
73
  return swaggerEntries === null || swaggerEntries === void 0 ? void 0 : swaggerEntries.reduce((prev, curr) => [...prev, ...(curr['OAuth2'] || []), ...(curr['oAuthDefinitions'] || [])], []);
@@ -3,6 +3,7 @@ import { NodeVisitor } from '../../node-visitor-interface';
3
3
  import { ApiCall } from '../api-call-interface';
4
4
  export declare class ExternalApiCallVisitor implements NodeVisitor<ApiCall> {
5
5
  visit(node: TSESTree.Node, parent: TSESTree.Node | undefined, callback: (fetchCall: ApiCall) => void): void;
6
+ private endpointCanBeChecked;
6
7
  private transformArgsToFetchCall;
7
8
  }
8
9
  //# sourceMappingURL=external-fetch-call-visitor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-fetch-call-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/visitors/external-fetch-call-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAgB,MAAM,uBAAuB,CAAC;AAE9D,qBAAa,sBAAuB,YAAW,WAAW,CAAC,OAAO,CAAC;IAC1D,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IA+ClH,OAAO,CAAC,wBAAwB,CAK7B;CACJ"}
1
+ {"version":3,"file":"external-fetch-call-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/visitors/external-fetch-call-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAGhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAgB,MAAM,uBAAuB,CAAC;AAE9D,qBAAa,sBAAuB,YAAW,WAAW,CAAC,OAAO,CAAC;IAC1D,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IA+ClH,OAAO,CAAC,oBAAoB;IAmB5B,OAAO,CAAC,wBAAwB,CAK7B;CACJ"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExternalApiCallVisitor = void 0;
4
4
  const typescript_estree_1 = require("@typescript-eslint/typescript-estree");
5
+ const url_1 = require("url");
5
6
  const api_call_interface_1 = require("../api-call-interface");
6
7
  class ExternalApiCallVisitor {
7
8
  constructor() {
@@ -30,15 +31,29 @@ class ExternalApiCallVisitor {
30
31
  node.property.name === 'fetch' &&
31
32
  (parent === null || parent === void 0 ? void 0 : parent.type) === typescript_estree_1.AST_NODE_TYPES.CallExpression) {
32
33
  const [endpointNode] = parent.arguments;
33
- if ((endpointNode === null || endpointNode === void 0 ? void 0 : endpointNode.type) === typescript_estree_1.AST_NODE_TYPES.Literal && typeof (endpointNode === null || endpointNode === void 0 ? void 0 : endpointNode.value) === 'string') {
34
- if (endpointNode.value.trim() !== '') {
35
- const fetchCall = this.transformArgsToFetchCall(endpointNode);
36
- callback(fetchCall);
37
- }
34
+ if (this.endpointCanBeChecked(endpointNode)) {
35
+ const fetchCall = this.transformArgsToFetchCall(endpointNode);
36
+ callback(fetchCall);
38
37
  }
39
38
  }
40
39
  break;
41
40
  }
42
41
  }
42
+ endpointCanBeChecked(endpointNode) {
43
+ const throws = (thunk) => {
44
+ try {
45
+ thunk();
46
+ return false;
47
+ }
48
+ catch (_a) {
49
+ return true;
50
+ }
51
+ };
52
+ const isPathOnlyUrl = (s) => throws(() => new url_1.URL(s)) && !throws(() => new url_1.URL(s, 'http://example'));
53
+ return ((endpointNode === null || endpointNode === void 0 ? void 0 : endpointNode.type) === typescript_estree_1.AST_NODE_TYPES.Literal &&
54
+ typeof (endpointNode === null || endpointNode === void 0 ? void 0 : endpointNode.value) === 'string' &&
55
+ endpointNode.value.trim() !== '' &&
56
+ !isPathOnlyUrl(endpointNode.value));
57
+ }
43
58
  }
44
59
  exports.ExternalApiCallVisitor = ExternalApiCallVisitor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/lint",
3
- "version": "0.0.0-experimental-d8cea00",
3
+ "version": "0.0.0-experimental-64caa5a",
4
4
  "description": "Linting for forge apps",
5
5
  "main": "out/index.js",
6
6
  "license": "UNLICENSED",
@@ -15,11 +15,12 @@
15
15
  "@types/node-fetch": "^2.5.7"
16
16
  },
17
17
  "dependencies": {
18
- "@forge/cli-shared": "0.0.0-experimental-d8cea00",
19
- "@forge/csp": "1.8.0",
20
- "@forge/manifest": "0.0.0-experimental-d8cea00",
18
+ "@forge/cli-shared": "0.0.0-experimental-64caa5a",
19
+ "@forge/csp": "0.0.0-experimental-64caa5a",
20
+ "@forge/manifest": "0.0.0-experimental-64caa5a",
21
21
  "@typescript-eslint/typescript-estree": "^3.5.0",
22
22
  "cross-spawn": "^7.0.1",
23
- "node-fetch": "^2.6.1"
23
+ "node-fetch": "^2.6.1",
24
+ "atlassian-openapi": "^1.0.13"
24
25
  }
25
26
  }