423 Commits

Author SHA1 Message Date
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 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
3b2dff5d42
Don't crash the bridge on state update failure (#537) 2022-10-18 22:55:31 +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
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
Will Hunt
0865535c3c
Add a note to use help (#522) 2022-10-07 10:06:45 +00:00
Will Hunt
b8cc1f962f
Add support for GitHub workflow run completion events (#520)
* Add support for workflow run completions

* Create 520.feature
2022-10-07 10:35:05 +01:00
Will Hunt
db3caeae03 Use matrix-appservice-bridge logging (#488)
* Use matrix-appservice-bridge logger

* Update to be in line with bridge sdk

* Update packages

* changelog

* nits
2022-10-06 09:30:31 +01:00
Andrew Ferrazzutti
14747bb92e 2.3.0 2022-10-05 04:13:12 -04:00
Andrew Ferrazzutti
3ec5bac5f9
Let GitHub widget support "issue.labeled" (#519)
The bridge supports it, but schema validation didn't think so
2022-10-05 03:59:23 -04:00
Andrew Ferrazzutti
d570dc8a3a
Send bot notice on GitHub OAuth success (#512)
* Send bot notice on GitHub OAuth success

i.e. the same as is done for Jira

* Nitpick: don't backtick plain string message
2022-10-04 18:05:17 -04:00
Andrew Ferrazzutti
31aa5e90ad
Don't send empty query string in widget API reqs (#518) 2022-10-04 18:04:28 -04:00
Andrew Ferrazzutti
4d3567b05a
Add label to GitLab widget's comment body toggle (#517)
* Add label to GitLab widget's comment body toggle

Also ensure that the label is part of the click region

* Add changelog

Copied from #500's changelog
2022-10-04 18:02:21 -04:00
Andrew Ferrazzutti
c29c67fc2b
Fix command prefix field in widgets (#515)
* Read-your-writes consistency on connection update

Allow updates to connections made via config widgets to be reflected
immediately upon save in the widget UI.

* Use HTML elements as `ref`s in widgets

Fixes #422

* Add changelog

* Let widgets use new connection config on save

After a connection config is updated, but before a widget requests the
latest config from the bridge, make the widget display the just-saved
config instead of what the config was before being updated.

* Use input placeholder as prefix default

Otherwise, leaving the prefix field blank would apply no prefix, and
violate prefix length requirements.
2022-10-04 17:19:21 -04:00
Andrew Ferrazzutti
3ca61b9e02
Reorganize the GitHub config widget (#508)
- Group repos by org
- Paginate repo requests
- Remove redundant label next to chosen repo
- Remove redundant repo field below connected repo
- Include repos that user has doesn't have admin permissions for, to
  achieve parity with results from provisioning API
2022-10-03 10:43:16 -04:00
Andrew Ferrazzutti
50fa037d9a
Fix Jira widget request loop for logged-out users (#507)
* Fix Jira widget request loop for logged-out users

* Add changelog file

(copied from #502)
2022-10-03 10:30:11 -04:00
Andrew Ferrazzutti
fa85dc070b
Add commands to remove/list Jira connections (#503)
* Add commands to remove/list Jira connections

* Add docs page for Jira connections

* Clarify "instance" and webhook reqs in Jira docs

- Jira has "instances" instead of "organizations", so use the former term
- Don't suggest that webhook support can work for multiple instances
- Mention that webhooks require special access
- Make some minor grammar changes
2022-10-03 09:54:14 -04:00
Andrew Ferrazzutti
80a26283e9
Make various typechecking improvements (#505)
* Make various typechecking improvements

* Use `Record<never, never>` to cover `{}`
2022-09-30 13:50:38 -04:00
Andrew Ferrazzutti
911a73abba
Move web tsconfig to let TS language server work (#506)
* Move `web` tsconfig to let TS language server work

* Assign typing to images

This removes type errors on imported images.
2022-09-30 12:35:53 -04:00
Andrew Ferrazzutti
24a653f11d
Improve some command formatting (#504)
* Improve formatting of command help

- Ensure args included in monospace formatting
- Show required args as `<arg>`
- Show optional args as `[arg]`

* Don't print undefined username with Jira `whoami`

* Fix typo in `feed remove` description

* Add changelog

* Relabel changes as a bugfix
2022-09-30 12:16:44 -04:00
Andrew Ferrazzutti
0111f4bfa3
Add Jira widget (#502)
* Add Jira widget

* Jira widget UI for no login vs no instances

* Update changelog wording
2022-09-30 11:52:31 -04:00
Will Hunt
4c33c60d7a
Support GitLab MR comment bodies (optionally) (#500)
* Add backend support

* Add frontend support

* Update docs

* changelog

* Update src/Connections/GitlabRepo.ts

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

* Update docs/usage/room_configuration/gitlab_project.md

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

* Tweak functions

Co-authored-by: Christian Paul <christianp@matrix.org>
2022-09-30 16:33:09 +01:00
Will Hunt
f9e3554e0e
Add support for creating confidential issues in GitLab (#496)
* Confidential issue

* changelog

* Dedupe a bit
2022-09-28 11:55:36 +01:00
Will Hunt
01750bf6f2
Send a notice when the setup widget cannot be created (#491)
* Check permissions when setting up a widget

* changelog
2022-09-28 11:55:12 +01:00
Half-Shot
2a093562ce 2.2.0 2022-09-16 14:30:57 +01:00
Will Hunt
5ee267f013
Update codemirror, remove opensans (#489)
* Update codemirror, remove opensans

* changelog

* Remove our one usage of sans

* Update JS dependency too
2022-09-16 13:23:43 +00:00
Will Hunt
a179ae6732
Rename 484.bugfix to 484.feature 2022-09-15 18:15:27 +01:00
Will Hunt
5184506438
Merge GitLab MR approvals and comments into one message (#484)
* Merge approvals and comments as one comment

* Drop comment after sending

* changelog

* fix boolean

* Consistent logging
2022-09-15 18:14:42 +01:00
Will Hunt
d85f2fd540
Add Logger tests (#478)
* More json logger safety

* Don't log undefined

* typo

* Split out the static logger to it's own class for testing

* Refactor logger usage slightly

* Add a test for the logger wrapper

* changelog

* Update LogWrapper.ts

* Drop ?
2022-09-14 11:26:34 +00:00
Will Hunt
e8159579b2
Fix figma not working on startup (#481)
* Fix figma startup requests failing

* log the ID

* fix 404

* Ensure we always send teamId as a string

* changelog
2022-09-12 13:38:45 +01:00
Will Hunt
23eae91737
Support notifying when a GitLab MR is ready for review (#480)
* Support ready for review GitLab

* Create 480.feature

* Change event name

* Fix name

* Fix typo
2022-09-12 11:51:04 +01:00