Skip to content

Reject malformed honeypot timestamps - #62

Merged
nickmoreton merged 5 commits into
mainfrom
codex/fix-invalid-honeypot-time
Jul 16, 2026
Merged

Reject malformed honeypot timestamps#62
nickmoreton merged 5 commits into
mainfrom
codex/fix-invalid-honeypot-time

Conversation

@nickmoreton

@nickmoreton nickmoreton commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Treat empty, non-numeric, and otherwise non-convertible honeypot timestamps as failed checks instead of allowing request-processing exceptions.
  • Add focused method tests and full Wagtail form-flow regression coverage.
  • Keep the copyable developer-guide implementation aligned with the guarded conversion, document the design and implementation plan, add the required Unreleased changelog entry, and ignore local .worktrees/.

Root cause

time_diff() converted the untrusted timestamp POST value directly with int(value). A present but empty or non-numeric field therefore raised ValueError (or TypeError for non-string invalid inputs) rather than following the fail-closed behavior already used for missing honeypot fields.

Impact

Malformed submissions are now silently ignored, continue to receive the normal thank-you response, and do not create a form submission. Valid timestamps, interval boundaries, settings, and template output are unchanged.

Closes #60.

Verification

  • uv run manage.py test tests.test_methods tests.test_form — 10 tests passed
  • make test — 17 tests passed; 100% package coverage
  • make lint — Ruff passed
  • git diff --check — passed

@nickmoreton
nickmoreton marked this pull request as ready for review July 15, 2026 21:29
@nickmoreton
nickmoreton marked this pull request as draft July 15, 2026 21:41
@nickmoreton nickmoreton added the bug Something isn't working label Jul 15, 2026
@nickmoreton nickmoreton self-assigned this Jul 15, 2026
@nickmoreton
nickmoreton marked this pull request as ready for review July 16, 2026 11:08
@nickmoreton
nickmoreton merged commit 0b0be28 into main Jul 16, 2026
8 checks passed
@nickmoreton
nickmoreton deleted the codex/fix-invalid-honeypot-time branch July 16, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diff = abs(int(now_time) - int(value))\n ValueError: invalid literal for int() with base 10: ''"

1 participant