Skip to content

fix-low: filter a forced alarm's cause and text as API v2 does - #255

Open
nabbi wants to merge 2 commits into
ZoneMinder:masterfrom
nabbi:fix/alarm-cause-v2-parity
Open

nabbi wants to merge 2 commits into
ZoneMinder:masterfrom
nabbi:fix/alarm-cause-v2-parity

Conversation

@nabbi

@nabbi nabbi commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Impact: low (a forced alarm's cause and text were stored as sent; an empty cause recorded "Continuous")

Automated PR, tested in a zm-holodeck sandbox. An AI agent (Claude Opus 5.5) wrote this against a disposable
ZoneMinder (master 0e19f4fb4) with zm-api next to it and ran the checks there. Minimal human review before
opening: please review it as you would any contributor's PR.

TL;DR

Tested as 2939e479e; 35a1d8d19 is the same tree with fixes #254 in the message.

fixes #254

🤖 Generated with Claude Code

Filter the cause and text of POST /monitors/{id}/alarm to letters, digits,
spaces and plain punctuation, as ZoneMinder's API v2 does
(MonitorsController::alarmCause): both end up in Events.Cause and
Events.Notes. An empty or unusable cause is recorded as "API", as a missing
one is. Write score, cause and texts to shared memory before the trigger
state, as Monitor::ForceAlarmOn does.

fixes ZoneMinder#254

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@SteveGilvarry

Copy link
Copy Markdown
Member

@nabbi need to CLA under zm

@nabbi

nabbi commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Oct 30, 2026
… as v2 does

The 31- and 255-byte limits were checked on the request as sent, so a
cause that fits once its quotes and control characters are dropped got a
400. API v2's alarmCause filters first and then cuts to 31 bytes on a
character boundary. Do the same, and cut the text to the 255-byte shm
field the same way.

The request still refuses a cause over 1024 bytes or a text over 4096,
so an oversized body is a 400 rather than work for the filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forced alarm: cause and text are stored as sent, unlike API v2 (and an empty cause records "Continuous")

2 participants