state-transition-integrity-v1
8 rules · Keryn Software Licence · rules 0.8.0 · all packs
How to read a rule
- Severity
- How bad the finding is if it is real:
errorfails a default gate,warningandinfodo not. - Confidence
- P0 exploitable as written; P1 dangerous in context; P2 a heuristic or a posture check: confirm by reading the code.
- False-positive risk
- low: an exact API or flag, so hits are almost always real; medium: the pattern is legitimate in many programs, so check each hit; high: it finds a lead to confirm, so expect benign hits.
- Edge
- The relationship the finding sits on. reaches: content or traffic gets to a thing; calls: one thing invokes another; reads: one thing reads from another; writes: one thing writes to another; sends: data leaves for another party; grants: authority is given or left unchecked; depends_on: something relies on a component it does not verify; trusts: one party believes another without evidence. The boundary it crosses, when there is one: user->prompt (untrusted input reaching a prompt); model->code (model output reaching code, a shell, a query or a page); secret->outside (a secret leaving the trusted side); supply-chain (code, models or prompts pulled in from outside).
- Taxonomy chips
- References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.
keryn.statetx.py.copy-without-owner-reapply
Section titled “keryn.statetx.py.copy-without-owner-reapply”warning python python
A resource is copied/cloned but the enclosing function sets no owner or ACL on the destination, so the copy inherits default or absent ownership and may be readable by the wrong principal. Re-apply the owner and access control to the destination after copying.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
Fix: After copying or cloning a resource, set the destination’s owner and access control explicitly (chown/chmod/set_acl, or the application’s ownership field) to the authorized principal; do not rely on inherited or default permissions.
References: https://cwe.mitre.org/data/definitions/281.html · https://docs.python.org/3/library/shutil.html#shutil.copy
keryn.statetx.py.non-atomic-balance-check
Section titled “keryn.statetx.py.non-atomic-balance-check”warning python python
A balance/quota field is compared in a condition and then reassigned by arithmetic on its own value, with no lock or atomic update between. Two concurrent requests both pass the check and both debit (double-spend). Use an atomic conditional update (a single UPDATE … WHERE balance >= amount, a row lock, or a database transaction).
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: writes one thing writes to another.
CWE-367 CWE-362 LLM06 ASI02 ASI08
Fix: Make the check and the debit one atomic operation: UPDATE account SET balance = balance - :amt WHERE id = :id AND balance >= :amt and act on the affected row count, or hold a row lock / serializable transaction across the read and the write.
References: https://cwe.mitre.org/data/definitions/367.html
keryn.statetx.py.action-without-replay-guard
Section titled “keryn.statetx.py.action-without-replay-guard”warning python python, mcp, a2a
An agent/MCP/A2A action handler performs a side effect but its body references no nonce, idempotency key, or replay/once check, so a captured request or message can be replayed. Bind each action to a single-use nonce or idempotency key and reject reuse.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.
Edge inspected: trusts one party believes another without evidence.
Fix: Require a single-use nonce or idempotency key on each side-effecting action, record used values, and reject a repeat; do not treat a valid-looking message as fresh by default.
References: https://cwe.mitre.org/data/definitions/294.html · https://modelcontextprotocol.io/docs/2025-11-25/tutorials/security/security_best_practices
keryn.statetx.ts.copy-without-owner-reapply
Section titled “keryn.statetx.ts.copy-without-owner-reapply”warning typescript, javascript typescript, nodejs
A resource is copied/cloned but the enclosing function sets no owner or ACL on the destination, so the copy inherits default or absent ownership. Re-apply owner and access control to the destination after copying.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
Fix: After copying or cloning a resource, set the destination’s owner and access control explicitly to the authorized principal; do not rely on inherited or default permissions.
References: https://cwe.mitre.org/data/definitions/281.html · https://nodejs.org/api/fs.html#fspromisescopyfilesrc-dest-mode
keryn.statetx.ts.non-atomic-balance-check
Section titled “keryn.statetx.ts.non-atomic-balance-check”warning typescript, javascript typescript, nodejs
A balance/quota field is compared then reassigned by arithmetic on its own value with no lock or atomic update between, so concurrent requests double-spend. Use an atomic conditional update or a transaction across the read and the write.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: writes one thing writes to another.
CWE-367 CWE-362 LLM06 ASI02 ASI08
Fix: Make the check and the debit one atomic operation (a conditional UPDATE guarded by the balance, or a transaction/row lock across read and write).
References: https://cwe.mitre.org/data/definitions/367.html
keryn.statetx.go.non-atomic-balance-check
Section titled “keryn.statetx.go.non-atomic-balance-check”warning go go
A balance/quota field is compared then reassigned by arithmetic on its own value with no lock or atomic update between, so concurrent requests double-spend. Use an atomic conditional update or a transaction across the read and the write.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: writes one thing writes to another.
CWE-367 CWE-362 LLM06 ASI02 ASI08
Fix: Make the check and the debit one atomic operation (a conditional UPDATE guarded by the balance, or a transaction/row lock across read and write).
References: https://cwe.mitre.org/data/definitions/367.html
keryn.statetx.go.copy-without-owner-reapply
Section titled “keryn.statetx.go.copy-without-owner-reapply”warning go go
A resource is copied/cloned but the enclosing function sets no owner or ACL on the destination, so the copy inherits default or absent ownership. Re-apply owner and access control to the destination after copying.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
Fix: After copying or cloning a resource, set the destination’s owner and access control explicitly (os.Chown/os.Chmod or the application’s ownership field).
References: https://cwe.mitre.org/data/definitions/281.html · https://pkg.go.dev/io#Copy
keryn.statetx.ts.action-without-replay-guard
Section titled “keryn.statetx.ts.action-without-replay-guard”warning typescript, javascript typescript, nodejs, mcp
An MCP/agent tool handler performs a side effect but its argument object destructures no nonce or idempotency key, so a captured request or message can be replayed. Bind each side-effecting action to a single-use nonce or idempotency key and reject reuse.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.
Edge inspected: trusts one party believes another without evidence.
Fix: Require a single-use nonce or idempotency key on each side-effecting tool action, record used values, and reject a repeat.
References: https://cwe.mitre.org/data/definitions/294.html · https://modelcontextprotocol.io/docs/2025-11-25/tutorials/security/security_best_practices