Automated security and code quality enforcement across the Lineth monorepo. For the complete repository guide, see AGENTS.md.
- Canonical repository instructions: AGENTS.md
- Cursor docs index: rules/documentation.mdc
- If this file conflicts with
../AGENTS.md, follow../AGENTS.md.
Review all pull requests targeting main. Focus on files changed in the PR diff. Skip generated files (typechain-types/, dist/, build/, coverage/, node_modules/).
Prevents leaking secrets, credentials, and sensitive data in logs, error messages, tests, and config files. Applies to all code files (.ts, .js, .kt, .java, .go, .sol, .py).
Enforces backwards compatibility for public APIs and versioned assets (ABIs, configs). Components released beyond devnet must create new versioned methods/assets instead of breaking existing ones. Applies to all code files plus .abi and .json.
- Secrets, API keys, private keys, or credentials in source code, logs, or config
- Missing NatSpec on public/external Solidity functions, events, or errors
- Breaking changes to public APIs without a new versioned method/asset
- Wildcard Solidity imports (
import "path/to/File.sol") console.logorconsole.errorwith sensitive data (tokens, keys, connection strings)- New dependencies added without justification in the PR description
- Unpinned dependency versions in
dependencies/devDependencies, catalog entries, or overrides (^caret or~tilde ranges). Treat these as blocking: floating ranges pull unreviewed releases and widen the supply-chain attack surface. Require an exact pin (workspace:andcatalog:references are allowed when the catalog itself pins an exact version). Do not flag intentionalpeerDependenciesranges orengines(>=) constraints; those are compatibility windows, not install targets. - Environment variable changes not reflected in
.env.templateor.env.example - Hardcoded addresses or chain IDs that should be configurable
- Unchecked arithmetic in Solidity without a safety comment
- Missing error handling on async operations (unhandled promise rejections, uncaught exceptions)
- Type assertions (
as any,as unknown as X) that bypass type safety
- NatSpec:
@notice,@param(in order),@returnon all public/external items - Named imports only
- License header:
Apache-2.0for interfaces,AGPL-3.0for contracts - Pragma: exact
0.8.33for contracts, caret^0.8.33for interfaces/abstract/libraries - Custom errors preferred over revert strings
- Storage layout: no slot collisions in upgradeable contracts
-
reinitializer(N)pattern (neverinitializer) - Access control on state-changing functions
- Events emitted for all state changes
- Reentrancy guards on functions that make external calls
- Zero-value checks via
ErrorUtils - Gas:
calldatafor read-only inputs, cached storage reads
- No
anytypes unless unavoidable with a comment explaining why - Error handling on all async operations
- Secrets loaded from environment variables, never hardcoded
- Tests added or updated for changed logic
- ESLint and Prettier compliance
-
toString()overrides on config classes redact secrets, and data classes with ByteArray fields -
equals()/hashCode()overrides on data classes with ByteArray fields - Structured logging with logfmt format, without sensitive data
- Spotless formatting compliance
- Tests added or updated for changed logic
- Integration tests use Docker test containers where applicable
-
gofmtcompliant -
golangci-lintpasses - Error returns checked (no ignored errors)
- Build tags preserved (
nocorset,fuzzlight)
- No API keys or secrets in client-side code
- Environment variable changes reflected in
.env.template - Accessibility: semantic HTML, ARIA labels where needed
- No bundle size regressions from large new dependencies
- Workflow syntax valid (YAML)
- No secrets exposed in workflow logs or outputs
- Path filters updated if new directories are added
- Docker images use specific tags, not
latest
- Ignore files matching:
**/dist/**,**/build/**,**/generated/**,**/node_modules/**,**/typechain-types/**,**/coverage/**,**/*.d.ts - Hardhat default private keys (
0xac0974bec...) in local deployment scripts are acceptable — they are well-known test keys - Generated ABI JSON files do not need manual review
- Short, direct comments on the specific file and line
- Propose a concrete fix direction (code snippet or pattern reference)
- Classify severity: blocking (must fix), important (should fix), minor (nice to have)
- One comment per distinct issue
- Reference rule files for detailed guidance (e.g., "See
.cursor/rules/security-logging-guidelines/RULES.md")
When a violation is detected, block the change with a clear explanation and suggest a safe alternative. Always reference the relevant rule's examples for correct patterns.