You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The cosmetic + defense-in-depth fixes from the v1 code review.
None of the three are exploitable today; all three remove future
footguns and improve operator-facing accuracy.
LOW — Worker tick summary over-counted mid-retry failures.
``run_one_tick`` was incrementing ``summary[status]`` based on the
per-attempt outcome from ``_process_row``, ignoring the fact that
``_finalize_row`` may have flipped the row back to 'pending' for
another attempt. A row that retried twice and succeeded was
showing up as ``failed=2 sent=1`` across three ticks instead of
``sent=1`` in the tick that actually succeeded. The numbers in
operator log streams now reflect terminal outcomes only — mid-
retry rows count zero in any bucket and pop into the right
bucket on the tick they finally land. Pinned by an extension to
``test_worker_retries_on_transient_failure`` and a sum-across-
ticks check in ``test_worker_gives_up_at_max_attempts``.
LOW — Subject template didn't strip embedded CR/LF.
``email_templates.render`` called ``.strip()`` on the rendered
subject, which only trims edges. An embedded ``\r\nBcc: ...``
in a notification.title (operator-controlled camera names; AI-
agent-supplied incident titles) would survive into the subject
line. Resend's API rejects header injection today so this isn't
exploitable, but a future provider swap that forwards subjects
raw to SMTP would turn it into a Bcc-injection vector. Added
the explicit replace pass and ``test_render_strips_embedded_
newlines_from_subject`` to pin it.
LOW — Unsubscribe HTML pages didn't escape the substituted
``kind`` and ``frontend`` values. The pages use ``str.format()``
(not Jinja2, so autoescape doesn't apply) and a token whose
``kind`` claim contained ``<script>...</script>`` would render
the raw script tag. Practically unreachable — forging the JWT
requires CLERK_SECRET_KEY, at which point the attacker has root
— but added a one-line ``_safe_html`` helper and applied it to
every interpolation site. ``test_unsubscribe_endpoint_html_
escapes_kind`` forges a token (using the same secret the test
process holds) to prove the escape actually fires.
Full suite: 408 passed (was 406; +2 from the two new explicit
tests). All four review fixes (1 CRITICAL + 2 HIGH + 3 LOW)
now landed. Ready to push when the operator-side Resend setup
is done.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments