GuardLink is an open-source security annotation tool designed to solve the problem of threat models easily becoming outdated. By adding structured annotations (such as @mitigates, @exposes, @transfers, @accepts, etc.) to code, it tightly couples security decisions with code, so that threat models are automatically updated as code changes.
Main capabilities include:
- In-code annotations: Security decisions are written as structured annotations next to the relevant code, for example adding @mitigates #api against #sqli using #prepared-stmts above a parameterized query.
- AI agent maintenance: AI coding agents are integrated via MCP and behavioral instructions; when writing code such as route handlers, agents automatically add @exposes and @mitigates annotations, enabling self-maintenance of the threat model.
- CI enforcement: Provides commands such as guardlink validate, guardlink ci --strict, and guardlink diff --fail-on-new to validate annotation syntax in CI, detect unmitigated exposures, block PRs that introduce new risks, and support SARIF export to the GitHub Security tab.
- Path analysis: The guardlink paths command reports paths from untrusted entry points to sinks without controls based on the @flows graph, with each hop referencing a real file:line, without LLM involvement.
- Code graph integration (optional): When a code graph tool (such as codegraph-mcp) is installed, guardlink annotate can provide agents with a prioritized worklist listing route handlers and their reachable sink categories, and check threat model coverage.
Usage:
- Requires Node.js 18+. Install from a clone: npm run build && npm link .
- Run guardlink init to detect AI agents and configure the MCP server and behavioral instructions.
- Use guardlink status . to view the current threat model status.
- For detailed documentation, see https://docs.bugb.io/guardlink/ , including installation, GAL reference, CLI reference, and specification.
Applicable scenarios:
- Development teams want to embed security knowledge in code and achieve continuous threat modeling.
- Teams using AI coding agents want to automatically maintain security annotations.
- Projects that need to enforce security quality gates in CI.
Limitations:
- Requires a Node.js 18+ environment.
- Code graph integration is optional, and GuardLink does not install or build code graphs.
- Some features (such as @accepts signatures) require human decisions and cannot be replaced by AI agents.
- Specific pricing, cost, platform support, and other information are not yet provided.