admin0911 1.0.2 → 1.0.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/admin0911-1.0.4.tgz +0 -0
- package/index.js +5 -2
- package/package.json +1 -1
- package/admin0911-1.0.2.tgz +0 -0
|
Binary file
|
package/index.js
CHANGED
|
@@ -23,11 +23,14 @@ function base64UrlDecode(input) {
|
|
|
23
23
|
function isValidJWT(token) {
|
|
24
24
|
const parts = token.split('.');
|
|
25
25
|
if (parts.length !== 3) return false;
|
|
26
|
-
if (parts.
|
|
26
|
+
if (parts[0].length < 15 || parts[1].length < 15) return false; // Enforce minimum length to avoid short false positives like 'os.path.join'
|
|
27
|
+
// Check that the parts only contain valid base64url characters
|
|
28
|
+
if (!/^[A-Za-z0-9_-]+$/.test(parts[0]) || !/^[A-Za-z0-9_-]+$/.test(parts[1])) return false;
|
|
27
29
|
try {
|
|
28
30
|
const header = JSON.parse(base64UrlDecode(parts[0]));
|
|
29
31
|
const payload = JSON.parse(base64UrlDecode(parts[1]));
|
|
30
|
-
|
|
32
|
+
// Must look like a real JWT header
|
|
33
|
+
return !!(header && (header.typ === 'JWT' || header.alg) && payload);
|
|
31
34
|
} catch {
|
|
32
35
|
return false;
|
|
33
36
|
}
|
package/package.json
CHANGED
package/admin0911-1.0.2.tgz
DELETED
|
Binary file
|