kodingo-cli 1.1.3 → 1.1.5

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.
@@ -19,7 +19,7 @@ const security_code_analyzer_1 = require("../utils/security-code-analyzer");
19
19
  const context_assembler_1 = require("../utils/context-assembler");
20
20
  const ast_parser_1 = require("../utils/ast-parser");
21
21
  const IGNORED_DIRS = new Set(["node_modules", ".git", ".kortex", "dist", "build", "vendor", "out", ".next"]);
22
- const SUPPORTED_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".py", ".go", ".rs", ".php", ".java", ".kt", ".rb", ".c", ".cpp"];
22
+ const SUPPORTED_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".py", ".go", ".rs", ".php", ".java", ".kt", ".rb", ".c", ".cpp", ".html", ".phtml", ".twig", ".blade.php"];
23
23
  function walkFiles(dir) {
24
24
  const results = [];
25
25
  try {
@@ -196,6 +196,63 @@ const RULES = [
196
196
  regex: /res\.cookie\s*\([^)]+\)(?!.*httpOnly)(?!.*secure)/,
197
197
  description: "Cookie set without httpOnly or Secure flags — session cookie may be accessible to JavaScript or transmitted over HTTP.",
198
198
  },
199
+ // ── PHP-specific patterns ──────────────────────────────────────────────────
200
+ {
201
+ type: "sql_injection",
202
+ severity: "critical",
203
+ regex: /mysqli_query\s*\([^,]+,\s*["'][^"']*["']\s*\.\s*\$|\$pdo->query\s*\(\s*["'][^"']*["']\s*\.\s*\$/,
204
+ description: "PHP SQL query built with string concatenation — use prepared statements with bound parameters.",
205
+ languages: ["php"],
206
+ },
207
+ {
208
+ type: "sql_injection",
209
+ severity: "critical",
210
+ regex: /\$_(?:GET|POST|REQUEST|COOKIE)\[[^\]]+\][^;\n]*(?:query|execute|mysqli_query)/,
211
+ description: "Unsanitised PHP superglobal used directly in a database query — SQL injection vulnerability.",
212
+ languages: ["php"],
213
+ },
214
+ {
215
+ type: "command_injection",
216
+ severity: "critical",
217
+ regex: /(?:exec|shell_exec|system|passthru|popen)\s*\([^)]*\$_(?:GET|POST|REQUEST|COOKIE)/,
218
+ description: "PHP shell execution with unsanitised user input — command injection vulnerability.",
219
+ languages: ["php"],
220
+ },
221
+ {
222
+ type: "path_traversal",
223
+ severity: "high",
224
+ regex: /(?:include|require|include_once|require_once|file_get_contents|fopen|readfile)\s*\([^)]*\$_(?:GET|POST|REQUEST)/,
225
+ description: "PHP file inclusion with unsanitised user input — path traversal or local file inclusion vulnerability.",
226
+ languages: ["php"],
227
+ },
228
+ {
229
+ type: "hardcoded_secret",
230
+ severity: "high",
231
+ regex: /\$(?:password|passwd|secret|api_key|apikey|token|private_key)\s*=\s*['"][A-Za-z0-9_\-\/+=]{12,}['"]/i,
232
+ description: "PHP hardcoded credential — store secrets in environment variables, not source code.",
233
+ languages: ["php"],
234
+ },
235
+ {
236
+ type: "ssrf",
237
+ severity: "high",
238
+ regex: /(?:curl_init|file_get_contents|fopen)\s*\([^)]*\$_(?:GET|POST|REQUEST)/,
239
+ description: "PHP HTTP request using unsanitised user input as URL — SSRF vulnerability.",
240
+ languages: ["php"],
241
+ },
242
+ {
243
+ type: "insecure_crypto",
244
+ severity: "high",
245
+ regex: /md5\s*\(\s*\$(?:password|passwd|pass)|sha1\s*\(\s*\$(?:password|passwd|pass)/,
246
+ description: "PHP password hashed with MD5 or SHA1 — use password_hash() with PASSWORD_BCRYPT.",
247
+ languages: ["php"],
248
+ },
249
+ {
250
+ type: "open_redirect",
251
+ severity: "high",
252
+ regex: /header\s*\(\s*['"]Location:\s*['"]\s*\.\s*\$_(?:GET|POST|REQUEST)/,
253
+ description: "PHP Location header set from unsanitised user input — open redirect vulnerability.",
254
+ languages: ["php"],
255
+ },
199
256
  ];
200
257
  /**
201
258
  * Scans a single symbol's body against all pattern rules. Returns every match —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kodingo-cli",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Kodingo CLI",
5
5
  "license": "MIT",
6
6
  "private": false,