SuperAPIAI Directory

irulescan

github.com · AI security

irulescan is a security analysis tool for scanning F5 BIG-IP iRules, designed to discover unexpected or unsafe expressions that may lead to undesirable consequences such as double substitution and argument injection. It is built on tclscan and provides a Docker container image and a GitHub Action, can recursively scan directories for .tcl, .irul, and .irule files, and outputs results in JSON format. The tool also provides an API server and an MCP server, supporting scanning via an OpenAPI interface or the MCP protocol, and comes with an Agent Skill that guides how to fix the discovered issues. irulescan can identify issues such as expressions without braces, missing option terminators, unsafe or deprecated commands, unparseable code, regular expressions that BIG-IP cannot compile, vulnerable components mentioned in F5 security advisories, and non-printable ASCII characters. It supports suppressing reviewed findings via comments and can output results in SARIF format for integration into GitHub code scanning.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux · API

About this tool

irulescan is a security analysis tool for F5 BIG-IP iRules, used to scan iRules for unexpected or unsafe expressions that may produce undesirable consequences such as double substitution and argument injection. The tool relies on tclscan for its implementation and provides a Docker container image and a GitHub Action (irulescan-action) for easy integration into development workflows.

In terms of main capabilities, irulescan parses iRules the way BIG-IP does, using Tcl 8.4.6 with extensions for iRule expression operators and syntax additionally accepted by the parser. It can report findings of type dangerous or warning, including: double substitution risks caused by expressions and code blocks without braces (such as expr, if, while, eval, catch, after, switch bodies, etc.); argument injection caused by a missing option terminator -- (such as switch, regexp, regsub, unset, class, table); unsafe, deprecated, or unsupported commands, unknown commands and events; mathematical functions not provided by iRules (iRules only provide abs, double, int, rand, round, srand, wide) and unparseable expressions (such as use of the in, ni, and ** operators, which iRules does not support); unparseable code (such as missing closing braces or quotes), which is not scanned and is a dangerous finding; literal regular expressions that BIG-IP cannot compile (such as repetition counts exceeding 255) and iRules that exceed BIG-IP storage limits; commands listed as vulnerable components in F5 security advisories; characters outside the printable ASCII range in code and comments (BIG-IP rejects iRules containing such characters). Each finding includes a message, issue_location (the token that triggered the issue), context (the command containing that token, on a single line and truncated to 200 characters), and the starting line number of issue_location.

In terms of usage, the simplest approach is to scan iRules via the container. The container recursively scans the /scandir directory, scanning only files with the .tcl, .irul, and .irule extensions (which can be overridden via the IRULESCAN_FILE_EXTENSIONS environment variable), and the results are output in JSON array is returned, with one entry per iRule file. Files can also be specified explicitly, in which case a scan is attempted regardless of extension. irulescan also supports scanning BIG-IP configuration files (such as bigip.conf, partition bigip.conf, or the output of tmsh list ltm rule), identifying configuration files by content and scanning only the rule objects within them (ltm rule, gtm rule), skipping pools, monitors, data groups, and so on. When scanning a directory, .conf files are not picked up automatically; they must be specified explicitly or the extension added.

For findings that have been reviewed and accepted, suppression is possible by adding a comment in the iRule, with the format # irulescan: ignore <rule>[, <rule>...] [-- <reason>], which can be placed on the line before the command or after a semicolon on the command line. A suppression covers one command and its words, expressions, and commands within [ .. ] substitutions, but does not cover code in script arguments of when, if, switch, proc, and so on. unparsable-code and badly-formed-command cannot be suppressed. By default, suppressed findings do not appear in the results and are not counted toward --fail-on; use --show-suppressed to list them, and --no-suppressions to report them as ordinary findings.

irulescan provides the :apiserver container tag, which runs a simple OpenAPI server for scanning iRule code or multiple files. The documentation (RapiDoc UI) is at /, and the OpenAPI 3.1 specification is at /openapi.json, both served from the irulescan binary with no internet access required. The API endpoints accept the no_warn, exclude_empty_findings, exclude_unknown_commands, exclude_advisories, show_suppressed, and no_suppressions query parameters, with the same meaning as the command-line options. The API server can require a token or OAuth access token and checks the Host and Origin headers of requests.

