Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add matrix-auth integration #565

Merged
merged 12 commits into from
Nov 1, 2024

Conversation

amandahla
Copy link
Collaborator

@amandahla amandahla commented Oct 18, 2024

Overview

Add matrix-auth integration.

  • Plugins:
    • Requires information only (homeserver and shared secret)
    • Example: Maubot
  • Application services
    • Requires information and also provides secret to be registered in Synapse.
    • Example: IRC Bridge. See the docs for more details about it.

Note:
Twisted version is pinned due to this issue:
element-hq/synapse#17882

Todo

  • Plugins
  • Application Services
  • Unit tests
  • Integration tests

Rationale

Integrate Synapse with plugins and application services

Juju Events Changes

Matrix auth relation changed and departed.
Why not matrix_auth_request_processed?
The on = RedisRelationCharmEvents() prevents that. :-(

Module Changes

Library Changes

Checklist

@amandahla amandahla requested a review from a team as a code owner October 18, 2024 17:13
@amandahla amandahla marked this pull request as draft October 18, 2024 17:14
@amandahla amandahla changed the title DNM DRAFT feat: add matrix-auth observer DNM DRAFT feat: add matrix-auth integration Oct 18, 2024
@amandahla amandahla marked this pull request as ready for review October 18, 2024 21:41
@amandahla amandahla changed the title DNM DRAFT feat: add matrix-auth integration feat: add matrix-auth integration Oct 18, 2024
nrobinaubertin
nrobinaubertin previously approved these changes Oct 21, 2024
@amandahla
Copy link
Collaborator Author

Integration test failing due
element-hq/synapse#17882

Thanhphan1147
Thanhphan1147 previously approved these changes Nov 1, 2024
yanksyoon
yanksyoon previously approved these changes Nov 1, 2024
Copy link
Contributor

@yanksyoon yanksyoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nicely commented code! LGTM w minor nits :)

src/matrix_auth_observer.py Show resolved Hide resolved
src/matrix_auth_observer.py Outdated Show resolved Hide resolved
src/synapse/workload.py Outdated Show resolved Hide resolved
src/synapse/workload_configuration.py Show resolved Hide resolved
@amandahla amandahla dismissed stale reviews from yanksyoon and Thanhphan1147 via 6521111 November 1, 2024 09:41
Copy link
Contributor

github-actions bot commented Nov 1, 2024

Test coverage for deaccd5

Name                                    Stmts   Miss Branch BrPart  Cover   Missing
-----------------------------------------------------------------------------------
src/actions/__init__.py                     1      0      0      0   100%
src/actions/register_user.py               21      0      2      0   100%
src/admin_access_token.py                   9      0      0      0   100%
src/backup.py                             175      5     20      2    96%   353-354, 423-424, 480->482, 483
src/backup_observer.py                    134     16     12      0    89%   132-135, 140-143, 179-182, 211-214
src/charm.py                              287     20     70     11    91%   138->140, 143, 249, 253-254, 260-261, 282-283, 311, 318, 399-403, 406-407, 435-437, 457, 493-494
src/charm_state.py                        151      8     30      6    92%   271, 275, 296, 321, 327, 333, 337-338
src/charm_types.py                         34      0      0      0   100%
src/database_client.py                     57      1      8      4    92%   35, 47->exit, 69->exit, 88->98
src/database_observer.py                   39      0      4      1    98%   70->72
src/exceptions.py                           3      0      0      0   100%
src/matrix_auth_observer.py                60      5     12      3    89%   61, 64, 148, 167-168
src/media_observer.py                      41      4      2      1    88%   61-63, 82
src/mjolnir.py                             97      3     30      3    95%   82, 91->107, 112-116
src/observability.py                       14      0      0      0   100%
src/pebble.py                             205     27     48     13    84%   57->62, 176->exit, 187-191, 225-226, 246-247, 300->305, 308-309, 321-322, 324-325, 343-344, 361, 363, 365, 367, 369, 397, 449-454
src/redis_observer.py                      35      3      4      0    92%   62-65
src/s3_parameters.py                       22      0      4      0   100%
src/saml_observer.py                       31      0      4      0   100%
src/smtp_observer.py                       56      4     14      2    91%   82-86, 89, 108->113
src/synapse/__init__.py                     4      0      0      0   100%
src/synapse/admin.py                       19      2      2      0    90%   40-41
src/synapse/api.py                        175      3     20      3    97%   176, 229, 402
src/synapse/workload.py                   139      6     24      0    94%   405-406, 416-419
src/synapse/workload_configuration.py     170     29     40     14    80%   85->exit, 89-90, 138-139, 168, 188-189, 221-222, 255, 264-265, 280, 285-286, 307-308, 327->332, 333, 351->353, 363-364, 380, 427->430, 454-455, 483, 491->493, 493->495, 500-501, 521->528, 531, 551-552
src/user.py                                23      0      2      0   100%
-----------------------------------------------------------------------------------
TOTAL                                    2002    136    352     63    91%

Static code analysis report

Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Run started:2024-11-01 09:54:46.795947

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 11236
  Total lines skipped (#nosec): 4
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

Copy link
Contributor

@yanksyoon yanksyoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick changes!

@amandahla amandahla merged commit f853bf2 into main Nov 1, 2024
20 checks passed
@amandahla amandahla deleted the ISD-2411-add-matrix-auth-integration branch November 1, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants