flagrix 0.1.2 → 0.1.3

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "2026.07.08.002",
3
- "lastUpdated": "2026-07-08T16:18:50.866Z",
3
+ "lastUpdated": "2026-07-09T09:25:31.727Z",
4
4
  "maliciousPackages": [
5
5
  {
6
6
  "name": "beavertail",
@@ -160,7 +160,7 @@
160
160
  {
161
161
  "id": "INVISIBLEFERRET_KEYLOG",
162
162
  "name": "InvisibleFerret Keylogger",
163
- "pattern": "keyboard\\.on_press|pynput\\.keyboard|keylogger",
163
+ "pattern": "keyboard\\.on_press|pynput\\.keyboard|from\\s+pynput",
164
164
  "description": "Keylogger pattern using pynput — used by Lazarus Group's InvisibleFerret Python malware",
165
165
  "tags": [
166
166
  "lazarus",
@@ -679,7 +679,7 @@
679
679
  {
680
680
  "id": "OBF_EVAL",
681
681
  "name": "eval() Usage",
682
- "pattern": "eval\\s*\\([^)]{0,200}\\)",
682
+ "pattern": "eval\\s*\\(\\s*[^)\\s][^)]{0,200}\\)",
683
683
  "description": "eval() executes arbitrary dynamic code. While there are legitimate uses, eval() is the #1 technique for executing hidden malicious payloads.\n",
684
684
  "tags": [
685
685
  "eval",
@@ -445,6 +445,53 @@ function stringEnd(line, start) {
445
445
  }
446
446
  return line.length;
447
447
  }
448
+ function maskStringLiterals(content) {
449
+ let out = "";
450
+ let i = 0;
451
+ let quote = null;
452
+ while (i < content.length) {
453
+ const ch = content[i];
454
+ if (quote) {
455
+ if (ch === "\\") {
456
+ out += " ";
457
+ i += 2;
458
+ continue;
459
+ }
460
+ if (ch === quote) {
461
+ quote = null;
462
+ out += ch;
463
+ } else {
464
+ out += ch === "\n" ? "\n" : " ";
465
+ }
466
+ i++;
467
+ continue;
468
+ }
469
+ if (ch === '"' || ch === "'" || ch === "`") {
470
+ quote = ch;
471
+ out += ch;
472
+ i++;
473
+ continue;
474
+ }
475
+ if (ch === "/" && content[i + 1] === "/") {
476
+ let j = content.indexOf("\n", i);
477
+ if (j === -1)
478
+ j = content.length;
479
+ out += content.slice(i, j);
480
+ i = j;
481
+ continue;
482
+ }
483
+ if (ch === "/" && content[i + 1] === "*") {
484
+ const close = content.indexOf("*/", i + 2);
485
+ const j = close === -1 ? content.length : close + 2;
486
+ out += content.slice(i, j);
487
+ i = j;
488
+ continue;
489
+ }
490
+ out += ch;
491
+ i++;
492
+ }
493
+ return out;
494
+ }
448
495
 
449
496
  // node_modules/@flagrix/scanner-core/dist/github/api-error.js
450
497
  async function githubApiError(response, fallback = "GitHub API error") {
@@ -634,7 +681,11 @@ async function scanGitHubRepo(repo, options) {
634
681
  continue;
635
682
  const fileData = await contentResponse.json();
636
683
  const content = atob(fileData.content || "");
637
- const matchable = /\.(?:js|ts)$/.test(file.path) ? maskRegexLiterals(content) : content;
684
+ const isJsTs = /\.(?:js|ts)$/.test(file.path);
685
+ let matchable = isJsTs ? maskRegexLiterals(content) : content;
686
+ if (isJsTs && isTestFile(file.path)) {
687
+ matchable = maskStringLiterals(matchable);
688
+ }
638
689
  if (SCANNABLE_EXTENSIONS.some((ext) => file.path.endsWith(ext))) {
639
690
  fileContents.push({ path: file.path, content: matchable });
640
691
  }
@@ -849,7 +900,8 @@ function detectObfuscation(content, filePath, coveredRuleIds = /* @__PURE__ */ n
849
900
  });
850
901
  }
851
902
  const evalPatterns = [
852
- { pattern: /eval\s*\([^)]{0,200}\)/gi, name: "eval", ruleId: BUILTIN_OBFUSCATION_RULE_IDS.eval },
903
+ // Non-empty argument required: bare "eval()" appears in prose/docs.
904
+ { pattern: /eval\s*\(\s*[^)\s][^)]{0,200}\)/gi, name: "eval", ruleId: BUILTIN_OBFUSCATION_RULE_IDS.eval },
853
905
  { pattern: /new\s+Function\s*\([^)]{0,200}\)/gi, name: "Function constructor", ruleId: BUILTIN_OBFUSCATION_RULE_IDS.newFunction },
854
906
  { pattern: /setTimeout\s*\(\s*["'`][^"'`]{0,200}["'`]/gi, name: "setTimeout with string", ruleId: BUILTIN_OBFUSCATION_RULE_IDS.timerString },
855
907
  { pattern: /setInterval\s*\(\s*["'`][^"'`]{0,200}["'`]/gi, name: "setInterval with string", ruleId: BUILTIN_OBFUSCATION_RULE_IDS.timerString }
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  scanGitHubRepo,
12
12
  scanGitHubUser,
13
13
  wantJson
14
- } from "./chunk-AS7DXMSG.js";
14
+ } from "./chunk-BOICDXGY.js";
15
15
 
16
16
  // src/cli.ts
17
17
  import { parseArgs } from "util";
@@ -132,7 +132,7 @@ async function main() {
132
132
  }
133
133
  return runScanUser(target, { json: values.json, token: values.token });
134
134
  case "mcp": {
135
- const { runMcp } = await import("./mcp-LS7GRB2C.js");
135
+ const { runMcp } = await import("./mcp-CWPBDBCD.js");
136
136
  return runMcp();
137
137
  }
138
138
  default:
@@ -7,7 +7,7 @@ import {
7
7
  scanGitHubRepo,
8
8
  scanGitHubUser,
9
9
  securityScore
10
- } from "./chunk-AS7DXMSG.js";
10
+ } from "./chunk-BOICDXGY.js";
11
11
 
12
12
  // src/commands/mcp.ts
13
13
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flagrix",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Scan GitHub repos and profiles for malware before you clone — CLI and MCP server for the Flagrix scanner",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -51,7 +51,7 @@
51
51
  "zod": "^3.24.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@flagrix/scanner-core": "^0.1.2",
54
+ "@flagrix/scanner-core": "^0.1.3",
55
55
  "@types/node": "^20.0.0",
56
56
  "tsup": "^8.0.0",
57
57
  "typescript": "^5.0.0",