In addition, irulescan provides an MCP server using streamable HTTP transport at /mcp (and /), supporting MCP protocol versions 2025-11-25 and 2026-07-28 and earlier versions. It provides a scan tool for scanning iRule code and returning findings, also output as structured content; it also provides the Agent Skill irulescan, which guides when to scan, how to read findings, how to fix them, and good practices for secure iRules, provided via the MCP Skills extension (skills/list, skills/get) and the resource skill://irulescan/SKILL.md. The MCP server only responds to requests whose Host header is localhost, 127.0.0.1, or ::1; other names must be listed explicitly. Starting with irulescan 3.1, the :mcpserver container no longer adds good-practice text to each scan result; clients instead read the skill; the --include-additional-context option is still available but deprecated.

For CI integration, the container uses irulescan as its entry point, with the default CMD being check ., recursively scanning /scandir. CI systems using a custom mount point can be supported by passing a new CMD, but this changes the filepath prefix for each iRule file. Use --fail-on to make the CI job fail when findings occur. CI systems that run their own shell (such as GitLab CI, Jenkins) require the dev image; other images contain only irulescan. An API server can also be used, or results compared against a scan result file of known findings.

irulescan check --format sarif outputs findings in SARIF 2.1.0 format for viewers such as GitHub code scanning. The dangerous finding level is error, and the warning finding level is warning. The scanner reports one finding per violation marker, but SARIF has only one result per file, rule, line, and command; GitHub code scanning shows one alert whose level is that of the most severe finding, with the message listing the locations of the most severe findings in order of occurrence. JSON results, AThe PI server and MCP tools still list every finding. --fail-on and the exit code depend on findings, not results. File paths are the paths received by irulescan, so scans should be run from the repository root using relative paths; when scanning only a subdirectory, the path from the repository root can be provided via --sarif-path-prefix (or IRULESCAN_SARIF_PATH_PREFIX). An iRule read from stdin (-) is named STDIN, --stdin-filename NAME can specify a filename for it, and --sarif-path-prefix applies as well. By default, findings suppressed by comments are excluded, because GitHub displays results marked as suppressed as open alerts; --show-suppressed keeps them with suppressions entries, and --no-suppressions reports them as ordinary results. Files whose findings are all suppressed are dropped by --exclude-empty-findings unless --show-suppressed is given. Suppressed findings are never counted toward --fail-on. For iRules in BIG-IP configuration files, results indicate the rule object. --reference compares JSON results and cannot be combined with --format sarif.

The checkref command can be used to check each file listed in a reference file, where the reference file is a saved scan result. irulescan check --reference <file> compares the scan of a directory or file with the reference in the same way. Without --reference and --fail-on, irulescan check exits with code 0 regardless of what findings are produced.

The API server and MCP server accept all requests by default; a static token can be set via the environment variable IRULESCAN_AUTH_TOKEN, or a file containing one or more tokens (one per line) can be provided via --auth-token-file or IRULESCAN_AUTH_TOKEN_FILE, or OAuth access tokens can be required, or both can be accepted.

Applicable scenarios include: scanning iRules during development to find security issues; automatically checking iRule security in CI/CD workflows; integrating into other tools or AI assistant workflows via the API or MCP; scanning iRules in BIG-IP configuration files. In terms of limitations, irulescan's command and event knowledge comes from BIG-IP systems and F5 documentation and is not tied to a specific BIG-IP version; unknown commands are reported as command is unknown and can be suppressed with --exclude-unknown-commands; security advisory warnings are only pointers to advisories, and whether you are affected depends on the BIG-IP version and configuration, and they can be suppressed with --exclude-advisories; code that cannot be parsed is not scanned, and unparsable-code and badly-formed-command cannot be suppressed.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools