agnix
- Type
- MCP server
- Scanned
- Nov 22, 2026
- Version
- c806bf5cb971
- Files read
- 40222
Agnix checks configuration files for AI coding tools like Claude Code, Cursor, and Codex for mistakes and can automatically fix them through a command-line tool, editor plugins, MCP server, and AI skills. Its biggest risks are that the bundled AI skills allow any Cargo command to run without asking and auto-install unpinned global packages (which could let a malicious project run code on your computer), and that scans follow file shortcuts (symlinks) outside the project folder, potentially leaking lines from sensitive local files.
What it can reach
- Files
- Reads AI assistant config, Markdown, JSON, YAML, and TOML files in scanned projects and user tool folders (such as ~/.claude), edits those files when auto-fixing or generating configs, and stores downloaded binaries and telemetry settings in local app folders.
- Network
- Downloads prebuilt binaries and checksums from GitHub Releases during npm setup or editor plugin startup, fetches packages from npm or crates.io if the AI skill installs a missing CLI, and can send opt-in usage counts to telemetry.agnix.dev when explicitly enabled.
- Shell commands
- Runs tar or PowerShell during setup to unpack downloads, launches the language server (including via WSL on Windows), checks versions of installed AI tools, and through its bundled AI skills pre-approves running agnix and any cargo command (plus global npm or cargo installs).
- Browser
- Editor plugin commands in VS Code and Neovim can open rule documentation pages on agent-sh.github.io in your default web browser.
Findings
-
HighProject validation follows symlinks outside the workspace boundary and can leak external file contents
crates/agnix-core/src/pipeline.rs:952
Although agnix-mcp and agnix-lsp enforce workspace-boundary checks on the requested path, project directory walks use Path::is_file() and safe_read_file() (which uses fs::metadata()), both of which follow symbolic links without checking whether the resolved target stays inside root_dir. An untrusted repository containing a symlink named after a recognized config file (for example, codex/requirements.toml -> ~/.npmrc or ~/.aws/credentials, or .amp/settings.json -> ~/.claude.json) causes agnix-mcp's validate_project to read files outside the workspace and return their top-level keys or parse errors, and causes agnix-cli's render_code_frame to print raw lines (including secrets) from the external file to output.
Fix: Canonicalize each discovered file path during project walks (and in safe_read_file when a root_dir is configured) and skip or reject targets that resolve outside the canonical workspace root.
-
MediumBundled agent skills grant over-broad Bash(cargo:*) permission and instruct unpinned runtime installs
Both skills/agnix/SKILL.md and plugin/skills/agnix/SKILL.md pre-approve Bash(cargo:*) in allowed-tools and instruct the agent to run unpinned 'npm install -g agnix' or 'cargo install agnix-cli' if agnix is missing. Because the skill reads untrusted CLAUDE.md and SKILL.md files, prompt injection inside a linted repository can direct the agent to run 'cargo test' or 'cargo run', executing arbitrary code from the repository's build.rs or binaries without a permission prompt.
Fix: Remove Bash(cargo:*) from allowed-tools in both SKILL.md files so only Bash(agnix:*), Read, Glob, and Grep are permitted, and ask the user before installing a pinned version of agnix.
-
LowCLAUDE.md @import validation probes and reads files outside the workspace root
crates/agnix-core/src/rules/claude_md.rs:377
ClaudeMdValidator::resolve_import accepts arbitrary absolute paths (such as @/etc/services) and ../ parent traversals without checking config.root_dir(). Even during single-file validation in agnix-mcp or agnix-lsp, a crafted CLAUDE.md can probe whether arbitrary paths exist on disk via CC-MEM-019 and read external files up to 1 MiB to leak their exact line counts via CC-MEM-014 and CC-MEM-015. (AntigravityValidator::expanded_rule_size similarly follows ~/ and ../ includes without checking config.root_dir().)
Fix: Reject absolute import paths and verify that canonicalized import/include targets stay within the canonicalized config.root_dir(), matching the check in AmpValidator.
-
LowCLI code-frame rendering bypasses the 1 MiB file size DoS limit
crates/agnix-cli/src/main.rs:1225
agnix-core enforces a 1 MiB limit in safe_read_file to prevent memory exhaustion on huge files, emitting a file::read diagnostic when a file is rejected as TooBig. In default text mode, agnix-cli then calls render_code_frame on every diagnostic—including file::read—which calls std::fs::read_to_string(&diag.file) with no size check and loads the entire oversized file into memory.
Fix: Skip render_code_frame for file::read diagnostics and read source lines using bounded file I/O.
-
LowGitHub Action download script places checked-out .agnix-bin directory onto GITHUB_PATH
In the GitHub Action helper script (not run by local MCP, CLI, or editor installs), BIN_DIR is created inside ${GITHUB_WORKSPACE}/.agnix-bin without clearing existing files and is appended to GITHUB_PATH, which GitHub Actions prepends to PATH. If an untrusted checkout or pull request commits an executable such as .agnix-bin/jq or .agnix-bin/git, scripts/run.sh and subsequent workflow steps will execute the repository-supplied binary.
Fix: Install the downloaded binary into ${RUNNER_TEMP}/.agnix-bin or a fresh mktemp -d directory outside ${GITHUB_WORKSPACE}.
-
Lownpm postinstall script interpolates installation paths into shell and PowerShell commands
extractArchive passes archivePath and destDir (derived from __dirname) into execSync shell strings on Unix and unescaped single-quoted PowerShell strings on Windows. Installing the npm package inside a directory path containing shell command substitutions (Unix) or single quotes (Windows) breaks extraction or executes injected commands.
Fix: Use execFileSync/spawnSync with an explicit argument array for tar on Unix and pass paths via environment variables to PowerShell on Windows, matching editors/vscode/src/extension.ts.
-
LowVS Code extension probes LSP binary version through a shell
editors/vscode/src/extension.ts:535
probeBinaryVersion invokes child_process.exec with a double-quoted binaryPath string instead of the spawnAsync helper defined in the same file. This exposes binaryPath to shell interpretation and, on Windows when binaryPath is the bare default 'agnix-lsp', causes cmd.exe to search the current working directory before PATH.
Fix: Replace execAsync in probeBinaryVersion with spawnAsync(binaryPath, ['--version'], { timeout: 3000 }).
-
LowMarkdown link path-containment check is bypassed for non-existent external files
crates/agnix-core/src/rules/imports.rs:524
In
validate_markdown_links(ruleREF-002), the check intended to keep resolved link paths inside the project root relies solely onfs.canonicalize(&resolved). When a link points outside the project root (such as../../../secretor~/secret) and the target file does not exist,canonicalizereturns anErr, skipping the containment check and emitting aREF-002diagnostic that includes the resolved path (including the expanded user home directory) while staying silent when the external file does exist.Fix: Reject absolute, home-relative (
~/), and lexically escaping (..) link paths before callingfs.canonicalizeandfs.exists, matching the containment logic used invisit_imports. -
LowNon-ASCII characters after a backslash in
.kiroignorecause a paniccrates/agnix-core/src/rules/kiro_ignore.rs:195
glob_regexiterates overglob.as_bytes()by byte index and slices&glob[i..i + 1]after a backslash (\). If a.kiroignorefile in an untrusted repository contains a backslash followed by any multi-byte UTF-8 character,i + 1lands inside the character and panics, crashing the CLI, LSP server, or MCP server.Fix: Iterate over
glob.char_indices()instead of raw bytes and slice usingch.len_utf8()so multi-byte UTF-8 characters are handled safely and accurately. -
LowLeading whitespace in an HTTP MCP server URL causes a panic or corrupt auto-fix
crates/agnix-core/src/rules/mcp.rs:1770
When building the
MCP-017auto-fix, the validator checksurl.trim()for anhttp://prefix, but then slices the untrimmed string with&url[7..]. If a.mcp.jsonfile has leading multi-byte Unicode whitespace beforehttp://(such as\u3000), byte index 7 can fall inside a multi-byte character and panic, crashing the linter, LSP, or MCP server.Fix: Slice from the trimmed URL (
&url.trim()[7..]) instead of indexing 7 bytes into the untrimmedurl. -
LowCatastrophic backtracking (ReDoS) via untrusted regex in Kiro hook matcher validation
crates/agnix-core/src/schemas/kiro_hook_v3.rs:396
Unlike the rest of agnix-core, which uses the linear-time regex crate with a 64 KB input cap, tool_matcher_matches_builtin compiles untrusted matcher strings from .kiro/hooks/*.json and Kiro agent files using the backtracking regress ECMAScript engine and executes re.find against 47 built-in tool names up to 31 characters long. A crafted matcher pattern with nested quantifiers and a backreference (such as ^([a-z_]+)+\1!) triggers exponential backtracking across those tool names, hanging the CLI, LSP server, or MCP server when validating untrusted Kiro files.
Fix: Use the linear-time regex crate when evaluating matcher patterns against built-in tool names, or reject/skip runtime matching for patterns containing backreferences or nested quantifiers and enforce a pattern length and step limit.
-
LowMaintainer @claude workflow loads untrusted PR instructions and build scripts with write permissions
.github/workflows/claude.yml:121
This repository CI workflow never runs on an end user's machine, so it cannot directly harm someone who installs an existing release. However, if a repository collaborator comments @claude on an external pull request, the workflow checks out the contributor's branch with contents: write permissions in the environment, loads the branch's AGENTS.md into the system prompt, and pre-approves cargo build/test/run and local scripts.
Fix: Avoid loading AGENTS.md from untrusted fork PR branches into the system prompt and restrict write permissions or pre-approved build commands when running on external pull requests.
