Skip to content

Commit d8c8ed1

Browse files
authored
Merge pull request #493 from AikidoSec/fix-mysql2-hooks
Fix mysql2 hooks
2 parents ef592e3 + 3e05fd1 commit d8c8ed1

11 files changed

+326
-146
lines changed

library/helpers/satisfiesVersion.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ t.test("it matches single range", async () => {
3636
t.equal(satisfiesVersion("^1.0.0", "0.0.0"), false);
3737
t.equal(satisfiesVersion("^1.0.0", "2.0.0"), false);
3838
t.equal(satisfiesVersion("^2.0.0", "1.0.0"), false);
39+
t.equal(satisfiesVersion("^1.2.1", "1.3.0"), true);
40+
t.equal(satisfiesVersion("^1.2.1", "1.2.0"), false);
3941
});
4042

4143
t.test("it matches multiple ranges", async () => {

library/helpers/satisfiesVersion.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,19 @@ export function satisfiesVersion(range: string, version: string) {
4949
.split(".")
5050
.map((p) => parseInt(p, 10));
5151

52-
if (major === rMajor && minor >= rMinor && patch >= rPatch) {
53-
return true;
52+
if (major !== rMajor) {
53+
continue;
54+
}
55+
56+
if (minor < rMinor) {
57+
continue;
5458
}
59+
60+
if (minor === rMinor && patch < rPatch) {
61+
continue;
62+
}
63+
64+
return true;
5565
}
5666

5767
return false;

library/package-lock.json

Lines changed: 64 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@
9797
"mongodb-v5": "npm:mongodb@^5.0.0",
9898
"mongodb-v6": "npm:mongodb@^6.0.0",
9999
"mysql": "^2.18.1",
100-
"mysql2": "^3.10.0",
100+
"mysql2-v3.10": "npm:mysql2@3.10",
101+
"mysql2-v3.12": "npm:mysql2@3.12",
101102
"needle": "^3.3.1",
102103
"node-fetch": "^2",
103104
"percentile": "^1.6.0",

library/sinks/MySQL2.test.ts

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)