This repository has been archived by the owner on Oct 11, 2022. It is now read-only.
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.
Status
Deploy after merge (delete what needn't be deployed)
@mxstbr this closes #4571
The reason we initially did
.endsWith('spectrum.chat')
was to ensure logins came from our app. Before joining GitHub we changed this to.endsWith('.spectrum.chat')
to prevent any malicious auth requests from from something likehackerdomainspectrum.chat
Unfortunately this broke redirects from community views. The problem is that we switched to getting the
hostname
fromnew URL(url)
which will only ever return a hostname likespectrum.chat
oralpha.spectrum.chat
, therefore theendsWith
was always missing the first period, andisSpectrumUrl
returned false every time.The fix here is to just not use
endsWith
at all - it's unnecessary sincenew URL
will return the correct hostname from any given url. So we can just match that to prod or alpha and return true.Can you give this a second eye and make sure there's no security implications here? I've deployed this to alpha and confirmed that it fixes login redirects.