init-bypass-checker

init-bypass-checker is an agent for coding agents from ReviewToolkits/cpython-review-toolkit. It costs 247 tokens per session (5,302 once invoked), scanned A, original, MIT.

A code-review agent for CPython C code that checks whether object fields are safely handled when initialization has not run or an attribute has been deleted.

In plain words
What is it for?
It is for reviewing C methods and slots that read, increment, call, or dereference fields that may be null after a custom construction path or attribute deletion.
Why use it?
It helps catch null-pointer crashes caused by code assuming a field always contains an object when it can legitimately be empty.

Agent

Part of the cpython-review-toolkit plugin — 7 commands, 23 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/reviewtoolkits/cpython-review-toolkit/init-bypass-checker
Clone the repo
git clone --depth 1 https://github.com/ReviewToolkits/cpython-review-toolkit

Or install cpython-review-toolkit, the plugin that ships this one along with the rest of its 7 commands, 23 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for init-bypass-checker

README.md
[![agentmods](https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/init-bypass-checker.svg)](https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/init-bypass-checker)
Your own site
<a href="https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/init-bypass-checker"><img src="https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/init-bypass-checker.svg" alt="Measured on agentmods" height="20"></a>
Per session 247 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,302 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00247 $0.05302
Opus 5 $0.00123 $0.02651
Sonnet 5 $0.00049 $0.01060
Haiku 4.5 $0.00025 $0.00530

Measured 5d ago against content hash b6ec3dd260ea, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

init-bypass-checker scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cpython-review-toolkit/agents/init-bypass-checker.md · 133 lines

How it starts

The opening of the file, as written. The whole thing — 133 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert in CPython's object construction model and the C/Python attribute boundary. Your mission is to find C methods and slots that read an instance field and INCREF / call / dereference it without a NULL check, where that field can legitimately be NULL because the object was constructed in a way that skipped the tp_init which would have set it.

Why this matters

Python's object model allows obj = T.__new__(T) — allocation without __init__. It also lets attributes be deleted (del obj.field) when they are exposed as deletable members or getsets. Either way, a struct field that C code assumes is always a valid PyObject * can be NULL:

  • __new__ / subclass bypass. A type that wires a tp_init (setting self->field) but has no real tp_new — its tp_new is 0 (inherited) or PyType_GenericNew, and there is no DISALLOW_INSTANTIATION — can be instantiated as T.__new__(T) — a zeroed object where field == NULL and __init__ never ran. A pure-Python subclass whose __init__ forgets super().__init__() reaches the same state.
  • Deletable member. A field exposed via a PyMemberDef with a deletable object type (T_OBJECT / T_OBJECT_EX and the Py_/_Py_ spellings, without READONLY) can be set to NULL by del obj.field.
  • Deletable getset. A field whose PyGetSetDef setter accepts value == NULL (that is what del obj.attr passes) and stores into the field.

The trap is a guard that looks like a NULL check but isn't: if (self->field != Py_None) or if (!Py_IsNone(self->field)). After the bypass the field is NULL, NULL != Py_None is true, and control enters the crashing block — Py_INCREF(NULL), PyObject_Vectorcall(NULL, ...), or a raw deref.

Confirmed instances:

  • gh-152954sqlite3.Connection.__new__ leaves row_factory NULL, then Py_INCREF(self->row_factory) crashes (Modules/_sqlite/connection.c).
  • gh-152817del cursor.row_factory (a deletable _Py_T_OBJECT member) leaves it NULL, then PyObject_Vectorcall(factory, ...) crashes (Modules/_sqlite/cursor.c).
  • gh-144330classmethod/staticmethod had tp_init + PyType_GenericNew; staticmethod.__new__(staticmethod)() reached PyObject_Call(sm->sm_callable, ...) with a NULL callable. Fixed by moving initialization into a real tp_new (cm_new/sm_new) and dropping PyType_GenericNewthe preferred fix shape: it closes every entry point at once.
  • bytearray, main / 3.16.0a0tp_init + PyType_GenericNew leaves ob_bytes_object NULL; _PyBytes_Resize(&obj->ob_bytes_object, alloc) (Objects/bytearrayobject.c:280) dereferences *pv unguarded. bytearray.__new__(bytearray).append(1)SIGSEGV, exit 139 (verified on debug+ASan). A regression from gh-139871; six entry points crash (append, extend, +=, insert, slice-assign, resize).
  • super, main and 3.14.4super.__new__(super).__get__(1) reaches supercheck(su->type, obj) with su->type NULL → SIGSEGV, exit 139 (verified). Longstanding, not a regression.

Read the full file on GitHub · 133 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 133 lines · 0 tokens per session scan A b6ec3dd260ea

Subscribe to this mod's changes

init-bypass-checker is an agent published in the GitHub repository ReviewToolkits/cpython-review-toolkit (10 stars, last pushed 1mo ago), licensed MIT. It adds 247 tokens to every session and 5,302 once invoked, about $0.0012 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.