matrix-org / matrix-org/matrix-hookshot
[Generic-Webhooks] transformHookData purges valid attributes
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 450
- Forks
- 95
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 23
Description
The generic webhook sender uses several attributes of `content` in sending its message to the related Matrix channel: https://github.com/matrix-org/matrix-hookshot/blob/c03b620fac01a641be7e0f683a5bf449753836c8/src/Connections/GenericHook.ts#L787-L808
When no webhook transformation function is applied, the received data from the webhook is ran through `transformHookData`, which in turn only returns an object with 2 keys: `html` and `plain`: https://github.com/matrix-org/matrix-hookshot/blob/c03b620fac01a641be7e0f683a5bf449753836c8/src/Connections/GenericHook.ts#L676
As a result, `content.msgtype` and `content.mentions` get removed, and aren't used in sending the matrix message.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/Connections/GenericHook.ts at transformHookData around line 676, then trace the generic webhook message assembly around lines 787-808. Reproduce the no-transformation path and verify that content.msgtype and content.mentions survive into the Matrix message. Done means valid attributes are preserved and used when sending the message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100