eslint-plugin-sonarjs 4.0.0 → 4.0.2
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/README.md +269 -268
- package/cjs/S100/rule.js +7 -5
- package/cjs/S101/rule.js +2 -2
- package/cjs/S104/rule.js +2 -2
- package/cjs/S105/rule.js +2 -2
- package/cjs/S1066/rule.js +5 -4
- package/cjs/S1067/rule.js +8 -6
- package/cjs/S1110/rule.js +7 -5
- package/cjs/S1119/rule.js +85 -7
- package/cjs/S1121/rule.js +4 -3
- package/cjs/S1125/rule.js +9 -8
- package/cjs/S1126/rule.js +2 -2
- package/cjs/S1128/rule.js +8 -5
- package/cjs/S1134/rule.js +2 -2
- package/cjs/S1135/rule.js +2 -2
- package/cjs/S1154/rule.js +6 -4
- package/cjs/S117/rule.js +6 -5
- package/cjs/S1172/rule.js +2 -2
- package/cjs/S1192/rule.js +5 -4
- package/cjs/S1219/rule.js +4 -3
- package/cjs/S1226/rule.js +6 -4
- package/cjs/S124/rule.js +2 -2
- package/cjs/S125/rule.js +9 -7
- package/cjs/S126/rule.js +2 -2
- package/cjs/S1264/rule.js +2 -2
- package/cjs/S128/rule.js +4 -3
- package/cjs/S1291/rule.js +2 -2
- package/cjs/S1301/rule.js +2 -2
- package/cjs/S1313/rule.js +2 -2
- package/cjs/S134/rule.js +7 -5
- package/cjs/S135/rule.js +5 -4
- package/cjs/S138/rule.js +9 -6
- package/cjs/S1439/rule.js +2 -2
- package/cjs/S1444/rule.js +2 -2
- package/cjs/S1451/rule.js +2 -2
- package/cjs/S1472/rule.js +2 -2
- package/cjs/S1479/rule.js +2 -2
- package/cjs/S1481/rule.js +2 -2
- package/cjs/S1488/generated-meta.js +1 -1
- package/cjs/S1488/rule.js +11 -7
- package/cjs/S1515/rule.js +10 -8
- package/cjs/{helpers/aws/index.js → S1523/generated-meta.js} +34 -18
- package/cjs/S1523/index.js +21 -0
- package/cjs/S1523/meta.js +21 -0
- package/cjs/S1523/rule.js +143 -0
- package/cjs/S1526/rule.js +5 -4
- package/cjs/S1527/rule.js +2 -2
- package/cjs/S1528/rule.js +2 -2
- package/cjs/S1529/generated-meta.js +1 -1
- package/cjs/S1529/rule.js +4 -3
- package/cjs/S1530/rule.js +5 -3
- package/cjs/S1533/rule.js +2 -2
- package/cjs/S1535/rule.js +2 -2
- package/cjs/S1541/rule.js +10 -7
- package/cjs/S1607/rule.js +22 -20
- package/cjs/S1764/rule.js +10 -7
- package/cjs/S1821/rule.js +2 -2
- package/cjs/S1848/rule.js +10 -7
- package/cjs/S1854/rule.js +18 -14
- package/cjs/S1862/rule.js +10 -8
- package/cjs/S1871/rule.js +21 -16
- package/cjs/S1874/rule.js +4 -3
- package/cjs/S1940/rule.js +2 -2
- package/cjs/S1994/rule.js +10 -7
- package/cjs/S2004/rule.js +9 -7
- package/cjs/S2068/rule.js +75 -12
- package/cjs/S2077/generated-meta.js +1 -1
- package/cjs/S2077/rule.js +10 -6
- package/cjs/S2092/rule.js +2 -2
- package/cjs/S2123/rule.js +2 -2
- package/cjs/S2137/rule.js +2 -2
- package/cjs/S2138/rule.js +4 -3
- package/cjs/S2187/rule.js +2 -2
- package/cjs/S2201/rule.js +47 -5
- package/cjs/S2208/rule.js +2 -2
- package/cjs/S2234/rule.js +58 -11
- package/cjs/S2245/rule.js +4 -3
- package/cjs/S2251/rule.js +5 -4
- package/cjs/S2255/rule.js +6 -5
- package/cjs/S2259/rule.js +14 -9
- package/cjs/S2301/rule.js +14 -9
- package/cjs/S2310/rule.js +80 -9
- package/cjs/S2392/rule.js +7 -5
- package/cjs/S2424/rule.js +2 -2
- package/cjs/S2428/rule.js +8 -6
- package/cjs/S2486/rule.js +4 -3
- package/cjs/S2589/rule.js +12 -10
- package/cjs/S2598/rule.js +17 -14
- package/cjs/S2612/generated-meta.js +1 -1
- package/cjs/S2612/rule.js +8 -6
- package/cjs/S2639/rule.js +2 -2
- package/cjs/S2681/rule.js +2 -2
- package/cjs/S2692/rule.js +6 -4
- package/cjs/S2699/generated-meta.js +1 -1
- package/cjs/S2699/rule.js +40 -31
- package/cjs/S2703/rule.js +2 -2
- package/cjs/S2737/rule.js +6 -4
- package/cjs/S2755/rule.js +9 -6
- package/cjs/S2757/rule.js +2 -2
- package/cjs/S2817/rule.js +10 -7
- package/cjs/S2819/rule.js +16 -12
- package/cjs/S2870/rule.js +8 -5
- package/cjs/S2871/rule.js +12 -9
- package/cjs/S2970/rule.js +9 -8
- package/cjs/S2990/rule.js +2 -2
- package/cjs/S2999/rule.js +10 -7
- package/cjs/S3001/rule.js +2 -2
- package/cjs/S3003/rule.js +10 -7
- package/cjs/S3317/rule.js +4 -3
- package/cjs/S3330/rule.js +2 -2
- package/cjs/S3358/rule.js +2 -2
- package/cjs/S3402/rule.js +14 -10
- package/cjs/S3403/rule.js +10 -7
- package/cjs/S3415/rule.js +16 -13
- package/cjs/S3499/rule.js +5 -4
- package/cjs/S3500/rule.js +5 -4
- package/cjs/S3513/rule.js +5 -4
- package/cjs/S3514/rule.js +10 -7
- package/cjs/S3516/rule.js +10 -7
- package/cjs/S3524/rule.js +2 -2
- package/cjs/S3525/rule.js +6 -4
- package/cjs/S3531/rule.js +5 -3
- package/cjs/S3533/rule.js +8 -7
- package/cjs/S3579/rule.js +6 -4
- package/cjs/S3616/rule.js +6 -4
- package/cjs/S3626/rule.js +4 -3
- package/cjs/S3686/rule.js +7 -5
- package/cjs/S3699/rule.js +4 -3
- package/cjs/S3735/rule.js +8 -5
- package/cjs/S3757/rule.js +8 -6
- package/cjs/S3758/rule.js +9 -7
- package/cjs/S3760/rule.js +24 -21
- package/cjs/S3776/rule.js +26 -22
- package/cjs/S3782/rule.js +6 -4
- package/cjs/S3785/rule.js +9 -6
- package/cjs/S3796/rule.js +12 -8
- package/cjs/S3798/rule.js +4 -3
- package/cjs/S3800/rule.js +22 -11
- package/cjs/S3801/generated-meta.js +1 -1
- package/cjs/S3801/rule.js +15 -11
- package/cjs/S3827/rule.js +9 -6
- package/cjs/S3923/rule.js +9 -6
- package/cjs/S3972/rule.js +5 -4
- package/cjs/S3973/rule.js +7 -5
- package/cjs/S3981/rule.js +4 -3
- package/cjs/S3984/rule.js +4 -3
- package/cjs/S4030/rule.js +10 -7
- package/cjs/S4036/rule.js +7 -5
- package/cjs/S4043/rule.js +12 -8
- package/cjs/S4139/rule.js +7 -5
- package/cjs/S4143/rule.js +12 -9
- package/cjs/S4144/rule.js +12 -9
- package/cjs/S4158/rule.js +11 -8
- package/cjs/S4165/rule.js +14 -12
- package/cjs/S4322/rule.js +8 -5
- package/cjs/S4323/rule.js +4 -3
- package/cjs/S4324/rule.js +7 -5
- package/cjs/S4328/rule.js +2 -2
- package/cjs/S4335/rule.js +6 -4
- package/cjs/S4423/rule.js +4 -3
- package/cjs/S4423/rule.lib.js +8 -7
- package/cjs/S4426/rule.js +11 -10
- package/cjs/S4502/rule.js +16 -13
- package/cjs/S4507/rule.js +8 -6
- package/cjs/S4524/rule.js +2 -2
- package/cjs/S4619/rule.js +6 -4
- package/cjs/S4621/rule.js +5 -4
- package/cjs/S4622/rule.js +5 -3
- package/cjs/S4623/rule.js +8 -5
- package/cjs/S4624/rule.js +6 -4
- package/cjs/S4634/rule.js +4 -3
- package/cjs/S4721/rule.js +7 -5
- package/cjs/S4782/rule.js +7 -5
- package/cjs/S4784/rule.js +5 -4
- package/cjs/S4787/rule.js +9 -7
- package/cjs/S4790/rule.js +7 -5
- package/cjs/S4798/rule.js +2 -2
- package/cjs/S4817/rule.js +10 -8
- package/cjs/S4818/rule.js +4 -3
- package/cjs/S4822/rule.js +13 -9
- package/cjs/S4823/rule.js +4 -3
- package/cjs/S4829/rule.js +4 -3
- package/cjs/S4830/rule.js +11 -8
- package/cjs/S5042/rule.js +9 -7
- package/cjs/S5122/rule.js +40 -36
- package/cjs/S5148/rule.js +9 -8
- package/cjs/S5247/rule.js +22 -18
- package/cjs/S5256/rule.js +5 -4
- package/cjs/S5257/rule.js +4 -3
- package/cjs/S5260/rule.js +4 -3
- package/cjs/S5264/rule.js +4 -3
- package/cjs/S5332/rule.js +4 -3
- package/cjs/S5332/rule.lib.js +19 -17
- package/cjs/S5443/rule.js +2 -2
- package/cjs/S5527/rule.js +18 -14
- package/cjs/S5542/rule.js +6 -4
- package/cjs/S5547/rule.js +6 -4
- package/cjs/S5604/rule.js +15 -14
- package/cjs/S5659/rule.js +15 -12
- package/cjs/S5689/rule.js +11 -8
- package/cjs/S5691/rule.js +7 -5
- package/cjs/S5693/rule.js +14 -12
- package/cjs/S5725/rule.js +9 -6
- package/cjs/S5728/rule.js +7 -4
- package/cjs/S5730/rule.js +9 -6
- package/cjs/S5732/rule.js +8 -5
- package/cjs/S5734/rule.js +7 -4
- package/cjs/S5736/rule.js +8 -5
- package/cjs/S5739/rule.js +11 -8
- package/cjs/S5742/rule.js +7 -4
- package/cjs/S5743/rule.js +8 -6
- package/cjs/S5757/rule.js +13 -10
- package/cjs/S5759/rule.js +10 -7
- package/cjs/S5842/rule.js +2 -2
- package/cjs/S5843/rule.js +22 -19
- package/cjs/S5850/rule.js +4 -3
- package/cjs/S5852/rule.js +2 -2
- package/cjs/S5856/rule.js +10 -7
- package/cjs/S5860/rule.js +30 -26
- package/cjs/S5863/rule.js +15 -11
- package/cjs/S5867/rule.js +8 -7
- package/cjs/S5868/rule.js +7 -5
- package/cjs/S5869/rule.js +6 -5
- package/cjs/S5876/rule.js +12 -8
- package/cjs/S5958/rule.js +12 -9
- package/cjs/S5973/rule.js +10 -7
- package/cjs/S6019/rule.js +4 -3
- package/cjs/S6035/rule.js +2 -2
- package/cjs/S6079/rule.js +9 -6
- package/cjs/S6080/rule.js +13 -10
- package/cjs/S6092/rule.js +9 -7
- package/cjs/S6245/rule.js +14 -9
- package/cjs/S6249/rule.js +7 -5
- package/cjs/S6252/rule.js +12 -8
- package/cjs/S6265/rule.js +27 -20
- package/cjs/S6268/rule.js +5 -4
- package/cjs/S6270/rule.js +12 -9
- package/cjs/S6275/rule.js +2 -2
- package/cjs/S6281/rule.js +22 -17
- package/cjs/S6299/rule.js +2 -2
- package/cjs/S6302/rule.js +6 -5
- package/cjs/S6303/rule.js +12 -10
- package/cjs/S6304/rule.js +6 -5
- package/cjs/S6308/rule.js +7 -5
- package/cjs/S6317/rule.js +5 -4
- package/cjs/S6319/rule.js +2 -2
- package/cjs/S6321/rule.js +25 -23
- package/cjs/S6323/rule.js +4 -3
- package/cjs/S6324/rule.js +2 -2
- package/cjs/S6326/rule.js +2 -2
- package/cjs/S6327/rule.js +2 -2
- package/cjs/S6328/rule.js +4 -3
- package/cjs/S6329/rule.js +7 -5
- package/cjs/S6330/rule.js +2 -2
- package/cjs/S6332/rule.js +2 -2
- package/cjs/S6333/rule.js +8 -6
- package/cjs/S6351/rule.js +22 -19
- package/cjs/S6353/rule.js +2 -2
- package/cjs/S6397/rule.js +2 -2
- package/cjs/S6418/config.js +1 -1
- package/cjs/S6418/rule.js +9 -24
- package/cjs/S6426/rule.js +5 -4
- package/cjs/S6437/rule.js +10 -7
- package/cjs/S6439/rule.js +9 -7
- package/cjs/S6442/rule.js +11 -8
- package/cjs/S6443/rule.js +9 -7
- package/cjs/S6486/rule.js +5 -4
- package/cjs/S6564/rule.js +4 -3
- package/cjs/S6594/rule.js +12 -8
- package/cjs/S6627/rule.js +6 -4
- package/cjs/S6759/rule.js +10 -6
- package/cjs/S6958/rule.js +2 -2
- package/cjs/S6959/rule.js +9 -6
- package/cjs/S7059/generated-meta.js +1 -1
- package/cjs/S7059/rule.js +8 -5
- package/cjs/S7639/generated-meta.js +1 -1
- package/cjs/S7639/rule.js +5 -4
- package/cjs/S7790/generated-meta.js +1 -1
- package/cjs/S7790/rule.js +7 -5
- package/cjs/S8441/generated-meta.js +1 -1
- package/cjs/S8441/rule.js +13 -9
- package/cjs/S881/rule.js +2 -2
- package/cjs/S888/rule.js +4 -3
- package/cjs/S930/rule.js +14 -12
- package/cjs/helpers/ast.js +11 -8
- package/cjs/helpers/aws/s3.js +9 -6
- package/cjs/helpers/chai.js +41 -43
- package/cjs/helpers/configs.js +92 -0
- package/cjs/helpers/cookie-flag-check.js +19 -17
- package/cjs/helpers/{decorators/index.js → entropy.js} +16 -17
- package/cjs/helpers/express.js +127 -128
- package/cjs/helpers/find-up/all-in-parent-dirs.js +0 -16
- package/cjs/helpers/mocha.js +50 -54
- package/cjs/helpers/regex/ast.js +7 -6
- package/cjs/helpers/regex/extract.js +11 -11
- package/cjs/helpers/regex/group.js +2 -2
- package/cjs/helpers/regex/location.js +2 -2
- package/cjs/helpers/regex/range.js +5 -4
- package/cjs/helpers/regex/rule-template.js +4 -3
- package/cjs/helpers/sinon.js +33 -36
- package/cjs/helpers/supertest.js +34 -37
- package/cjs/helpers/vitest.js +29 -32
- package/cjs/plugin-rules.js +452 -450
- package/docs/assertions-in-tests.md +2 -0
- package/docs/bitwise-operators.md +2 -0
- package/docs/code-eval.md +7 -0
- package/docs/file-permissions.md +1 -1
- package/docs/no-async-constructor.md +2 -0
- package/docs/no-inconsistent-returns.md +2 -0
- package/docs/prefer-immediate-return.md +2 -0
- package/docs/sql-queries.md +2 -0
- package/package.json +39 -1
- package/types/S1067/rule.d.ts +1 -1
- package/types/S1110/rule.d.ts +1 -1
- package/types/S1128/rule.d.ts +1 -1
- package/types/S1172/rule.d.ts +1 -1
- package/types/S1226/rule.d.ts +1 -1
- package/types/S134/rule.d.ts +1 -1
- package/types/S1472/rule.d.ts +1 -1
- package/types/S1481/rule.d.ts +1 -1
- package/types/S1488/generated-meta.d.ts +1 -1
- package/types/S1515/rule.d.ts +1 -1
- package/types/S1523/generated-meta.d.ts +17 -0
- package/types/S1523/index.d.ts +1 -0
- package/types/S1523/meta.d.ts +2 -0
- package/types/S1523/rule.d.ts +2 -0
- package/types/S1527/rule.d.ts +1 -1
- package/types/S1529/generated-meta.d.ts +1 -1
- package/types/S1541/rule.d.ts +1 -1
- package/types/S1862/rule.d.ts +1 -1
- package/types/S2077/generated-meta.d.ts +1 -1
- package/types/S2123/rule.d.ts +1 -1
- package/types/S2259/rule.d.ts +1 -1
- package/types/S2428/rule.d.ts +1 -1
- package/types/S2589/rule.d.ts +1 -1
- package/types/S2598/rule.d.ts +1 -1
- package/types/S2699/generated-meta.d.ts +1 -1
- package/types/S2699/rule.d.ts +1 -1
- package/types/S2737/rule.d.ts +1 -1
- package/types/S2757/rule.d.ts +1 -1
- package/types/S2819/rule.d.ts +1 -1
- package/types/S3001/rule.d.ts +1 -1
- package/types/S3317/rule.d.ts +1 -1
- package/types/S3500/rule.d.ts +1 -1
- package/types/S3513/rule.d.ts +1 -1
- package/types/S3686/rule.d.ts +1 -1
- package/types/S3801/generated-meta.d.ts +1 -1
- package/types/S3972/rule.d.ts +1 -1
- package/types/S3973/rule.d.ts +1 -1
- package/types/S4030/rule.d.ts +1 -1
- package/types/S4143/rule.d.ts +1 -1
- package/types/S4158/rule.d.ts +1 -1
- package/types/S4621/rule.d.ts +1 -1
- package/types/S4782/rule.d.ts +1 -1
- package/types/S5693/rule.d.ts +1 -1
- package/types/S5725/rule.d.ts +1 -1
- package/types/S5860/rule.d.ts +1 -1
- package/types/S5868/rule.d.ts +1 -1
- package/types/S5869/rule.d.ts +1 -1
- package/types/S6079/rule.d.ts +1 -1
- package/types/S6326/rule.d.ts +1 -1
- package/types/S6351/rule.d.ts +1 -1
- package/types/S6418/config.d.ts +1 -1
- package/types/S6443/rule.d.ts +1 -1
- package/types/S7059/generated-meta.d.ts +1 -1
- package/types/S7639/generated-meta.d.ts +1 -1
- package/types/S7790/generated-meta.d.ts +1 -1
- package/types/S8441/generated-meta.d.ts +1 -1
- package/types/S930/rule.d.ts +1 -1
- package/types/helpers/ancestor.d.ts +3 -3
- package/types/helpers/ast.d.ts +1 -1
- package/types/helpers/aws/iam.d.ts +2 -2
- package/types/helpers/aws/s3.d.ts +1 -1
- package/types/helpers/chai.d.ts +3 -5
- package/types/helpers/configs.d.ts +39 -1
- package/types/helpers/entropy.d.ts +1 -0
- package/types/helpers/equivalence.d.ts +1 -1
- package/types/helpers/express.d.ts +38 -43
- package/types/helpers/find-up/all-in-parent-dirs.d.ts +1 -1
- package/types/helpers/find-up/closest.d.ts +1 -1
- package/types/helpers/find-up/find-minimatch.d.ts +1 -1
- package/types/helpers/generate-meta.d.ts +1 -1
- package/types/helpers/mocha.d.ts +19 -21
- package/types/helpers/module.d.ts +1 -1
- package/types/helpers/package-jsons/all-in-parent-dirs.d.ts +1 -1
- package/types/helpers/package-jsons/dependencies.d.ts +1 -1
- package/types/helpers/recognizers/CodeRecognizer.d.ts +1 -1
- package/types/helpers/recognizers/JavaScriptFootPrint.d.ts +2 -2
- package/types/helpers/recognizers/LanguageFootprint.d.ts +1 -1
- package/types/helpers/regex/alternation.d.ts +1 -1
- package/types/helpers/regex/ast.d.ts +1 -1
- package/types/helpers/regex/location.d.ts +2 -2
- package/types/helpers/regex/range.d.ts +2 -2
- package/types/helpers/regex/rule-template.d.ts +1 -1
- package/types/helpers/result.d.ts +1 -1
- package/types/helpers/sinon.d.ts +4 -6
- package/types/helpers/sonar-runtime.d.ts +1 -1
- package/types/helpers/supertest.d.ts +4 -6
- package/types/helpers/type.d.ts +1 -1
- package/types/helpers/vitest.d.ts +4 -6
- package/types/plugin-rules.d.ts +1 -0
- package/cjs/helpers/decorators/interceptor.js +0 -88
- package/cjs/helpers/index.js +0 -60
- package/cjs/helpers/recognizers/index.js +0 -37
- package/cjs/helpers/rule-detect-react.js +0 -29
- package/cjs/helpers/validate-version.js +0 -94
- package/types/helpers/aws/index.d.ts +0 -3
- package/types/helpers/decorators/index.d.ts +0 -2
- package/types/helpers/decorators/interceptor.d.ts +0 -16
- package/types/helpers/index.d.ts +0 -28
- package/types/helpers/recognizers/index.d.ts +0 -2
- package/types/helpers/rule-detect-react.d.ts +0 -2
- package/types/helpers/validate-version.d.ts +0 -13
package/cjs/S6303/rule.js
CHANGED
|
@@ -51,7 +51,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
51
51
|
})();
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
|
-
const
|
|
54
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
55
|
+
const module_js_1 = require("../helpers/module.js");
|
|
56
|
+
const ast_js_1 = require("../helpers/ast.js");
|
|
55
57
|
const cdk_js_1 = require("../helpers/aws/cdk.js");
|
|
56
58
|
const meta = __importStar(require("./generated-meta.js"));
|
|
57
59
|
const CfnDBCluster = 'CfnDBCluster';
|
|
@@ -67,7 +69,7 @@ exports.rule = (0, cdk_js_1.AwsCdkTemplate)({
|
|
|
67
69
|
'aws-cdk-lib.aws_rds.DatabaseClusterFromSnapshot': checkStorage(DatabaseClusterFromSnapshot),
|
|
68
70
|
'aws-cdk-lib.aws_rds.DatabaseInstance': checkStorage(DatabaseInstance),
|
|
69
71
|
'aws-cdk-lib.aws_rds.DatabaseInstanceReadReplica': checkStorage(DatabaseInstanceReadReplica),
|
|
70
|
-
}, (0,
|
|
72
|
+
}, (0, generate_meta_js_1.generateMeta)(meta, {
|
|
71
73
|
messages: {
|
|
72
74
|
unsafe: 'Make sure that using unencrypted storage is safe here.',
|
|
73
75
|
omitted: 'Omitting storageEncrypted disables RDS encryption. Make sure it is safe here.',
|
|
@@ -77,7 +79,7 @@ const PROPS_ARGUMENT_POSITION = 2;
|
|
|
77
79
|
function checkStorage(storage) {
|
|
78
80
|
return (expr, ctx) => {
|
|
79
81
|
const argument = expr.arguments[PROPS_ARGUMENT_POSITION];
|
|
80
|
-
const props = (0,
|
|
82
|
+
const props = (0, ast_js_1.getValueOfExpression)(ctx, argument, 'ObjectExpression');
|
|
81
83
|
if (isUnresolved(argument, props)) {
|
|
82
84
|
return;
|
|
83
85
|
}
|
|
@@ -88,20 +90,20 @@ function checkStorage(storage) {
|
|
|
88
90
|
if (isException(storage, props)) {
|
|
89
91
|
return;
|
|
90
92
|
}
|
|
91
|
-
const propertyKey = (0,
|
|
93
|
+
const propertyKey = (0, ast_js_1.getProperty)(props, 'storageEncrypted', ctx);
|
|
92
94
|
if (propertyKey === null) {
|
|
93
95
|
report(props, 'omitted');
|
|
94
96
|
}
|
|
95
97
|
if (!propertyKey) {
|
|
96
98
|
return;
|
|
97
99
|
}
|
|
98
|
-
const propertyValue = (0,
|
|
99
|
-
if ((0,
|
|
100
|
+
const propertyValue = (0, ast_js_1.getUniqueWriteUsageOrNode)(ctx, propertyKey.value);
|
|
101
|
+
if ((0, ast_js_1.isFalseLiteral)(propertyValue)) {
|
|
100
102
|
report(propertyKey.value, 'unsafe');
|
|
101
103
|
return;
|
|
102
104
|
}
|
|
103
105
|
function isUnresolved(node, value) {
|
|
104
|
-
return node?.type === 'Identifier' && !(0,
|
|
106
|
+
return node?.type === 'Identifier' && !(0, ast_js_1.isUndefined)(node) && value === undefined;
|
|
105
107
|
}
|
|
106
108
|
function isException(storage, props) {
|
|
107
109
|
if (![
|
|
@@ -112,15 +114,15 @@ function checkStorage(storage) {
|
|
|
112
114
|
].includes(storage)) {
|
|
113
115
|
return false;
|
|
114
116
|
}
|
|
115
|
-
const exceptionKey = (0,
|
|
117
|
+
const exceptionKey = (0, ast_js_1.getProperty)(props, 'storageEncryptionKey', ctx);
|
|
116
118
|
if (exceptionKey == null) {
|
|
117
119
|
return false;
|
|
118
120
|
}
|
|
119
|
-
const exceptionValue = (0,
|
|
121
|
+
const exceptionValue = (0, ast_js_1.getUniqueWriteUsageOrNode)(ctx, exceptionKey.value);
|
|
120
122
|
if (exceptionValue.type !== 'NewExpression') {
|
|
121
123
|
return false;
|
|
122
124
|
}
|
|
123
|
-
const fqn = (0, cdk_js_1.normalizeFQN)((0,
|
|
125
|
+
const fqn = (0, cdk_js_1.normalizeFQN)((0, module_js_1.getFullyQualifiedName)(ctx, exceptionValue.callee));
|
|
124
126
|
return fqn === 'aws_cdk_lib.aws_kms.Key' || fqn === 'aws_cdk_lib.aws_kms.Alias';
|
|
125
127
|
}
|
|
126
128
|
function report(node, messageId) {
|
package/cjs/S6304/rule.js
CHANGED
|
@@ -51,7 +51,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
51
51
|
})();
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
|
-
const
|
|
54
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
55
|
+
const location_js_1 = require("../helpers/location.js");
|
|
55
56
|
const result_js_1 = require("../helpers/result.js");
|
|
56
57
|
const iam_js_1 = require("../helpers/aws/iam.js");
|
|
57
58
|
const meta = __importStar(require("./generated-meta.js"));
|
|
@@ -60,7 +61,7 @@ const MESSAGES = {
|
|
|
60
61
|
secondary: 'Related effect',
|
|
61
62
|
};
|
|
62
63
|
const KMS_PREFIX = 'kms:';
|
|
63
|
-
exports.rule = (0, iam_js_1.AwsIamPolicyTemplate)(allResourcesAccessibleStatementCheck, (0,
|
|
64
|
+
exports.rule = (0, iam_js_1.AwsIamPolicyTemplate)(allResourcesAccessibleStatementCheck, (0, generate_meta_js_1.generateMeta)(meta));
|
|
64
65
|
function allResourcesAccessibleStatementCheck(expr, ctx, options) {
|
|
65
66
|
const properties = (0, result_js_1.getResultOfExpression)(ctx, expr);
|
|
66
67
|
const effect = (0, iam_js_1.getSensitiveEffect)(properties, ctx, options);
|
|
@@ -69,16 +70,16 @@ function allResourcesAccessibleStatementCheck(expr, ctx, options) {
|
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
72
|
if (effect.isMissing && resource) {
|
|
72
|
-
(0,
|
|
73
|
+
(0, location_js_1.report)(ctx, {
|
|
73
74
|
message: MESSAGES.message,
|
|
74
75
|
node: resource,
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
else if (effect.isFound && resource) {
|
|
78
|
-
(0,
|
|
79
|
+
(0, location_js_1.report)(ctx, {
|
|
79
80
|
message: MESSAGES.message,
|
|
80
81
|
node: resource,
|
|
81
|
-
}, [(0,
|
|
82
|
+
}, [(0, location_js_1.toSecondaryLocation)(effect.node, MESSAGES.secondary)]);
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
function isException(properties, options) {
|
package/cjs/S6308/rule.js
CHANGED
|
@@ -52,7 +52,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
54
|
const cdk_js_1 = require("../helpers/aws/cdk.js");
|
|
55
|
-
const
|
|
55
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
56
|
+
const module_js_1 = require("../helpers/module.js");
|
|
57
|
+
const ast_js_1 = require("../helpers/ast.js");
|
|
56
58
|
const result_js_1 = require("../helpers/result.js");
|
|
57
59
|
const meta = __importStar(require("./generated-meta.js"));
|
|
58
60
|
const DOMAIN_PROPS_POSITION = 2;
|
|
@@ -92,7 +94,7 @@ exports.rule = (0, cdk_js_1.AwsCdkTemplate)({
|
|
|
92
94
|
defaultValue: ELASTIC_SEARCH,
|
|
93
95
|
},
|
|
94
96
|
}),
|
|
95
|
-
}, (0,
|
|
97
|
+
}, (0, generate_meta_js_1.generateMeta)(meta, {
|
|
96
98
|
messages: {
|
|
97
99
|
encryptionDisabled: 'Make sure that using unencrypted {{search}} domains is safe here.',
|
|
98
100
|
encryptionOmitted: 'Omitting {{encryptionPropertyName}} causes encryption of data at rest to be ' +
|
|
@@ -128,11 +130,11 @@ function domainChecker(options) {
|
|
|
128
130
|
}
|
|
129
131
|
function getSearchEngine(node) {
|
|
130
132
|
let version;
|
|
131
|
-
if (options.version.valueType === 'string' && (0,
|
|
133
|
+
if (options.version.valueType === 'string' && (0, ast_js_1.isStringLiteral)(node)) {
|
|
132
134
|
version = `${options.version.property}.${node.value}`;
|
|
133
135
|
}
|
|
134
136
|
else {
|
|
135
|
-
version = (0,
|
|
137
|
+
version = (0, module_js_1.getFullyQualifiedName)(ctx, node);
|
|
136
138
|
}
|
|
137
139
|
for (const name of version?.toLowerCase().split('.').reverse() ?? []) {
|
|
138
140
|
if (name.includes('opensearch')) {
|
|
@@ -147,5 +149,5 @@ function domainChecker(options) {
|
|
|
147
149
|
};
|
|
148
150
|
}
|
|
149
151
|
function isUnencrypted(node) {
|
|
150
|
-
return (0,
|
|
152
|
+
return (0, ast_js_1.isBooleanLiteral)(node) && !node.value;
|
|
151
153
|
}
|
package/cjs/S6317/rule.js
CHANGED
|
@@ -51,7 +51,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
51
51
|
})();
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
|
-
const
|
|
54
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
55
|
+
const location_js_1 = require("../helpers/location.js");
|
|
55
56
|
const result_js_1 = require("../helpers/result.js");
|
|
56
57
|
const iam_js_1 = require("../helpers/aws/iam.js");
|
|
57
58
|
const meta = __importStar(require("./generated-meta.js"));
|
|
@@ -89,7 +90,7 @@ const MESSAGES = {
|
|
|
89
90
|
'Remove permissions or restrict the set of resources they apply to.',
|
|
90
91
|
secondary: 'Permissions are granted on all resources.',
|
|
91
92
|
};
|
|
92
|
-
exports.rule = (0, iam_js_1.AwsIamPolicyTemplate)(privilegeEscalationStatementChecker, (0,
|
|
93
|
+
exports.rule = (0, iam_js_1.AwsIamPolicyTemplate)(privilegeEscalationStatementChecker, (0, generate_meta_js_1.generateMeta)(meta));
|
|
93
94
|
function privilegeEscalationStatementChecker(expr, ctx, options) {
|
|
94
95
|
const properties = (0, result_js_1.getResultOfExpression)(ctx, expr);
|
|
95
96
|
const effect = (0, iam_js_1.getSensitiveEffect)(properties, ctx, options);
|
|
@@ -99,10 +100,10 @@ function privilegeEscalationStatementChecker(expr, ctx, options) {
|
|
|
99
100
|
(effect.isFound || effect.isMissing) &&
|
|
100
101
|
resource &&
|
|
101
102
|
action) {
|
|
102
|
-
(0,
|
|
103
|
+
(0, location_js_1.report)(ctx, {
|
|
103
104
|
message: MESSAGES.message(action.value),
|
|
104
105
|
node: resource,
|
|
105
|
-
}, [(0,
|
|
106
|
+
}, [(0, location_js_1.toSecondaryLocation)(action, MESSAGES.secondary)]);
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
function getSensitiveAction(properties, options) {
|
package/cjs/S6319/rule.js
CHANGED
|
@@ -52,11 +52,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
54
|
const cdk_js_1 = require("../helpers/aws/cdk.js");
|
|
55
|
-
const
|
|
55
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
56
56
|
const meta = __importStar(require("./generated-meta.js"));
|
|
57
57
|
exports.rule = (0, cdk_js_1.AwsCdkTemplate)({
|
|
58
58
|
'aws-cdk-lib.aws_sagemaker.CfnNotebookInstance': (0, cdk_js_1.AwsCdkCheckArguments)('CfnNotebookInstance', true, 'kmsKeyId'),
|
|
59
|
-
}, (0,
|
|
59
|
+
}, (0, generate_meta_js_1.generateMeta)(meta, {
|
|
60
60
|
messages: {
|
|
61
61
|
CfnNotebookInstance: 'Omitting "kmsKeyId" disables encryption of SageMaker notebook instances. Make sure it is safe here.',
|
|
62
62
|
},
|
package/cjs/S6321/rule.js
CHANGED
|
@@ -52,7 +52,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
54
|
const cdk_js_1 = require("../helpers/aws/cdk.js");
|
|
55
|
-
const
|
|
55
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
56
|
+
const module_js_1 = require("../helpers/module.js");
|
|
57
|
+
const ast_js_1 = require("../helpers/ast.js");
|
|
56
58
|
const meta = __importStar(require("./generated-meta.js"));
|
|
57
59
|
const TYPES_WITH_CONNECTIONS = [
|
|
58
60
|
'aws_cdk_lib.aws_docdb.DatabaseCluster.connections',
|
|
@@ -134,15 +136,15 @@ templateCallback['aws_cdk_lib.aws_ec2.SecurityGroup.addIngressRule'] = {
|
|
|
134
136
|
};
|
|
135
137
|
templateCallback['aws_cdk_lib.aws_ec2.CfnSecurityGroup'] = (expr, ctx) => {
|
|
136
138
|
const params = expr.arguments[2];
|
|
137
|
-
const objExpr = (0,
|
|
139
|
+
const objExpr = (0, ast_js_1.getValueOfExpression)(ctx, params, 'ObjectExpression', true);
|
|
138
140
|
if (!objExpr) {
|
|
139
141
|
return;
|
|
140
142
|
}
|
|
141
|
-
const ingressProp = (0,
|
|
143
|
+
const ingressProp = (0, ast_js_1.getProperty)(objExpr, 'securityGroupIngress', ctx);
|
|
142
144
|
if (!ingressProp) {
|
|
143
145
|
return;
|
|
144
146
|
}
|
|
145
|
-
const arrExpr = (0,
|
|
147
|
+
const arrExpr = (0, ast_js_1.getValueOfExpression)(ctx, ingressProp.value, 'ArrayExpression', true);
|
|
146
148
|
if (arrExpr) {
|
|
147
149
|
for (const ingressGroup of arrExpr.elements) {
|
|
148
150
|
if (ingressGroup) {
|
|
@@ -154,7 +156,7 @@ templateCallback['aws_cdk_lib.aws_ec2.CfnSecurityGroup'] = (expr, ctx) => {
|
|
|
154
156
|
templateCallback['aws_cdk_lib.aws_ec2.CfnSecurityGroupIngress'] = (expr, ctx) => {
|
|
155
157
|
checkIngressObject(ctx, expr.arguments[2]);
|
|
156
158
|
};
|
|
157
|
-
exports.rule = (0, cdk_js_1.AwsCdkTemplate)(templateCallback, (0,
|
|
159
|
+
exports.rule = (0, cdk_js_1.AwsCdkTemplate)(templateCallback, (0, generate_meta_js_1.generateMeta)(meta, {
|
|
158
160
|
messages: {
|
|
159
161
|
allowFromAnyIpv4: 'Change this method for "allowFrom" and set "other" to a subset of trusted IP addresses.',
|
|
160
162
|
allowFrom: 'Change this IP range to a subset of trusted IP addresses.',
|
|
@@ -162,7 +164,7 @@ exports.rule = (0, cdk_js_1.AwsCdkTemplate)(templateCallback, (0, index_js_1.gen
|
|
|
162
164
|
}));
|
|
163
165
|
const invalidDefaultPortChecker = (0, cdk_js_1.AwsCdkCheckArguments)('allowFrom', false, 'defaultPort', { customChecker: isBadEc2Port }, true, 0);
|
|
164
166
|
function checkConstructorDefaultPort(ctx, node) {
|
|
165
|
-
const newExpr = (0,
|
|
167
|
+
const newExpr = (0, ast_js_1.getValueOfExpression)(ctx, (0, module_js_1.reduceToIdentifier)(node.callee), 'NewExpression', true);
|
|
166
168
|
if (newExpr && invalidDefaultPortChecker(newExpr, ctx)) {
|
|
167
169
|
ctx.report({ messageId: 'allowFromAnyIpv4', node: node.callee });
|
|
168
170
|
}
|
|
@@ -181,7 +183,7 @@ function checkAllowFromAnyIpv4(expr, ctx) {
|
|
|
181
183
|
}
|
|
182
184
|
}
|
|
183
185
|
function checkIngressObject(ctx, node) {
|
|
184
|
-
const objExpr = (0,
|
|
186
|
+
const objExpr = (0, ast_js_1.getValueOfExpression)(ctx, node, 'ObjectExpression', true);
|
|
185
187
|
if (!objExpr) {
|
|
186
188
|
return;
|
|
187
189
|
}
|
|
@@ -202,19 +204,19 @@ function checkIngressObject(ctx, node) {
|
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
206
|
function disallowedPortObject(ctx, node) {
|
|
205
|
-
const objExpr = (0,
|
|
207
|
+
const objExpr = (0, ast_js_1.getValueOfExpression)(ctx, node, 'ObjectExpression', true);
|
|
206
208
|
if (!objExpr) {
|
|
207
209
|
return false;
|
|
208
210
|
}
|
|
209
|
-
const protocol = (0,
|
|
211
|
+
const protocol = (0, ast_js_1.getProperty)(objExpr, 'protocol', ctx);
|
|
210
212
|
if (!protocol) {
|
|
211
213
|
return false;
|
|
212
214
|
}
|
|
213
|
-
const protocolValue = (0,
|
|
214
|
-
if ((0,
|
|
215
|
+
const protocolValue = (0, ast_js_1.getUniqueWriteUsageOrNode)(ctx, protocol.value, true);
|
|
216
|
+
if ((0, ast_js_1.isUnresolved)(protocolValue, ctx) || (0, ast_js_1.isUndefined)(protocolValue)) {
|
|
215
217
|
return false;
|
|
216
218
|
}
|
|
217
|
-
const protocolFQN = (0, cdk_js_1.normalizeFQN)((0,
|
|
219
|
+
const protocolFQN = (0, cdk_js_1.normalizeFQN)((0, module_js_1.getFullyQualifiedName)(ctx, protocolValue));
|
|
218
220
|
if (protocolFQN && badFQNProtocols.has(protocolFQN)) {
|
|
219
221
|
const fromPort = Number.parseInt(getPropertyValue(ctx, objExpr, 'fromPort')?.value);
|
|
220
222
|
const toPort = Number.parseInt(getPropertyValue(ctx, objExpr, 'toPort')?.value);
|
|
@@ -223,7 +225,7 @@ function disallowedPortObject(ctx, node) {
|
|
|
223
225
|
return false;
|
|
224
226
|
}
|
|
225
227
|
function isBadEc2Peer(ctx, node) {
|
|
226
|
-
const fqn = (0, cdk_js_1.normalizeFQN)((0,
|
|
228
|
+
const fqn = (0, cdk_js_1.normalizeFQN)((0, module_js_1.getFullyQualifiedName)(ctx, node));
|
|
227
229
|
if (fqn === 'aws_cdk_lib.aws_ec2.Peer.anyIpv4' || fqn === 'aws_cdk_lib.aws_ec2.Peer.anyIpv6') {
|
|
228
230
|
return true;
|
|
229
231
|
}
|
|
@@ -236,7 +238,7 @@ function isBadEc2Peer(ctx, node) {
|
|
|
236
238
|
return false;
|
|
237
239
|
}
|
|
238
240
|
function isBadEc2Port(ctx, node) {
|
|
239
|
-
const fqn = (0, cdk_js_1.normalizeFQN)((0,
|
|
241
|
+
const fqn = (0, cdk_js_1.normalizeFQN)((0, module_js_1.getFullyQualifiedName)(ctx, node));
|
|
240
242
|
if (fqn === 'aws_cdk_lib.aws_ec2.Port.allTcp' || fqn === 'aws_cdk_lib.aws_ec2.Port.allTraffic') {
|
|
241
243
|
return true;
|
|
242
244
|
}
|
|
@@ -257,18 +259,18 @@ function isBadEc2Port(ctx, node) {
|
|
|
257
259
|
return false;
|
|
258
260
|
}
|
|
259
261
|
function getArgument(ctx, node, position = 0) {
|
|
260
|
-
if (!node || (0,
|
|
262
|
+
if (!node || (0, ast_js_1.isUndefined)(node) || (0, ast_js_1.isUnresolved)(node, ctx)) {
|
|
261
263
|
return undefined;
|
|
262
264
|
}
|
|
263
|
-
const callExpr = (0,
|
|
264
|
-
if ((0,
|
|
265
|
-
(0,
|
|
265
|
+
const callExpr = (0, ast_js_1.getUniqueWriteUsageOrNode)(ctx, node, true);
|
|
266
|
+
if ((0, ast_js_1.isUnresolved)(callExpr, ctx) ||
|
|
267
|
+
(0, ast_js_1.isUndefined)(callExpr) ||
|
|
266
268
|
(callExpr.type !== 'CallExpression' && callExpr.type !== 'NewExpression')) {
|
|
267
269
|
return undefined;
|
|
268
270
|
}
|
|
269
271
|
const argument = callExpr.arguments[position];
|
|
270
|
-
const argumentValue = (0,
|
|
271
|
-
if ((0,
|
|
272
|
+
const argumentValue = (0, ast_js_1.getUniqueWriteUsageOrNode)(ctx, argument, true);
|
|
273
|
+
if ((0, ast_js_1.isUnresolved)(argumentValue, ctx) || (0, ast_js_1.isUndefined)(argumentValue)) {
|
|
272
274
|
return undefined;
|
|
273
275
|
}
|
|
274
276
|
return argumentValue;
|
|
@@ -278,12 +280,12 @@ function getArgumentValue(ctx, node, position = 0) {
|
|
|
278
280
|
return argument ? (0, cdk_js_1.getLiteralValue)(ctx, argument) : undefined;
|
|
279
281
|
}
|
|
280
282
|
function getPropertyValue(ctx, node, propertyName) {
|
|
281
|
-
const property = (0,
|
|
283
|
+
const property = (0, ast_js_1.getProperty)(node, propertyName, ctx);
|
|
282
284
|
if (!property) {
|
|
283
285
|
return undefined;
|
|
284
286
|
}
|
|
285
|
-
const propertyValue = (0,
|
|
286
|
-
if ((0,
|
|
287
|
+
const propertyValue = (0, ast_js_1.getUniqueWriteUsageOrNode)(ctx, property.value, true);
|
|
288
|
+
if ((0, ast_js_1.isUnresolved)(propertyValue, ctx) || (0, ast_js_1.isUndefined)(propertyValue)) {
|
|
287
289
|
return undefined;
|
|
288
290
|
}
|
|
289
291
|
return (0, cdk_js_1.getLiteralValue)(ctx, propertyValue);
|
package/cjs/S6323/rule.js
CHANGED
|
@@ -51,7 +51,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
51
51
|
})();
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
|
-
const
|
|
54
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
55
|
+
const collection_js_1 = require("../helpers/collection.js");
|
|
55
56
|
const meta = __importStar(require("./generated-meta.js"));
|
|
56
57
|
const rule_template_js_1 = require("../helpers/regex/rule-template.js");
|
|
57
58
|
exports.rule = (0, rule_template_js_1.createRegExpRule)(context => {
|
|
@@ -77,10 +78,10 @@ exports.rule = (0, rule_template_js_1.createRegExpRule)(context => {
|
|
|
77
78
|
onGroupEnter: checkAlternation,
|
|
78
79
|
onCapturingGroupEnter: checkAlternation,
|
|
79
80
|
};
|
|
80
|
-
}, (0,
|
|
81
|
+
}, (0, generate_meta_js_1.generateMeta)(meta));
|
|
81
82
|
function isLastEmptyInGroup(alt) {
|
|
82
83
|
const group = alt.parent;
|
|
83
84
|
return ((group.type === 'Group' || group.type === 'CapturingGroup') &&
|
|
84
|
-
(0,
|
|
85
|
+
(0, collection_js_1.last)(group.alternatives) === alt &&
|
|
85
86
|
group.parent.type !== 'Quantifier');
|
|
86
87
|
}
|
package/cjs/S6324/rule.js
CHANGED
|
@@ -51,7 +51,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
51
51
|
})();
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
|
-
const
|
|
54
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
55
55
|
const meta = __importStar(require("./generated-meta.js"));
|
|
56
56
|
const rule_template_js_1 = require("../helpers/regex/rule-template.js");
|
|
57
57
|
const EXCEPTIONS = new Set(['\t', '\n']);
|
|
@@ -150,7 +150,7 @@ exports.rule = (0, rule_template_js_1.createRegExpRule)(context => {
|
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
};
|
|
153
|
-
}, (0,
|
|
153
|
+
}, (0, generate_meta_js_1.generateMeta)(meta));
|
|
154
154
|
/**
|
|
155
155
|
* When the character has been interpreted, we need to compare its
|
|
156
156
|
* code point value.
|
package/cjs/S6326/rule.js
CHANGED
|
@@ -51,7 +51,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
51
51
|
})();
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
|
-
const
|
|
54
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
55
55
|
const meta = __importStar(require("./generated-meta.js"));
|
|
56
56
|
const rule_template_js_1 = require("../helpers/regex/rule-template.js");
|
|
57
57
|
const range_js_1 = require("../helpers/regex/range.js");
|
|
@@ -89,7 +89,7 @@ exports.rule = (0, rule_template_js_1.createRegExpRule)(context => {
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
};
|
|
92
|
-
}, (0,
|
|
92
|
+
}, (0, generate_meta_js_1.generateMeta)(meta, { hasSuggestions: true }));
|
|
93
93
|
function countSpacesBefore(pattern, index) {
|
|
94
94
|
let counter = 0;
|
|
95
95
|
for (let i = index - 1; i > 0; i--) {
|
package/cjs/S6327/rule.js
CHANGED
|
@@ -52,12 +52,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
54
|
const cdk_js_1 = require("../helpers/aws/cdk.js");
|
|
55
|
-
const
|
|
55
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
56
56
|
const meta = __importStar(require("./generated-meta.js"));
|
|
57
57
|
exports.rule = (0, cdk_js_1.AwsCdkTemplate)({
|
|
58
58
|
'aws-cdk-lib.aws_sns.Topic': (0, cdk_js_1.AwsCdkCheckArguments)('SNSTopic', true, 'masterKey'),
|
|
59
59
|
'aws-cdk-lib.aws_sns.CfnTopic': (0, cdk_js_1.AwsCdkCheckArguments)('SNSCfnTopic', true, 'kmsMasterKeyId'),
|
|
60
|
-
}, (0,
|
|
60
|
+
}, (0, generate_meta_js_1.generateMeta)(meta, {
|
|
61
61
|
messages: {
|
|
62
62
|
SNSTopic: 'Omitting "masterKey" disables SNS topics encryption. Make sure it is safe here.',
|
|
63
63
|
SNSCfnTopic: 'Omitting "kmsMasterKeyId" disables SNS topics encryption. Make sure it is safe here.',
|
package/cjs/S6328/rule.js
CHANGED
|
@@ -52,20 +52,21 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
54
|
const regexpp_1 = require("@eslint-community/regexpp");
|
|
55
|
-
const
|
|
55
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
56
|
+
const parser_services_js_1 = require("../helpers/parser-services.js");
|
|
56
57
|
const meta = __importStar(require("./generated-meta.js"));
|
|
57
58
|
const group_js_1 = require("../helpers/regex/group.js");
|
|
58
59
|
const extract_js_1 = require("../helpers/regex/extract.js");
|
|
59
60
|
const ast_js_1 = require("../helpers/regex/ast.js");
|
|
60
61
|
exports.rule = {
|
|
61
|
-
meta: (0,
|
|
62
|
+
meta: (0, generate_meta_js_1.generateMeta)(meta, {
|
|
62
63
|
messages: {
|
|
63
64
|
nonExistingGroup: 'Referencing non-existing group{{groups}}.',
|
|
64
65
|
},
|
|
65
66
|
}),
|
|
66
67
|
create(context) {
|
|
67
68
|
const services = context.sourceCode.parserServices;
|
|
68
|
-
if (!(0,
|
|
69
|
+
if (!(0, parser_services_js_1.isRequiredParserServices)(services)) {
|
|
69
70
|
return {};
|
|
70
71
|
}
|
|
71
72
|
return {
|
package/cjs/S6329/rule.js
CHANGED
|
@@ -53,7 +53,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
53
|
exports.rule = void 0;
|
|
54
54
|
const cdk_js_1 = require("../helpers/aws/cdk.js");
|
|
55
55
|
const result_js_1 = require("../helpers/result.js");
|
|
56
|
-
const
|
|
56
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
57
|
+
const module_js_1 = require("../helpers/module.js");
|
|
58
|
+
const ast_js_1 = require("../helpers/ast.js");
|
|
57
59
|
const meta = __importStar(require("./generated-meta.js"));
|
|
58
60
|
const PROPERTIES_POSITION = 2;
|
|
59
61
|
const PRIVATE_SUBNETS = new Set([
|
|
@@ -68,7 +70,7 @@ exports.rule = (0, cdk_js_1.AwsCdkTemplate)({
|
|
|
68
70
|
'aws-cdk-lib.aws_rds.DatabaseInstance': checkDatabaseInstance,
|
|
69
71
|
'aws-cdk-lib.aws_rds.CfnDBInstance': (0, cdk_js_1.AwsCdkCheckArguments)('publicNetwork', false, 'publiclyAccessible', { primitives: { invalid: [true] } }),
|
|
70
72
|
'aws-cdk-lib.aws_dms.CfnReplicationInstance': (0, cdk_js_1.AwsCdkCheckArguments)('publicNetwork', true, 'publiclyAccessible', { primitives: { invalid: [true] } }),
|
|
71
|
-
}, (0,
|
|
73
|
+
}, (0, generate_meta_js_1.generateMeta)(meta, {
|
|
72
74
|
messages: {
|
|
73
75
|
publicNetwork: 'Make sure allowing public network access is safe here.',
|
|
74
76
|
},
|
|
@@ -105,7 +107,7 @@ function getSelectSubnetsCall(subnetId) {
|
|
|
105
107
|
while (current.ofType('MemberExpression')) {
|
|
106
108
|
current = current.getMemberObject();
|
|
107
109
|
}
|
|
108
|
-
return current.filter(n => n.type === 'CallExpression' && (0,
|
|
110
|
+
return current.filter(n => n.type === 'CallExpression' && (0, ast_js_1.isCallingMethod)(n, 1, 'selectSubnets'));
|
|
109
111
|
}
|
|
110
112
|
function checkDatabaseInstance(expr, ctx) {
|
|
111
113
|
const properties = (0, result_js_1.getResultOfExpression)(ctx, expr).getArgument(PROPERTIES_POSITION);
|
|
@@ -131,9 +133,9 @@ function checkDatabaseInstance(expr, ctx) {
|
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
function isPrivateSubnet(node, ctx) {
|
|
134
|
-
const subnet = (0,
|
|
136
|
+
const subnet = (0, module_js_1.getFullyQualifiedName)(ctx, node)?.replaceAll('-', '_');
|
|
135
137
|
return subnet !== undefined && PRIVATE_SUBNETS.has(subnet);
|
|
136
138
|
}
|
|
137
139
|
function isPublicSubnet(node, ctx) {
|
|
138
|
-
return PUBLIC_SUBNET === (0,
|
|
140
|
+
return PUBLIC_SUBNET === (0, module_js_1.getFullyQualifiedName)(ctx, node)?.replaceAll('-', '_');
|
|
139
141
|
}
|
package/cjs/S6330/rule.js
CHANGED
|
@@ -52,12 +52,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
54
|
const cdk_js_1 = require("../helpers/aws/cdk.js");
|
|
55
|
-
const
|
|
55
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
56
56
|
const meta = __importStar(require("./generated-meta.js"));
|
|
57
57
|
exports.rule = (0, cdk_js_1.AwsCdkTemplate)({
|
|
58
58
|
'aws-cdk-lib.aws-sqs.Queue': (0, cdk_js_1.AwsCdkCheckArguments)(['OmittedQueue', 'DisabledQueue'], true, 'encryption', { fqns: { invalid: ['aws-cdk-lib.aws-sqs.QueueEncryption.UNENCRYPTED'] } }),
|
|
59
59
|
'aws-cdk-lib.aws-sqs.CfnQueue': (0, cdk_js_1.AwsCdkCheckArguments)('CfnQueue', true, 'kmsMasterKeyId'),
|
|
60
|
-
}, (0,
|
|
60
|
+
}, (0, generate_meta_js_1.generateMeta)(meta, {
|
|
61
61
|
messages: {
|
|
62
62
|
CfnQueue: 'Omitting "kmsMasterKeyId" disables SQS queues encryption. Make sure it is safe here.',
|
|
63
63
|
OmittedQueue: 'Omitting "encryption" disables SQS queues encryption. Make sure it is safe here.',
|
package/cjs/S6332/rule.js
CHANGED
|
@@ -52,12 +52,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.rule = void 0;
|
|
54
54
|
const cdk_js_1 = require("../helpers/aws/cdk.js");
|
|
55
|
-
const
|
|
55
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
56
56
|
const meta = __importStar(require("./generated-meta.js"));
|
|
57
57
|
exports.rule = (0, cdk_js_1.AwsCdkTemplate)({
|
|
58
58
|
'aws-cdk-lib.aws_efs.FileSystem': (0, cdk_js_1.AwsCdkCheckArguments)('FSEncryptionDisabled', false, 'encrypted', { primitives: { invalid: [false] } }),
|
|
59
59
|
'aws-cdk-lib.aws_efs.CfnFileSystem': (0, cdk_js_1.AwsCdkCheckArguments)(['CFSEncryptionOmitted', 'CFSEncryptionDisabled'], true, 'encrypted', { primitives: { valid: [true] } }),
|
|
60
|
-
}, (0,
|
|
60
|
+
}, (0, generate_meta_js_1.generateMeta)(meta, {
|
|
61
61
|
messages: {
|
|
62
62
|
FSEncryptionDisabled: 'Make sure that using unencrypted file systems is safe here.',
|
|
63
63
|
CFSEncryptionDisabled: 'Make sure that using unencrypted file systems is safe here.',
|
package/cjs/S6333/rule.js
CHANGED
|
@@ -53,7 +53,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
53
|
exports.rule = void 0;
|
|
54
54
|
const cdk_js_1 = require("../helpers/aws/cdk.js");
|
|
55
55
|
const result_js_1 = require("../helpers/result.js");
|
|
56
|
-
const
|
|
56
|
+
const generate_meta_js_1 = require("../helpers/generate-meta.js");
|
|
57
|
+
const module_js_1 = require("../helpers/module.js");
|
|
58
|
+
const ast_js_1 = require("../helpers/ast.js");
|
|
57
59
|
const meta = __importStar(require("./generated-meta.js"));
|
|
58
60
|
const REST_API_PROPERTIES_POSITION = 2;
|
|
59
61
|
const RESOURCE_ADD_RESOURCE_PROPERTIES_POSITION = 1;
|
|
@@ -117,7 +119,7 @@ function consumersFactory(ctx) {
|
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
121
|
function getDefaultAuthorizationType(node) {
|
|
120
|
-
const resource = (0,
|
|
122
|
+
const resource = (0, ast_js_1.getUniqueWriteUsageOrNode)(ctx, node);
|
|
121
123
|
if (defaultAuthorizationTypes.has(resource)) {
|
|
122
124
|
return defaultAuthorizationTypes.get(resource);
|
|
123
125
|
}
|
|
@@ -142,14 +144,14 @@ function consumersFactory(ctx) {
|
|
|
142
144
|
};
|
|
143
145
|
}
|
|
144
146
|
function isSensitiveAuthorizationType(node) {
|
|
145
|
-
const fqn = (0, cdk_js_1.normalizeFQN)((0,
|
|
147
|
+
const fqn = (0, cdk_js_1.normalizeFQN)((0, module_js_1.getFullyQualifiedName)(ctx, node));
|
|
146
148
|
return fqn === NONE_AUTHORIZATION_TYPE;
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
151
|
function isDefaultFromObject(node, ...names) {
|
|
150
|
-
return node.type === 'MemberExpression' && names.some(name => (0,
|
|
152
|
+
return node.type === 'MemberExpression' && names.some(name => (0, ast_js_1.isMemberWithProperty)(node, name));
|
|
151
153
|
}
|
|
152
154
|
function isDefaultFromCallee(node) {
|
|
153
|
-
return node.type === 'CallExpression' && (0,
|
|
155
|
+
return node.type === 'CallExpression' && (0, ast_js_1.isMethodCall)(node);
|
|
154
156
|
}
|
|
155
|
-
exports.rule = (0, cdk_js_1.AwsCdkTemplate)(consumersFactory, (0,
|
|
157
|
+
exports.rule = (0, cdk_js_1.AwsCdkTemplate)(consumersFactory, (0, generate_meta_js_1.generateMeta)(meta, { messages }));
|