670 Commits

Author SHA1 Message Date
Justin Carlson
9a7839ce42
Implement separate bot users per service (#573)
* Add service bots config

* Add joined rooms manager and keep track of joined rooms

* Add bot users manager and ensure registration and profiles

* Improve joined rooms manager and set up already joined rooms

* Handle invites with service bots

* Handle messages with service bots

* Use service bots for connections

* Use service bots in widget and provisioning APIs

* Use service bots in setup connections

* Use service bots for feed connections

* Handle admin rooms for service bots

* Fix confused event type and service type in provisioning and widget APIs

* Fix generic webhooks service name

* Fix enabled services config

* Handle power level change

* Create widgets with service scope

* Use service bots for gitlab repo connections

* Use service bots for gitlab issue connections

* Use service bots for generic webhook connections

* Use service bots for figma file connections

* Use service bots when verifying state events

* Use service bots for github repo connections

* Use service bots for github discussion connections

* Use service bots for github discussion space connections

* Use service bots for github project connections

* Use service bots for github issue connections

* Use service bots for github user space connections

* Use service bots for jira connections

* Make sure ghost users are invited for gitlab issue comments

* Configure one service per service bot

* Add changelog

* Update tests

* Fix up following rebase

* Fix comment

* Use getter for enabled services

* Ensure homeserver can be reached before registering bots

* Add intent getter on bot user

* Update config comment

* Merge joined rooms manager with bot users manager

* Remove unused localpart from bot user class

* Refactor to pass in bot users manager

* Improve priority sort function

Co-authored-by: Christian Paul <christianp@matrix.org>

* Fix priority sort

Higher priority should come first

* Add debug log when invites are rejected

* Use different state key for scoped setup widgets

* Use different subtitles to differentiate service bots setup widgets

* Refactor bot user setup into bot users manager

* Refactor to reduce duplication in widget API

* Consistent room ID and intent args order

* Add docs and update changelog

* Add overrideUserId deprecation warning

* Add service bots link

Co-authored-by: Christian Paul <christianp@matrix.org>
Co-authored-by: Will Hunt <will@half-shot.uk>
2023-01-13 15:32:09 +00:00
Christian Paul
46467ac810
Correctly apply CSS for recent RSS feed changes (#604)
* Button: Extend HTMLButton prop types
* Use className prop instad of styles
* Move style prop into scss file
2023-01-13 14:44:07 +01:00
Will Hunt
1e8a112a28
Drop ignoreHooks configuration. (#592)
* Refactor HookFilter to only support enabledEvents (and add a function to convert)

* Convert connections to deprecate ignoreHooks

* Update documentation

* Split out EventHookCheckbox

* Refactor frontend to support enableHooks only mode

* drop old field name

* changelog

* Fix enabledHooks for widgets

* Fixes across the board

* Update test description

* Cleanup

* Fix HookFilter

* Fixup checkboxes

* Cleanup
2023-01-10 17:08:50 +00:00
Will Hunt
4048cc8b01
Check the GitLab instance name when looking for existing connections (#617)
* Check the GitLab instance name when looking for existing connections

* changelog
2023-01-10 10:42:05 +00:00
Will Hunt
a5ea88578c
Decrease connection creation concurrency when starting up (#614)
* Add a queue system for loading connections on startup

* Retry state requests

* Add ability to retry on some matrix failures

* Add the queue

* changelog

* Add docstring
2023-01-09 17:57:24 +00:00
Christian Paul
188eb4004e
A11y: Add alt tags to all images (#602)
* A11y: Add alt tags to all images

* Add newsfile
2023-01-08 12:04:40 +01:00
Will Hunt
707ce0de2d
Cache yarn dependencies (#615)
* Cache yarn dependencies

* changelog
2023-01-06 17:21:08 +00:00
Christian Paul
8eab1ff750
Improve webhook code editor performance (#601)
* Improve webhook code editor performance

* Add newsfile
2023-01-06 12:02:13 +00:00
dependabot[bot]
8e8a1a6958
Bump json5 from 2.2.0 to 2.2.3 (#611)
Bumps [json5](https://github.com/json5/json5) from 2.2.0 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.0...v2.2.3)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-06 12:02:01 +00:00
Will Hunt
abe4fefda4
Mark encryption as experimental (#610)
* Update config to mark encryption support as experimental

* Mention encryption as experimental in docs

* changelog

* Hide empty values from config

* transmuate snakes into camels
2023-01-05 16:25:48 +00:00
Will Hunt
2eadc1c9d7
Increase maximum size of webhook payload. (#606)
* Increase maximum size of webhook payload.

* Create 606.misc
2023-01-04 12:04:58 +00:00
Kim Brose
ad6076cbb4
Clarify GitLab setup docs (#350)
* Update gitlab.md

* Create 350.doc

* Update gitlab_project.md
2023-01-02 17:02:59 +01:00
Will Hunt
c962f17a91
Add support for native e2ee (#299)
* Add support for native e2ee

* Various temps to coax it into working

* Formatting nitpicks

* Include stable registration config key for msc2409

* Update default config with encryption options

* Manage admin rooms with bot-sdk DMs

This also enables encryption for new admin rooms when appropriate.

* Update config comments for encryption settings

- Add comment to clarify Redis (the `queue` section) must be configured
  in order for encryption to work
- Mention that the `encryption` section is optional, and omitting it
  will disable encryption support

* Update docs for encryption support

* Add changelog

* Add to docs some notes about encryption state

* Move all post-join logic to onRoomJoin

* Block post-join actions on crypto setup

Requires https://github.com/turt2live/matrix-bot-sdk/pull/269

* Fix linter error

* Update encryption docs and changelog

- Mention that worker mode isn't supported with encryption yet
- Mention removal of Pantalaimon-based encryption

* Update worker docs with encryption config notice

* Share main appservice config with feed bots

This is required to safely enable encryption for the bots that post
GenericHook messages.

* Make slight clarification for queue config

* Minor fixes

* Block post-join actions on feed bot crypto setup

Same as a9e6e11d but for the sub-bots that post GenericHook messages.

* Get joined rooms from intent instead of bot

This refreshes the list of known rooms for crypto events.

* Use Element fork of bot-sdk for crypto fixes

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
2022-12-09 10:25:36 -05:00
Will Hunt
0eabb9e3a7
Ensure unknown keys are retained when connection state is altered via widget (#587)
* Handle enable hooks in validation too

* Allow unknown keys in provisioner updates.

* Fixup error

* Finally fix Ajv moaning about types

* changelog

* Apply changes to all connection types

* remove null
2022-12-08 16:33:56 +00:00
Will Hunt
b6ae8f9106
Split out GitHub release events into created and drafted (#582)
* Support published events

* Changelog

* Improve comments

* Add frontend support

* Change func names
2022-12-08 02:48:56 +00:00
Will Hunt
7d74f1b1a8
Support filtering workflow run on workflow names (#588)
* Filter workflow events on specific workflow names

* Document new key

* changelog

* Change to a allow/deny list as per feedback
2022-12-08 01:52:51 +00:00
dependabot[bot]
423dbb11fd
Bump express from 4.17.2 to 4.17.3 (#590)
Bumps [express](https://github.com/expressjs/express) from 4.17.2 to 4.17.3.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.17.2...4.17.3)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-08 01:52:35 +00:00
Will Hunt
c3e1649a3c
Add support for cached responses (ETags/LastModified) for RSS feeds (#583)
* Support not modified responses.

* Support using last modified / etags

* changelog
2022-12-07 17:48:41 +00:00
Will Hunt
07e4129156
Only build arm64 docker images on push (#589)
* Only build ARM on push to main

* changelog

* Add concurrency, fix tertary

* Divide up push jobs

* Try it again

* String false

* 'true'
2022-12-07 17:12:26 +00:00
Will Hunt
f7ccacb429
Check GitLab Repo access level via a better API (#539)
* Check access level via a better API

* remove unused import

* Fixup APIs

* bugfix

* Validate data type
2022-12-02 14:48:40 +00:00
Half-Shot
231597c964 2.5.0 2.5.0 2022-12-02 13:47:18 +00:00
Andrew Ferrazzutti
2c5f248d77
Save bot-created admin rooms in profile data (#578)
* Save bot-created admin rooms in profile data

This prevents a process restart from causing bot-created admin rooms
to be forgotten.

* Clarify changelog
2022-11-25 17:19:32 +00:00
Will Hunt
93e2dbe7ed
Increase feed.pollTimeoutSeconds from 10s to 30s (#483)
* Increase feed.pollTimeoutSeconds from 10s to 30s

* Drop pointless default

* changelog
2022-11-25 14:46:06 +00:00
Andrew Ferrazzutti
16c052e5b9
Harden against unauthorized changes to room state (#565)
* Harden against unauthorized changes to room state

If an unauthorized change to connection-related room state is detected,
deny the new connection settings & attempt to revert the state change.

Also catch an otherwise-uncaught error on authentication failure.

* `any`->`unknown` for some StateEvent content types

* Limit how far back in state to look when restoring

* Explicitly drop unneeded return value of promise

* Add reason to redacted state events

* Rename & document the fn to revert room state

* Move connection state check to ConnectionManager

* Don't rollback bad room state on startup
2022-11-22 11:50:47 -05:00
Christian Paul
caf545f1a4
Misspelling: occured -> occurred (#576)
* Typo: occured -> occurred

* Add newsfile 576
2022-11-22 15:17:43 +01:00
Christian Paul
80010f7b9b
Misspelling: to setup -> to set up (#572)
* Typo: to setup -> to set up

* Add newsfile
2022-11-21 18:38:50 +01:00
Andrew Ferrazzutti
db8221b60a
Allow GitLab connections without hook permissions (#567)
* Allow GitLab connections without hook permissions

Warn instead of fail when connecting a GitLab project that Hookshot
cannot provision a webhook for.

* Mention manual "Secret token" for GitLab webhooks

* Refactor warning pane into a separate component

* Recolour warning pane for better contrast
2022-11-08 10:19:41 -05:00
Andrew Ferrazzutti
7fc0b5b8ed
Update some doc links & formatting (#568) 2022-11-07 09:19:46 -05:00
Will Hunt
c9a9a54e95
Increase SANITIZE_MAX_BREADTH/SANITIZE_MAX_DEPTH for GenericHook (#560)
* Increase SANITIZE_MAX_BREADTH/SANITIZE_MAX_DEPTH

I suspect #559 is failing because the body falls just outside our safe range. The safe ranges were chosen arbitrarily, but we can probably increase them without a huge perf penalty.

* Automatically JSONify anything exceeding the breadth or depth

* Create 560.bugfix

* Update GenericHook.ts

* Cleanup

* optimise newDepth
2022-11-07 12:02:46 +00:00
Will Hunt
28235547d2
Prevent users without permissions from inviting the bot (#561)
* Add filter

* tweak

* changelog

* Kick the right user

* Update src/Bridge.ts

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>

* Update src/Bridge.ts

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>

* Update changelog.d/561.bugfix

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>

* Cleanup underlyingClient

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
2022-11-03 12:55:48 +00:00
Andrew Ferrazzutti
cf10cf47a2
Don't provision command-created connections twice (#558) 2022-11-02 19:34:32 +00:00
Andrew Ferrazzutti
0bec1f6e6f
Make GitLab path uniqueness case-insensitive (#557)
NOTE: If a room already contains multiple GitLab connections with
case-insensensitive identical paths, they will _not_ be removed.
2022-11-02 14:42:18 -04:00
Andrew Ferrazzutti
37543eedaf
Display true casing of GitLab paths (#556) 2022-11-02 14:41:43 -04:00
Andrew Ferrazzutti
bf66dd2a01
Remove trailing slashes from GitLab instance URLs (#563)
Fixes #562
2022-11-02 14:39:37 -04:00
Will Hunt
0ad8e5e640
GitHub assign quality of life. (#554)
* Add defaults to assign

* changelog

* Update src/Connections/GithubRepo.ts

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>

* Update GithubRepo.ts

Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
2022-11-02 14:21:41 +00:00
Andrew Ferrazzutti
baa1b639c4
Don't skip non-lowercase GitLab connection paths (#553)
* Don't skip non-lowercase GitLab connection paths

Fixes #552

* Don't lower-case GitLab URLs with bot command

This allows GitLab URLs to appear in the configuration widget with their
original casing intact.

* Lowercase GitLab connection path on save
2022-11-01 14:14:58 -04:00
Will Hunt
ecbd7e6252
Skip GitLab MR reply comments (#536)
* Skip MR reply comments

* Skip comment event if filtered by events

* Use discussion IDS

* Create 536.bugfix

* Update src/Connections/GitlabRepo.ts

Co-authored-by: Christian Paul <christianp@matrix.org>

* Update src/Connections/GitlabRepo.ts

Co-authored-by: Christian Paul <christianp@matrix.org>

* Update src/Connections/GitlabRepo.ts

Co-authored-by: Christian Paul <christianp@matrix.org>

Co-authored-by: Christian Paul <christianp@matrix.org>
2022-10-31 16:06:38 +00:00
Will Hunt
dfad5b5c3b
Silence RSS timeouts (#551)
* Silence timeouts

* changelog
2022-10-31 16:04:52 +00:00
Andrew Ferrazzutti
e178d67781 2.4.0 2.4.0 2022-10-21 11:32:25 -04:00
Will Hunt
0c9bbf6410 Disable GitHub workflow events by default (#528)
* Add a HookFilter class

* Use the HookFilter class

* Support default hooks in the web UI

* Update documentation

* changelog

* Allow all GitLab events by default

* bits of cleanup
2022-10-21 11:30:16 -04:00
Andrew Ferrazzutti
f7bb20a639
Allow multiple Jira connections; stop prefix clash (#540)
* Allow multiple Jira connections; stop prefix clash

Fixes #533
Mitigates #421

* Follow review suggestions

- Set a status code for the ApiError on command prefix conflict
- Make `conflictsWithCommandPrefix` an optional method
2022-10-21 09:25:07 -04:00
Andrew Ferrazzutti
505c083f5f
Add support for Jira version events (#534)
- Support version created/updated/released events
- Look up project ID if missing when subscribing to version events
- Properly format version event notices
- Prioritize project URL over ID in debug strings
2022-10-21 09:24:35 -04:00
Andrew Ferrazzutti
d82e0d7d91
Fix & refactor Jira issue event handling (#543)
- Refactor Jira event handling to be more like GitHub & GitLab
- Fix silently-ignored Jira events due to expecting wrong type strings
- Update UI for Jira events
2022-10-21 09:16:00 -04:00
Will Hunt
0622d0717f
Create triage-incoming.yml 2022-10-20 12:11:11 +01:00
Will Hunt
3b2dff5d42
Don't crash the bridge on state update failure (#537) 2022-10-18 22:55:31 +01:00
Will Hunt
45d82c7a31
Remove debug steps 2022-10-17 22:29:41 +01:00
Andrew Ferrazzutti
c0efb91c9a
Fix Docker builds hanging/OOMing (#535)
* Add network timeouts to Docker builds

* Split cargo build out

* Put cargo in the right place

* debug usage

* install time

* Fix docker build OOMing in CI for arm64 builds

Yoinked from synapse:
- https://github.com/matrix-org/synapse/pull/14173
- 424d1d28cc

* Update changelog

Co-authored-by: Half-Shot <will@half-shot.uk>
2022-10-17 13:09:15 -04:00
Will Hunt
fdcb5a27cb
Improvements to GitHub auth (#523)
* Always report auth errors

* Raise OAuth errors

* Tweaks

* a newline

* changelog

* changes
2022-10-17 15:19:13 +01:00
Will Hunt
107b6c0c2f
Add documentation for workflow run 2022-10-10 14:11:20 +01:00
Will Hunt
3263565cac
Add checkboxes for workflow run statues in UI (#524)
* Add a note to use `help`

* Add event checkboxes for the workflow run hooks

* Create 524.bugfix

* Fix padding issue

* Fix a specific error edge case
2022-10-10 10:40:58 +00:00