@fabriziosalmi/slopless 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -28
- package/dist/engine/api.js +122 -122
- package/dist/index.d.ts +1 -0
- package/dist/index.js +167 -167
- package/package.json +1 -1
- package/rules/VBC-949.yaml +29 -0
- package/rules/VBC-950.yaml +41 -0
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
id: VBC-949
|
|
2
|
+
name: committed-private-key
|
|
3
|
+
severity: error
|
|
4
|
+
category: security
|
|
5
|
+
tags:
|
|
6
|
+
- security
|
|
7
|
+
- secrets
|
|
8
|
+
- git
|
|
9
|
+
match:
|
|
10
|
+
# Asked over the tracked files on every run, not only over staged ones: every
|
|
11
|
+
# other git check reads what is about to be committed, which is right for
|
|
12
|
+
# "you are adding a .env" and wrong for a key that was committed two years ago
|
|
13
|
+
# and is still in the tree.
|
|
14
|
+
#
|
|
15
|
+
# A .p12, .pfx, .jks or .keystore holds nothing else, so the extension settles
|
|
16
|
+
# it. A .pem or .key does not — half of them are certificates, which are
|
|
17
|
+
# public and exist to be handed out — so those are read, and only the ones
|
|
18
|
+
# carrying a PRIVATE KEY header are reported.
|
|
19
|
+
#
|
|
20
|
+
# Matching that header in any file was measured and thrown away: across 24,876
|
|
21
|
+
# files it fired 85 times, and 83 were test fixtures, code that writes the
|
|
22
|
+
# header, documentation about keys, and three YARA rules whose job is to find
|
|
23
|
+
# private keys. The signal is the file, not the string.
|
|
24
|
+
git_check: private_key
|
|
25
|
+
message: >-
|
|
26
|
+
A private key is committed here. Rotate it: it is in the history, and deleting the file
|
|
27
|
+
does not take it out of there. Certificates are not reported; they are public.
|
|
28
|
+
tests:
|
|
29
|
+
external: 'git-checker.test.ts: needs a file list and a PEM header'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
id: VBC-950
|
|
2
|
+
name: window-open-without-noopener
|
|
3
|
+
severity: error
|
|
4
|
+
category: security
|
|
5
|
+
tags:
|
|
6
|
+
- security
|
|
7
|
+
match:
|
|
8
|
+
# `target="_blank"` on an anchor has implied `noopener` in every browser since
|
|
9
|
+
# 2021. `window.open` never has: the page it opens gets `window.opener` and
|
|
10
|
+
# can navigate this one somewhere else while the user is looking away.
|
|
11
|
+
#
|
|
12
|
+
# Two shapes are not that. Opening a blank window returns a handle the code is
|
|
13
|
+
# about to use — `const win = window.open('', '_blank'); win.document.write(…)`
|
|
14
|
+
# — and `noopener` makes that handle null, so an empty first argument, an
|
|
15
|
+
# explicit about:blank, and no argument at all are all left alone.
|
|
16
|
+
regex: >-
|
|
17
|
+
window\.open\(\s*(?!\))(?!['"`]\s*['"`])(?!['"`]about:blank)(?![^\n]*noopener)
|
|
18
|
+
scan: code
|
|
19
|
+
file_types:
|
|
20
|
+
- js
|
|
21
|
+
- ts
|
|
22
|
+
- tsx
|
|
23
|
+
- jsx
|
|
24
|
+
- astro
|
|
25
|
+
message: >-
|
|
26
|
+
window.open() at line {line} without 'noopener'. The page it opens gets a handle on this
|
|
27
|
+
one and can navigate it. Pass 'noopener' in the third argument, or keep the handle
|
|
28
|
+
deliberately if the code needs it.
|
|
29
|
+
tests:
|
|
30
|
+
fire:
|
|
31
|
+
- window.open(url, '_blank');
|
|
32
|
+
- window.open(`${base}/issues/new`, '_blank')
|
|
33
|
+
- onClick={() => window.open(previewUrl, '_blank')}
|
|
34
|
+
quiet:
|
|
35
|
+
- window.open(url, '_blank', 'noopener');
|
|
36
|
+
- window.open(target, "_blank", "noopener,noreferrer");
|
|
37
|
+
# A blank window is opened for its handle, which noopener would take away.
|
|
38
|
+
- const win = window.open('', '_blank');
|
|
39
|
+
- const win = window.open("about:blank");
|
|
40
|
+
- const win = window.open();
|
|
41
|
+
- popup.close();
|