Skip to content

feat(security): remote trigger signature v2 (canonical form + replay protection) - #89

Merged
vietnguyentuan2019 merged 3 commits into
mainfrom
feat/remote-trigger-hmac-v2
Nov 7, 2026
Merged

vietnguyentuan2019 merged 3 commits into
mainfrom
feat/remote-trigger-hmac-v2

Conversation

@vietnguyentuan2019

Copy link
Copy Markdown
Contributor

Closes the two items from the v1.4.0 security backlog.

v2 signature: x-native-wm-signature: v2=<hex>, HMAC over a length-prefixed canonical string (so values with | or = can't collide), plus x-native-wm-timestamp (+-300s) and x-native-wm-nonce (persisted, bounded store) for replay protection. Signature is checked before the nonce is stored, so forged messages can't fill it.

Compat

  • v1 still accepted, logs a deprecation warning.
  • Rules without secretKey still accept native_wm commands (no behaviour change), but it logs a warning each time. I did NOT add an opt-in to reject them: it needs a new column in RemoteTriggerStore on both platforms, so better as its own change.
  • iOS also runs native_wm when no rule is registered at all, Android ignores that. Left as is, flagged in the docs and a log warning.

Parity: same vector (dca042f1...) in Kotlin test, Swift test and doc/examples/remote_trigger_sign_v2.py; a Dart test checks the three still reference it. Swift tests ran in a temp macOS package (8 pass), Kotlin 10 pass, iOS example builds.

Not tested end-to-end on a device (needs a real FCM/APNs push). Backends must change to use v2; spec in doc/REMOTE_TRIGGER_SIGNING.md. Meant for its own minor release.

… form + replay protection)

- v2=<hex> over a length-prefixed canonical string, with x-native-wm-timestamp (+-300s) and a
  persisted, bounded x-native-wm-nonce store
- identical logic + test vector in Kotlin, Swift and doc/examples/remote_trigger_sign_v2.py
- v1 still accepted (deprecated, logged); unsigned native_wm commands still accepted but warned
@vietnguyentuan2019
vietnguyentuan2019 merged commit a7156ee into main Nov 7, 2026
13 checks passed
@vietnguyentuan2019
vietnguyentuan2019 deleted the feat/remote-trigger-hmac-v2 branch November 7, 2026 09:13
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.

1 participant