@fabriziosalmi/slopless 1.4.2 → 1.4.4
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/dist/engine/api.js +87 -87
- package/dist/index.d.ts +3 -1
- package/dist/index.js +128 -127
- package/package.json +1 -1
- package/rules/VBC-010.yaml +3 -1
- package/rules/VBC-034.yaml +3 -1
- package/rules/VBC-070.yaml +6 -1
- package/rules/VBC-077.yaml +23 -0
package/package.json
CHANGED
package/rules/VBC-010.yaml
CHANGED
|
@@ -6,7 +6,7 @@ tags:
|
|
|
6
6
|
- accessibility
|
|
7
7
|
- html
|
|
8
8
|
match:
|
|
9
|
-
regex: <div[^>]*\s(onclick|onClick)=
|
|
9
|
+
regex: <div[^>]*\s(onclick|onClick)=(?!\{?\s*\(?\s*(?:e|ev|evt|event|_e)\s*\)?\s*=>\s*\{?\s*(?:e|ev|evt|event|_e)\.(?:stopPropagation|preventDefault)\(\)\s*\}?\s*\})
|
|
10
10
|
file_types:
|
|
11
11
|
- html
|
|
12
12
|
- js
|
|
@@ -22,3 +22,5 @@ tests:
|
|
|
22
22
|
- <div onClick={handleClick}>Save</div>
|
|
23
23
|
quiet:
|
|
24
24
|
- <button onClick={handleClick}>Save</button>
|
|
25
|
+
- <div className="row" onClick={(e) => e.stopPropagation()}>
|
|
26
|
+
- <div onClick={e => e.preventDefault()}>
|
package/rules/VBC-034.yaml
CHANGED
|
@@ -6,7 +6,7 @@ tags:
|
|
|
6
6
|
- security
|
|
7
7
|
match:
|
|
8
8
|
regex: >-
|
|
9
|
-
http://(?!localhost|127
|
|
9
|
+
http://(?!localhost|127\.|0\.0\.0\.0|169\.254\.|\[::1\]|test\b|example\.(?:com|org)|www\.w3\.org|schemas?\.|json-schema\.org|purl\.org|ns\.adobe|www\.apache\.org)
|
|
10
10
|
scan: strings
|
|
11
11
|
file_types:
|
|
12
12
|
- js
|
|
@@ -38,4 +38,6 @@ tests:
|
|
|
38
38
|
quiet:
|
|
39
39
|
- const api = 'https://api.example.com/v1';
|
|
40
40
|
- const dev = 'http://localhost:3000';
|
|
41
|
+
- const dev2 = 'http://127.0.0.1:8000';
|
|
42
|
+
- "refuse http://169.254.169.254 (cloud metadata) before connecting"
|
|
41
43
|
- const svg = 'http://www.w3.org/2000/svg';
|
package/rules/VBC-070.yaml
CHANGED
|
@@ -5,7 +5,8 @@ category: core
|
|
|
5
5
|
tags:
|
|
6
6
|
- security
|
|
7
7
|
match:
|
|
8
|
-
regex:
|
|
8
|
+
regex: >-
|
|
9
|
+
\.innerHTML\s*=(?!=)(?!\s*(['"])(?:(?!\1)[^\\])*\1\s*[;\n])
|
|
9
10
|
file_types:
|
|
10
11
|
- js
|
|
11
12
|
- ts
|
|
@@ -14,6 +15,10 @@ message: >-
|
|
|
14
15
|
tests:
|
|
15
16
|
fire:
|
|
16
17
|
- el.innerHTML = markup;
|
|
18
|
+
- el.innerHTML = "<b>" + name + "</b>";
|
|
19
|
+
- el.innerHTML = `<b>${name}</b>`;
|
|
17
20
|
quiet:
|
|
18
21
|
- el.textContent = text;
|
|
22
|
+
- alert.innerHTML = '<i class="fa-check"></i> <span id="t"></span>';
|
|
23
|
+
- el.innerHTML = "";
|
|
19
24
|
- if (el.innerHTML === "") { init(); }
|
package/rules/VBC-077.yaml
CHANGED
|
@@ -18,6 +18,13 @@ tests:
|
|
|
18
18
|
this.cache.set(id, 1);
|
|
19
19
|
return id;
|
|
20
20
|
}
|
|
21
|
+
- |
|
|
22
|
+
class E {
|
|
23
|
+
getLevel() {
|
|
24
|
+
if (!this.buf) { this.hits = this.hits + 1; }
|
|
25
|
+
return this.buf;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
21
28
|
quiet:
|
|
22
29
|
- |
|
|
23
30
|
function getUser(id) {
|
|
@@ -27,6 +34,22 @@ tests:
|
|
|
27
34
|
function getOffset(node) {
|
|
28
35
|
return node.dataset.offset;
|
|
29
36
|
}
|
|
37
|
+
- |
|
|
38
|
+
class E {
|
|
39
|
+
getMasterLevel() {
|
|
40
|
+
if (!this.buf || this.buf.length !== this.analyser.fftSize) {
|
|
41
|
+
this.buf = new Float32Array(this.analyser.fftSize);
|
|
42
|
+
}
|
|
43
|
+
return rms(this.buf);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
- |
|
|
47
|
+
class R {
|
|
48
|
+
async fetchFromRemote(url) {
|
|
49
|
+
this.fetched = true;
|
|
50
|
+
return fetch(url);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
30
53
|
- |
|
|
31
54
|
function getAll() {
|
|
32
55
|
const out = [];
|