flagrix 0.5.1 → 0.6.0
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
|
-
"version": "2026.11.
|
|
3
|
-
"lastUpdated": "2026-11-
|
|
2
|
+
"version": "2026.11.18.001",
|
|
3
|
+
"lastUpdated": "2026-11-18T14:13:43.540Z",
|
|
4
4
|
"maliciousPackages": [
|
|
5
5
|
{
|
|
6
6
|
"name": "beavertail",
|
|
@@ -1738,6 +1738,181 @@
|
|
|
1738
1738
|
".yaml"
|
|
1739
1739
|
]
|
|
1740
1740
|
},
|
|
1741
|
+
{
|
|
1742
|
+
"id": "DOWNLOAD_FROM_IP_EXEC",
|
|
1743
|
+
"name": "Download From a Bare IP Address Executed",
|
|
1744
|
+
"pattern": "\\b(?:curl|wget|iwr|Invoke-WebRequest|Invoke-RestMethod)\\b[^\\n|]{0,200}https?:\\/\\/(?!127\\.|10\\.|0\\.|192\\.168\\.|172\\.(?:1[6-9]|2[0-9]|3[01])\\.)\\d{1,3}(?:\\.\\d{1,3}){3}[^\\n|]{0,200}\\|\\s*(?:sudo\\s+)?(?:(?:ba|z)?sh|dash|python3?|perl|node|iex)\\b|\\b(?:curl|wget)\\b[^\\n]{0,200}https?:\\/\\/(?!127\\.|10\\.|0\\.|192\\.168\\.|172\\.(?:1[6-9]|2[0-9]|3[01])\\.)\\d{1,3}(?:\\.\\d{1,3}){3}[^\\n]{0,200}(?:&&|;|\\n)[ \\t]*(?:sudo[ \\t]+)?(?:(?:ba|z)?sh|python3?|node)[ \\t]",
|
|
1745
|
+
"description": "Fetches a script from a hard-coded public IP and runs it. Release tooling uses names, not addresses; loopback and RFC1918 ranges are excluded so local dev scripts don't match.\n",
|
|
1746
|
+
"tags": [
|
|
1747
|
+
"download-exec",
|
|
1748
|
+
"clickfix",
|
|
1749
|
+
"loader"
|
|
1750
|
+
],
|
|
1751
|
+
"severity": "high",
|
|
1752
|
+
"confidence": "high"
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
"id": "DOCKERFILE_RUNS_ASSET_FILE",
|
|
1756
|
+
"name": "Container Build Runs a Font/Image/Text File",
|
|
1757
|
+
"pattern": "(?:^|\\n)[ \\t]*RUN\\b[^\\n]{0,300}\\b(?:node|bun|deno run|python3?)[ \\t]+[^\\n \\t\\\"']{0,120}\\.(?:woff2?|ttf|otf|eot|svg|png|jpe?g|gif|ico|webp|css|scss|dict|txt|md|dat|log)\\b",
|
|
1758
|
+
"description": "`RUN node app/fonts/fa-solid-900.woff2` — the Contagious Interview masquerade moved into the image build, where review attention is lowest.\n",
|
|
1759
|
+
"tags": [
|
|
1760
|
+
"docker",
|
|
1761
|
+
"masquerade",
|
|
1762
|
+
"contagious-interview"
|
|
1763
|
+
],
|
|
1764
|
+
"severity": "critical",
|
|
1765
|
+
"confidence": "high",
|
|
1766
|
+
"fileExtensions": [
|
|
1767
|
+
".dockerfile.sh"
|
|
1768
|
+
]
|
|
1769
|
+
},
|
|
1770
|
+
{
|
|
1771
|
+
"id": "COMPOSE_DOCKER_SOCKET_MOUNT",
|
|
1772
|
+
"name": "Compose Service Mounts the Docker Socket",
|
|
1773
|
+
"pattern": "(?:^|\\n)[ \\t]*(?:-[ \\t]+[\\\"']?|source:[ \\t]*[\\\"']?)(?:\\/var)?\\/run\\/docker\\.sock",
|
|
1774
|
+
"description": "A service with /var/run/docker.sock controls the host daemon — container escape by design. Traefik, Portainer and Watchtower do this legitimately, so it is a review signal, not a verdict.\n",
|
|
1775
|
+
"tags": [
|
|
1776
|
+
"docker",
|
|
1777
|
+
"compose",
|
|
1778
|
+
"privilege-escalation"
|
|
1779
|
+
],
|
|
1780
|
+
"severity": "high",
|
|
1781
|
+
"confidence": "medium",
|
|
1782
|
+
"fileExtensions": [
|
|
1783
|
+
".compose.yml"
|
|
1784
|
+
]
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
"id": "COMPOSE_HOST_FILESYSTEM_MOUNT",
|
|
1788
|
+
"name": "Compose Service Mounts the Host Filesystem",
|
|
1789
|
+
"pattern": "(?:^|\\n)[ \\t]*-[ \\t]+[\\\"']?(?:\\/(?:etc|root|home|Users)(?:\\/[^\\n:]{0,60})?|\\/|\\$\\{?HOME\\}?(?:\\/[^\\n:]{0,60})?|~(?:\\/[^\\n:]{0,60})?):",
|
|
1790
|
+
"description": "Binds /, /etc, /root, /home or the host home directory into a container — everything in it, credentials included, becomes readable and writable by the image. Project-relative mounts (./data:/data) do not match.\n",
|
|
1791
|
+
"tags": [
|
|
1792
|
+
"docker",
|
|
1793
|
+
"compose",
|
|
1794
|
+
"credential-access"
|
|
1795
|
+
],
|
|
1796
|
+
"severity": "high",
|
|
1797
|
+
"confidence": "medium",
|
|
1798
|
+
"fileExtensions": [
|
|
1799
|
+
".compose.yml"
|
|
1800
|
+
]
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
"id": "COMPOSE_PRIVILEGED_CONTAINER",
|
|
1804
|
+
"name": "Compose Service Drops Container Isolation",
|
|
1805
|
+
"pattern": "(?:^|\\n)[ \\t]*(?:privileged[ \\t]*:[ \\t]*(?:true|yes)\\b|pid[ \\t]*:[ \\t]*[\\\"']?host\\b|cap_add[ \\t]*:[\\s\\S]{0,120}?\\bSYS_(?:ADMIN|PTRACE)\\b)",
|
|
1806
|
+
"description": "privileged: true, pid: host or CAP_SYS_ADMIN / CAP_SYS_PTRACE give a service the host's devices and process table. Some dev setups need it (dind, hardware access), so treat it as context for the rest of the scan.\n",
|
|
1807
|
+
"tags": [
|
|
1808
|
+
"docker",
|
|
1809
|
+
"compose",
|
|
1810
|
+
"privilege-escalation"
|
|
1811
|
+
],
|
|
1812
|
+
"severity": "medium",
|
|
1813
|
+
"confidence": "medium",
|
|
1814
|
+
"fileExtensions": [
|
|
1815
|
+
".compose.yml"
|
|
1816
|
+
]
|
|
1817
|
+
},
|
|
1818
|
+
{
|
|
1819
|
+
"id": "COMPOSE_COMMAND_DOWNLOAD_EXEC",
|
|
1820
|
+
"name": "Compose Service Command Pipes a Download into a Shell",
|
|
1821
|
+
"pattern": "(?:^|\\n)[ \\t]*(?:command|entrypoint)[ \\t]*:[\\s\\S]{0,300}?\\b(?:curl|wget)\\b[^\\n]{0,200}\\|[ \\t]*(?:sudo[ \\t]+)?(?:(?:ba|z)?sh|python3?|node|perl)\\b",
|
|
1822
|
+
"description": "`command: curl ... | sh` in a compose service: the image's own build is not doing the install, a remote script is, every time the stack comes up.\n",
|
|
1823
|
+
"tags": [
|
|
1824
|
+
"docker",
|
|
1825
|
+
"compose",
|
|
1826
|
+
"download-exec"
|
|
1827
|
+
],
|
|
1828
|
+
"severity": "high",
|
|
1829
|
+
"confidence": "medium",
|
|
1830
|
+
"fileExtensions": [
|
|
1831
|
+
".compose.yml"
|
|
1832
|
+
]
|
|
1833
|
+
},
|
|
1834
|
+
{
|
|
1835
|
+
"id": "DEVCONTAINER_COMMAND_DOWNLOAD_EXEC",
|
|
1836
|
+
"name": "Devcontainer Lifecycle Command Pipes a Download into a Shell",
|
|
1837
|
+
"pattern": "\\\"(?:initialize|onCreate|updateContent|postCreate|postStart|postAttach)Command\\\"[ \\t]*:[\\s\\S]{0,300}?(?:\\bcurl\\b|\\bwget\\b|\\biwr\\b|Invoke-WebRequest|Invoke-RestMethod)[\\s\\S]{0,300}?\\|[ \\t]*(?:sudo[ \\t]+)?(?:(?:ba|z)?sh|cmd|iex|powershell|pwsh|python3?|node)\\b",
|
|
1838
|
+
"description": "initializeCommand runs on the host and onCreate/postCreateCommand run as soon as the editor opens the folder — the devcontainer form of the Contagious Interview task file. CONFIG_COMMAND_DOWNLOAD_EXEC only covers the \"command\" key, which these configs do not use.\n",
|
|
1839
|
+
"tags": [
|
|
1840
|
+
"devcontainer",
|
|
1841
|
+
"auto-exec",
|
|
1842
|
+
"download",
|
|
1843
|
+
"contagious-interview"
|
|
1844
|
+
],
|
|
1845
|
+
"severity": "critical",
|
|
1846
|
+
"confidence": "high",
|
|
1847
|
+
"fileExtensions": [
|
|
1848
|
+
".json"
|
|
1849
|
+
],
|
|
1850
|
+
"fileNames": [
|
|
1851
|
+
"devcontainer.json",
|
|
1852
|
+
".devcontainer.json"
|
|
1853
|
+
]
|
|
1854
|
+
},
|
|
1855
|
+
{
|
|
1856
|
+
"id": "DEVCONTAINER_RUNS_ASSET_FILE",
|
|
1857
|
+
"name": "Devcontainer Lifecycle Command Runs a Font/Image/Text File",
|
|
1858
|
+
"pattern": "\\\"(?:initialize|onCreate|updateContent|postCreate|postStart|postAttach)Command\\\"[ \\t]*:[\\s\\S]{0,200}?\\b(?:node|bun|deno|python3?)\\b[^\\\"\\n]{0,120}\\.(?:woff2?|ttf|otf|eot|svg|png|jpe?g|gif|ico|webp|css|scss|dict|txt|md|dat|log)\\b",
|
|
1859
|
+
"description": "`postCreateCommand: node .devcontainer/card4.jpeg` — JS disguised as an asset, started by opening the folder.\n",
|
|
1860
|
+
"tags": [
|
|
1861
|
+
"devcontainer",
|
|
1862
|
+
"auto-exec",
|
|
1863
|
+
"masquerade",
|
|
1864
|
+
"contagious-interview"
|
|
1865
|
+
],
|
|
1866
|
+
"severity": "critical",
|
|
1867
|
+
"confidence": "high",
|
|
1868
|
+
"fileExtensions": [
|
|
1869
|
+
".json"
|
|
1870
|
+
],
|
|
1871
|
+
"fileNames": [
|
|
1872
|
+
"devcontainer.json",
|
|
1873
|
+
".devcontainer.json"
|
|
1874
|
+
]
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
"id": "DEVCONTAINER_PRIVILEGED_HOST_MOUNT",
|
|
1878
|
+
"name": "Devcontainer Runs Privileged or Mounts the Host Home",
|
|
1879
|
+
"pattern": "\\\"privileged\\\"[ \\t]*:[ \\t]*true|\\\"runArgs\\\"[ \\t]*:[\\s\\S]{0,200}?--privileged|\\\"(?:mounts|workspaceMount)\\\"[ \\t]*:[\\s\\S]{0,200}?source=(?:\\/[,\\\"]|\\$\\{localEnv:HOME\\}[,\\\"]|\\/(?:etc|root|home|Users)[,\\\"\\/])",
|
|
1880
|
+
"description": "privileged: true, --privileged in runArgs, or a mount whose source is / or the whole host home directory. Mounting single dotfiles (~/.ssh, ~/.gitconfig) is ordinary and does not match.\n",
|
|
1881
|
+
"tags": [
|
|
1882
|
+
"devcontainer",
|
|
1883
|
+
"privilege-escalation",
|
|
1884
|
+
"credential-access"
|
|
1885
|
+
],
|
|
1886
|
+
"severity": "medium",
|
|
1887
|
+
"confidence": "medium",
|
|
1888
|
+
"fileExtensions": [
|
|
1889
|
+
".json"
|
|
1890
|
+
],
|
|
1891
|
+
"fileNames": [
|
|
1892
|
+
"devcontainer.json",
|
|
1893
|
+
".devcontainer.json"
|
|
1894
|
+
]
|
|
1895
|
+
},
|
|
1896
|
+
{
|
|
1897
|
+
"id": "PASTE_RUN_UNTRUSTED_HOST",
|
|
1898
|
+
"name": "Docs Tell You to Pipe a Paste Site into a Shell",
|
|
1899
|
+
"pattern": "\\b(?:curl|wget|iwr|irm|Invoke-WebRequest|Invoke-RestMethod)\\b[^\\n|]{0,200}(?:pastebin\\.com|paste\\.ee|paste\\.rs|rentry\\.(?:co|org)|hastebin\\.com|bit\\.ly|tinyurl\\.com|is\\.gd|cutt\\.ly|rebrand\\.ly|shorturl\\.at|tiny\\.cc|rb\\.gy|t\\.ly|short\\.gy|transfer\\.sh|0x0\\.st|file\\.io|gist\\.githubusercontent\\.com)\\/[^\\n|]{0,200}\\|[ \\t]*(?:sudo[ \\t]+)?(?:(?:ba|z)?sh|iex|powershell|pwsh|python3?|node)\\b",
|
|
1900
|
+
"description": "Install instructions that run a script from a paste site, a URL shortener or a raw gist. Vendor one-liners (brew, rustup, bun) are left out — the host is what makes this a lure.\n",
|
|
1901
|
+
"tags": [
|
|
1902
|
+
"clickfix",
|
|
1903
|
+
"download-exec",
|
|
1904
|
+
"social-engineering",
|
|
1905
|
+
"prompt-injection"
|
|
1906
|
+
],
|
|
1907
|
+
"severity": "high",
|
|
1908
|
+
"confidence": "medium",
|
|
1909
|
+
"fileExtensions": [
|
|
1910
|
+
".md",
|
|
1911
|
+
".mdc",
|
|
1912
|
+
".txt",
|
|
1913
|
+
".rst"
|
|
1914
|
+
]
|
|
1915
|
+
},
|
|
1741
1916
|
{
|
|
1742
1917
|
"id": "OBF_BASE64_HEAVY",
|
|
1743
1918
|
"name": "Heavy Base64 Encoding",
|
|
@@ -859,7 +859,7 @@ function applyYaraRules(content, rules, filePath, scopePath = filePath) {
|
|
|
859
859
|
if (rule.fileExtensions && rule.fileExtensions.length > 0 && !rule.fileExtensions.some((ext) => scopePath.endsWith(ext))) {
|
|
860
860
|
continue;
|
|
861
861
|
}
|
|
862
|
-
if (rule.fileNames && rule.fileNames.length > 0 && !rule.fileNames.includes(
|
|
862
|
+
if (rule.fileNames && rule.fileNames.length > 0 && !rule.fileNames.includes(filePath.split("/").pop() ?? filePath)) {
|
|
863
863
|
continue;
|
|
864
864
|
}
|
|
865
865
|
const regex = new RegExp(rule.pattern, CASE_SENSITIVE_RULE_IDS.has(rule.id) ? "g" : "gi");
|
|
@@ -933,18 +933,53 @@ var SCANNABLE_EXTENSIONS = [
|
|
|
933
933
|
".html",
|
|
934
934
|
".htm"
|
|
935
935
|
];
|
|
936
|
+
var CONTAINER_BUILD_FILE = /(?:^|\/)(?:[\w.-]+[-.])?(?:Dockerfile|Containerfile)(?:[-.][\w.-]+)?$/i;
|
|
937
|
+
var COMPOSE_FILE = /(?:^|\/)(?:[\w-]+-)?compose(?:\.[\w-]+)*\.ya?ml$/i;
|
|
936
938
|
var CONFIG_FILE_PATTERNS = [
|
|
937
939
|
/(?:^|\/)\.vscode\/(?:tasks|settings|launch|mcp)\.json$/,
|
|
938
940
|
/(?:^|\/)\.claude\/settings(?:\.local)?\.json$/,
|
|
939
941
|
/(?:^|\/)\.(?:cursor|amazonq|gemini|windsurf|roo|kiro)\/(?:mcp|settings)\.json$/,
|
|
940
942
|
/(?:^|\/)\.mcp\.json$/,
|
|
943
|
+
// devcontainer: initializeCommand runs on the host, and
|
|
944
|
+
// onCreate/postCreateCommand the moment an editor opens the folder.
|
|
945
|
+
/(?:^|\/)\.devcontainer\.json$/,
|
|
946
|
+
/(?:^|\/)\.devcontainer\/(?:[^/]+\/)?devcontainer\.json$/,
|
|
947
|
+
// `docker build` / `docker compose up` is a one-command execution path:
|
|
948
|
+
// RUN steps, `command:`, privileged containers, docker-socket mounts.
|
|
949
|
+
CONTAINER_BUILD_FILE,
|
|
950
|
+
COMPOSE_FILE,
|
|
941
951
|
/^\.github\/workflows\/[^/]+\.ya?ml$/,
|
|
942
|
-
|
|
952
|
+
/(?:^|\/)README(?:\.md|\.txt|\.rst)?$/i,
|
|
943
953
|
/(?:^|\/)(?:AGENTS|CLAUDE|GEMINI)\.md$/,
|
|
944
954
|
/(?:^|\/)\.(?:cursorrules|windsurfrules|clinerules)$/,
|
|
945
|
-
/(?:^|\/)\.cursor\/rules
|
|
946
|
-
|
|
955
|
+
/(?:^|\/)\.cursor\/rules\/.*\.mdc?$/,
|
|
956
|
+
// Prompts, slash commands, subagents and skills: markdown a coding agent
|
|
957
|
+
// executes on request, with the same reach as a hook.
|
|
958
|
+
/(?:^|\/)\.claude\/(?:commands|agents)\/.*\.md$/,
|
|
959
|
+
/(?:^|\/)\.claude\/skills\/[^/]+\/SKILL\.md$/,
|
|
960
|
+
/^\.github\/copilot-instructions\.md$/,
|
|
961
|
+
/^\.github\/(?:instructions|prompts)\/[^/]+\.md$/
|
|
947
962
|
];
|
|
963
|
+
function configRuleScope(path) {
|
|
964
|
+
if (CONTAINER_BUILD_FILE.test(path))
|
|
965
|
+
return `${path}.dockerfile.sh`;
|
|
966
|
+
if (COMPOSE_FILE.test(path))
|
|
967
|
+
return `${path}.compose.yml`;
|
|
968
|
+
return path;
|
|
969
|
+
}
|
|
970
|
+
var INSTRUCTION_CONFIG = /(?:^|\/)(?:AGENTS|CLAUDE|GEMINI)\.md$|(?:^|\/)\.(?:cursorrules|windsurfrules|clinerules)$|(?:^|\/)\.cursor\/rules\/|(?:^|\/)\.claude\/(?:commands|agents|skills)\/|^\.github\/(?:copilot-instructions\.md$|(?:instructions|prompts)\/)/;
|
|
971
|
+
var README_CONFIG = /(?:^|\/)README(?:\.md|\.txt|\.rst)?$/i;
|
|
972
|
+
function sortByPriority(items, priority) {
|
|
973
|
+
const rank = new Map(items.map((item, index) => [item, index]));
|
|
974
|
+
items.sort((a, b) => priority(a.path) - priority(b.path) || rank.get(a) - rank.get(b));
|
|
975
|
+
}
|
|
976
|
+
function configPriority(path) {
|
|
977
|
+
if (README_CONFIG.test(path))
|
|
978
|
+
return 2;
|
|
979
|
+
if (INSTRUCTION_CONFIG.test(path))
|
|
980
|
+
return 1;
|
|
981
|
+
return 0;
|
|
982
|
+
}
|
|
948
983
|
var UTF8 = new TextDecoder("utf-8");
|
|
949
984
|
function decodeUtf8(binary) {
|
|
950
985
|
const bytes = new Uint8Array(binary.length);
|
|
@@ -964,11 +999,14 @@ function isFontFile(path) {
|
|
|
964
999
|
var MAX_CONFIG_FILES = 25;
|
|
965
1000
|
var MAX_COMMAND_TARGETS = 10;
|
|
966
1001
|
var CI_WORKFLOW = /^\.github\/workflows\//;
|
|
1002
|
+
function runsOffHost(path) {
|
|
1003
|
+
return CI_WORKFLOW.test(path) || CONTAINER_BUILD_FILE.test(path) || COMPOSE_FILE.test(path);
|
|
1004
|
+
}
|
|
967
1005
|
var RUNTIME_INVOCATION = /\b(?:node|nodejs|bun|deno\s+run|tsx|ts-node)((?:\s+-{1,2}[\w-]+(?:=[^\s"'`]*)?)*)\s+\\?["']?([^\s"'`&|;<>()]+)/g;
|
|
968
1006
|
var INLINE_CODE_FLAG = /(?:^|\s)(?:-[ep]|--eval|--print)(?:\s|=|$)/;
|
|
969
1007
|
var RUNTIME_ARGS_FORM = /"command"\s*:\s*"(?:node|nodejs|bun|deno|tsx|ts-node)"\s*,\s*"args"\s*:\s*\[\s*"([^"]+)"/g;
|
|
970
|
-
var PROJECT_DIR_VARIABLE = /\\?["']?\$\{?(?:CLAUDE_PROJECT_DIR|workspaceFolder|workspaceRoot)\}?\\?["']?(?=\/)/g;
|
|
971
|
-
var DOT_DIR_CONFIG = /^(?:(.*)\/)?\.(?:vscode|claude|cursor|amazonq|gemini|windsurf|roo|kiro|github)\//;
|
|
1008
|
+
var PROJECT_DIR_VARIABLE = /\\?["']?\$\{?(?:CLAUDE_PROJECT_DIR|workspaceFolder|workspaceRoot|localWorkspaceFolder|containerWorkspaceFolder)\}?\\?["']?(?=\/)/g;
|
|
1009
|
+
var DOT_DIR_CONFIG = /^(?:(.*)\/)?\.(?:vscode|claude|cursor|amazonq|gemini|windsurf|roo|kiro|github|devcontainer)\//;
|
|
972
1010
|
function extractCommandTargets(content, configPath) {
|
|
973
1011
|
const dotDir = configPath.match(DOT_DIR_CONFIG);
|
|
974
1012
|
const base = dotDir ? dotDir[1] ?? "" : configPath.includes("/") ? configPath.slice(0, configPath.lastIndexOf("/")) : "";
|
|
@@ -1007,6 +1045,18 @@ function resolveRepoPath(base, raw) {
|
|
|
1007
1045
|
return segments.length > 0 ? segments.join("/") : null;
|
|
1008
1046
|
}
|
|
1009
1047
|
var MAX_FILES_TO_SCAN = 200;
|
|
1048
|
+
var RUNS_ON_INSTALL_OR_BUILD = /^(?:scripts?|bin|tools?)\/|(?:^|\/)(?:pre|post)?install\.(?:[cm]?js|ts)$|(?:^|\/)setup\.(?:[cm]?js|ts|py)$|(?:^|\/)[\w.-]*\.config\.(?:[cm]?js|ts)$|^\.(?:husky|github|vscode|claude|cursor|devcontainer)\//;
|
|
1049
|
+
var GENERATED_OR_VENDORED = /(?:^|\/)(?:dist|build|out|vendor|third_party|node_modules|coverage)\/|\.min\.[cm]?js$|\.bundle\.[cm]?js$|(?:^|\/)[\w.-]*\.generated\.[cm]?[jt]sx?$/;
|
|
1050
|
+
var SUPPORTING_SOURCE = /(?:^|\/)(?:__mocks__|mocks?|examples?|samples?|demos?)\//i;
|
|
1051
|
+
function sourcePriority(path) {
|
|
1052
|
+
if (GENERATED_OR_VENDORED.test(path))
|
|
1053
|
+
return 3;
|
|
1054
|
+
if (isTestFile(path) || SUPPORTING_SOURCE.test(path))
|
|
1055
|
+
return 2;
|
|
1056
|
+
if (RUNS_ON_INSTALL_OR_BUILD.test(path))
|
|
1057
|
+
return 0;
|
|
1058
|
+
return 1;
|
|
1059
|
+
}
|
|
1010
1060
|
var MAX_FILE_SIZE_BYTES = 1024 * 1024;
|
|
1011
1061
|
var MAX_SKIPPED_FILES_LISTED = 500;
|
|
1012
1062
|
var NPM_DOWNLOAD_CACHE = /* @__PURE__ */ new Map();
|
|
@@ -1074,27 +1124,25 @@ async function scanGitHubRepo(repo, options) {
|
|
|
1074
1124
|
skippedFiles.push({ path, reason });
|
|
1075
1125
|
}
|
|
1076
1126
|
};
|
|
1077
|
-
const
|
|
1078
|
-
|
|
1079
|
-
let fontsSelected = 0;
|
|
1127
|
+
const configCandidates = [];
|
|
1128
|
+
const fontFiles = [];
|
|
1080
1129
|
const sourceBlobs = [];
|
|
1081
1130
|
for (const item of tree.tree) {
|
|
1082
1131
|
if (item.type !== "blob")
|
|
1083
1132
|
continue;
|
|
1084
|
-
const config = isConfigFile(item.path);
|
|
1133
|
+
const config = isConfigFile(item.path) && !SCANNABLE_EXTENSIONS.some((ext) => item.path.endsWith(ext));
|
|
1085
1134
|
const font = !config && isFontFile(item.path);
|
|
1086
1135
|
if (config || font) {
|
|
1087
1136
|
const sizeLimit = font ? MAX_FONT_BYTES : MAX_FILE_SIZE_BYTES;
|
|
1088
1137
|
if (item.size !== void 0 && item.size > sizeLimit) {
|
|
1089
1138
|
skip(item.path, "too-large");
|
|
1090
|
-
} else if (
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
if (config)
|
|
1094
|
-
configSelected++;
|
|
1139
|
+
} else if (font) {
|
|
1140
|
+
if (fontFiles.length >= MAX_FONT_FILES)
|
|
1141
|
+
skip(item.path, "over-file-limit");
|
|
1095
1142
|
else
|
|
1096
|
-
|
|
1097
|
-
|
|
1143
|
+
fontFiles.push(item);
|
|
1144
|
+
} else {
|
|
1145
|
+
configCandidates.push(item);
|
|
1098
1146
|
}
|
|
1099
1147
|
continue;
|
|
1100
1148
|
}
|
|
@@ -1103,13 +1151,20 @@ async function scanGitHubRepo(repo, options) {
|
|
|
1103
1151
|
skip(item.path, "unsupported-type");
|
|
1104
1152
|
} else if (item.size !== void 0 && item.size > MAX_FILE_SIZE_BYTES) {
|
|
1105
1153
|
skip(item.path, "too-large");
|
|
1106
|
-
} else if (sourceBlobs.length >= MAX_FILES_TO_SCAN) {
|
|
1107
|
-
skip(item.path, "over-file-limit");
|
|
1108
1154
|
} else {
|
|
1109
1155
|
sourceBlobs.push(item);
|
|
1110
1156
|
}
|
|
1111
1157
|
}
|
|
1112
|
-
|
|
1158
|
+
sortByPriority(sourceBlobs, sourcePriority);
|
|
1159
|
+
for (const item of sourceBlobs.splice(MAX_FILES_TO_SCAN)) {
|
|
1160
|
+
skip(item.path, "over-file-limit");
|
|
1161
|
+
}
|
|
1162
|
+
const configFiles = configCandidates;
|
|
1163
|
+
sortByPriority(configFiles, configPriority);
|
|
1164
|
+
for (const item of configFiles.splice(MAX_CONFIG_FILES)) {
|
|
1165
|
+
skip(item.path, "over-file-limit");
|
|
1166
|
+
}
|
|
1167
|
+
const filesToScan = [...configFiles, ...fontFiles, ...sourceBlobs];
|
|
1113
1168
|
const blobsByPath = new Map(tree.tree.filter((item) => item.type === "blob").map((item) => [item.path, item]));
|
|
1114
1169
|
const queued = new Set(filesToScan.map((item) => item.path));
|
|
1115
1170
|
const commandTargets = /* @__PURE__ */ new Set();
|
|
@@ -1163,7 +1218,7 @@ async function scanGitHubRepo(repo, options) {
|
|
|
1163
1218
|
const fileData = await contentResponse.json();
|
|
1164
1219
|
const binary = atob(fileData.content || "");
|
|
1165
1220
|
const content = isFontFile(file.path) ? binary : decodeUtf8(binary);
|
|
1166
|
-
if (isConfigFile(file.path) && !
|
|
1221
|
+
if (isConfigFile(file.path) && !runsOffHost(file.path) || file.path.endsWith("package.json")) {
|
|
1167
1222
|
for (const target of extractCommandTargets(content, file.path)) {
|
|
1168
1223
|
if (commandTargets.size >= MAX_COMMAND_TARGETS)
|
|
1169
1224
|
break;
|
|
@@ -1213,10 +1268,10 @@ async function scanGitHubRepo(repo, options) {
|
|
|
1213
1268
|
continue;
|
|
1214
1269
|
}
|
|
1215
1270
|
if (!isSource && (isConfigFile(file.path) || file.path.endsWith("package.json"))) {
|
|
1216
|
-
const configFindings = applyYaraRules(content, yaraRules, file.path);
|
|
1271
|
+
const configFindings = applyYaraRules(content, yaraRules, file.path, configRuleScope(file.path));
|
|
1217
1272
|
findings.push(...configFindings);
|
|
1218
1273
|
patternsMatched += configFindings.length;
|
|
1219
|
-
if (/^README/i.test(file.path)) {
|
|
1274
|
+
if (/^README/i.test(file.path.split("/").pop() ?? file.path)) {
|
|
1220
1275
|
const socialFindings = detectSocialEngineering(content, file.path);
|
|
1221
1276
|
findings.push(...socialFindings);
|
|
1222
1277
|
patternsMatched += socialFindings.length;
|
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
scanGitHubUser,
|
|
15
15
|
scanReport,
|
|
16
16
|
wantJson
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-AJ6RU6CY.js";
|
|
18
18
|
|
|
19
19
|
// src/cli.ts
|
|
20
20
|
import { parseArgs } from "util";
|
|
@@ -78,7 +78,7 @@ async function runScanUser(login, options) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// src/cli.ts
|
|
81
|
-
var VERSION = "0.
|
|
81
|
+
var VERSION = "0.6.0";
|
|
82
82
|
var HELP = `flagrix \u2014 scan GitHub repos and profiles for malware before you clone
|
|
83
83
|
|
|
84
84
|
Usage:
|
|
@@ -142,7 +142,7 @@ async function main() {
|
|
|
142
142
|
}
|
|
143
143
|
return runScanUser(target, { json: values.json, token: values.token });
|
|
144
144
|
case "mcp": {
|
|
145
|
-
const { runMcp } = await import("./mcp-
|
|
145
|
+
const { runMcp } = await import("./mcp-DTIELX77.js");
|
|
146
146
|
return runMcp();
|
|
147
147
|
}
|
|
148
148
|
default:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flagrix",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"zod": "^3.24.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@flagrix/scanner-core": "^0.
|
|
56
|
+
"@flagrix/scanner-core": "^0.7.0",
|
|
57
57
|
"@types/node": "^20.0.0",
|
|
58
58
|
"tsup": "^8.0.0",
|
|
59
59
|
"typescript": "^5.0.0",
|