Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
ef535178
Commit
ef535178
authored
8 years ago
by
David Baker
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #904 from matrix-org/dbkr/register_email_no_untrusted_id_server
requestToken update
parents
04dee11e
be8be535
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/api/errors.py
+2
-1
2 additions, 1 deletion
synapse/api/errors.py
synapse/handlers/identity.py
+27
-14
27 additions, 14 deletions
synapse/handlers/identity.py
with
29 additions
and
15 deletions
synapse/api/errors.py
+
2
−
1
View file @
ef535178
...
...
@@ -42,8 +42,9 @@ class Codes(object):
TOO_LARGE
=
"
M_TOO_LARGE
"
EXCLUSIVE
=
"
M_EXCLUSIVE
"
THREEPID_AUTH_FAILED
=
"
M_THREEPID_AUTH_FAILED
"
THREEPID_IN_USE
=
"
THREEPID_IN_USE
"
THREEPID_IN_USE
=
"
M_
THREEPID_IN_USE
"
INVALID_USERNAME
=
"
M_INVALID_USERNAME
"
SERVER_NOT_TRUSTED
=
"
M_SERVER_NOT_TRUSTED
"
class
CodeMessageException
(
RuntimeError
):
...
...
This diff is collapsed.
Click to expand it.
synapse/handlers/identity.py
+
27
−
14
View file @
ef535178
...
...
@@ -21,7 +21,7 @@ from synapse.api.errors import (
)
from
._base
import
BaseHandler
from
synapse.util.async
import
run_on_reactor
from
synapse.api.errors
import
SynapseError
from
synapse.api.errors
import
SynapseError
,
Codes
import
json
import
logging
...
...
@@ -41,6 +41,20 @@ class IdentityHandler(BaseHandler):
hs
.
config
.
use_insecure_ssl_client_just_for_testing_do_not_use
)
def
_should_trust_id_server
(
self
,
id_server
):
if
id_server
not
in
self
.
trusted_id_servers
:
if
self
.
trust_any_id_server_just_for_testing_do_not_use
:
logger
.
warn
(
"
Trusting untrustworthy ID server %r even though it isn
'
t
"
"
in the trusted id list for testing because
"
"
'
use_insecure_ssl_client_just_for_testing_do_not_use
'"
"
is set in the config
"
,
id_server
,
)
else
:
return
False
return
True
@defer.inlineCallbacks
def
threepid_from_creds
(
self
,
creds
):
yield
run_on_reactor
()
...
...
@@ -59,19 +73,12 @@ class IdentityHandler(BaseHandler):
else
:
raise
SynapseError
(
400
,
"
No client_secret in creds
"
)
if
id_server
not
in
self
.
trusted_id_servers
:
if
self
.
trust_any_id_server_just_for_testing_do_not_use
:
logger
.
warn
(
"
Trusting untrustworthy ID server %r even though it isn
'
t
"
"
in the trusted id list for testing because
"
"
'
use_insecure_ssl_client_just_for_testing_do_not_use
'"
"
is set in the config
"
,
id_server
,
)
else
:
logger
.
warn
(
'
%s is not a trusted ID server: rejecting 3pid
'
+
'
credentials
'
,
id_server
)
defer
.
returnValue
(
None
)
if
not
self
.
_should_trust_id_server
(
id_server
):
logger
.
warn
(
'
%s is not a trusted ID server: rejecting 3pid
'
+
'
credentials
'
,
id_server
)
defer
.
returnValue
(
None
)
data
=
{}
try
:
...
...
@@ -129,6 +136,12 @@ class IdentityHandler(BaseHandler):
def
requestEmailToken
(
self
,
id_server
,
email
,
client_secret
,
send_attempt
,
**
kwargs
):
yield
run_on_reactor
()
if
not
self
.
_should_trust_id_server
(
id_server
):
raise
SynapseError
(
400
,
"
Untrusted ID server
'
%s
'"
%
id_server
,
Codes
.
SERVER_NOT_TRUSTED
)
params
=
{
'
email
'
:
email
,
'
client_secret
'
:
client_secret
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment