[New Feature] Webhook HMAC signing - #373
Open
mfyz wants to merge 2 commits into
Open
Conversation
Contributor
|
thanks @mfyz ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Index webhooks can now opt into HMAC-SHA256 request signing. Existing webhooks remain unsigned unless the new setting is enabled, so this is backward compatible.
The webhook configuration UI/screen now includes a Security section where users can enable signing and enter a secret. The secret is stored using the existing secure token storage instead of the regular webhook preferences.
Signed requests include:
X-Index-Webhook-VersionX-Index-SignatureX-Index-TimestampX-Index-DeliveryThe signature covers the webhook version, timestamp, delivery ID, trigger, test status, and exact request body. The webhook API documentation includes the complete verification protocol and a Python example.
Implementation
INDEX_WEBHOOK_API.md.Tests
Added focused tests in:
IndexWebhookSigningTest.kt: RFC 4231 vector, signing-input construction, signature formatting, request changes, reserved headers, and per-gesture secrets.IndexWebhookSettingsViewModelTest.kt: secure secret storage, copied configurations, test events, and secret deletion.IndexWebhookPreferencesTest.kt: backward compatibility and signed-configuration persistence.Android build, unit tests, host tests, JVM tests, and lint pass. The app was also installed and tested on a physical Android device.
Screenshots
Signing disabled (default state)
Signing enabled, shows secret field
Disclosure: This implementation was developed with AI assistance (codex, 5.6-sol-xh). I reviewed the complete diff, iterated on it multiple times to get the UI/UX, documentation, contract right. I tested the Android build on Pixel Fold Pro 9, an my Index 01 device, and reviewed the webhook signing protocol and security behavior. Implemented it on my agentic back-end, and successfully using it in production.