This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Printf debugging for MSISDN validation #11882
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -468,6 +468,12 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]: | |
|
||
msisdn = phone_number_to_msisdn(country, phone_number) | ||
|
||
# Didn't like the sound of logging `client_secret`, but the spec says it is | ||
# "A unique string generated by the client, and used to identify the validation | ||
# attempt." I.e. something to facilitate deduplication. I don't think it's a | ||
# sensitive secret per se. | ||
logger.info("Request to verify ownership of %s: %s", msisdn, body) | ||
|
||
if not check_3pid_allowed(self.hs, "msisdn", msisdn): | ||
raise SynapseError( | ||
403, | ||
|
@@ -494,6 +500,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]: | |
await self.hs.get_clock().sleep(random.randint(1, 10) / 10) | ||
return 200, {"sid": random_string(16)} | ||
|
||
logger.info("MSISDN %s is already in use by %s", msisdn, existing_user_id) | ||
raise SynapseError(400, "MSISDN is already in use", Codes.THREEPID_IN_USE) | ||
|
||
if not self.hs.config.registration.account_threepid_delegate_msisdn: | ||
|
@@ -518,6 +525,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]: | |
threepid_send_requests.labels(type="msisdn", reason="add_threepid").observe( | ||
send_attempt | ||
) | ||
logger.info("MSISDN %s is already in use by %s", msisdn, existing_user_id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't look like it's in the right place? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, looks like a copy paste fail. thanks. |
||
|
||
return 200, ret | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not so much used to deduplicate but rather to make sure the next request(s) come from the client that started the process. I'm not sure what amount of harm can be done if someone gets a hold of someone else's client secret, but my paranoid self would prefer being cautious and not logging it if we don't need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't grok that it was to be sent in another request.