@oxog/codeguardian 1.0.0 → 1.0.1
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/cli.cjs +13 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +13 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/plugins/index.cjs +8 -3
- package/dist/plugins/index.cjs.map +1 -1
- package/dist/plugins/index.js +8 -3
- package/dist/plugins/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -638,7 +638,11 @@ function resolveImportPath(fromFile, importSource, _rootDir) {
|
|
|
638
638
|
}
|
|
639
639
|
const fromDir = path7__namespace.dirname(fromFile);
|
|
640
640
|
let resolved = path7__namespace.posix.join(fromDir, importSource);
|
|
641
|
-
if (
|
|
641
|
+
if (resolved.endsWith(".js")) {
|
|
642
|
+
resolved = resolved.slice(0, -3) + ".ts";
|
|
643
|
+
} else if (resolved.endsWith(".jsx")) {
|
|
644
|
+
resolved = resolved.slice(0, -4) + ".tsx";
|
|
645
|
+
} else if (!resolved.endsWith(".ts") && !resolved.endsWith(".tsx")) {
|
|
642
646
|
resolved = resolved + ".ts";
|
|
643
647
|
}
|
|
644
648
|
return resolved.replace(/\\/g, "/");
|
|
@@ -1821,7 +1825,11 @@ function resolveImport(fromFile, source) {
|
|
|
1821
1825
|
else if (part !== ".") resolved.push(part);
|
|
1822
1826
|
}
|
|
1823
1827
|
let result = resolved.join("/");
|
|
1824
|
-
if (
|
|
1828
|
+
if (result.endsWith(".js")) {
|
|
1829
|
+
result = result.slice(0, -3) + ".ts";
|
|
1830
|
+
} else if (result.endsWith(".jsx")) {
|
|
1831
|
+
result = result.slice(0, -4) + ".tsx";
|
|
1832
|
+
} else if (!result.endsWith(".ts") && !result.endsWith(".tsx")) {
|
|
1825
1833
|
result += ".ts";
|
|
1826
1834
|
}
|
|
1827
1835
|
return result;
|
|
@@ -2124,7 +2132,8 @@ function securityPlugin(config = {}) {
|
|
|
2124
2132
|
if (ts2__default.default.isPropertyAccessExpression(call.expression)) {
|
|
2125
2133
|
if (ts2__default.default.isIdentifier(call.expression.expression) && call.expression.expression.text === "Math" && call.expression.name.text === "random") {
|
|
2126
2134
|
const fileText = context.ast.getFullText();
|
|
2127
|
-
const isSecurityContext = fileText.includes("token") || fileText.includes("secret") ||
|
|
2135
|
+
const isSecurityContext = fileText.includes("token") || fileText.includes("secret") || // codeguardian-disable-next-line security/hardcoded-secret -- detection keyword, not a real secret
|
|
2136
|
+
fileText.includes("password") || fileText.includes("hash") || fileText.includes("crypto") || fileText.includes("session");
|
|
2128
2137
|
if (isSecurityContext) {
|
|
2129
2138
|
const pos = context.ast.getLineAndCharacterOfPosition(call.getStart(context.ast));
|
|
2130
2139
|
findings.push({
|
|
@@ -2184,7 +2193,7 @@ function securityPlugin(config = {}) {
|
|
|
2184
2193
|
}
|
|
2185
2194
|
};
|
|
2186
2195
|
}
|
|
2187
|
-
var DB_CALL_PATTERNS = ["find", "findOne", "findAll", "findById", "query", "execute", "fetch", "
|
|
2196
|
+
var DB_CALL_PATTERNS = ["find", "findOne", "findAll", "findById", "query", "execute", "fetch", "select"];
|
|
2188
2197
|
var SYNC_FS_METHODS = ["readFileSync", "writeFileSync", "appendFileSync", "mkdirSync", "readdirSync", "statSync", "existsSync", "unlinkSync", "copyFileSync"];
|
|
2189
2198
|
function performancePlugin(config = {}) {
|
|
2190
2199
|
const fullConfig = {
|