-
Notifications
You must be signed in to change notification settings - Fork 147
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
Authenticate requests to the /provision endpoint #1035
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**SECURITY FIX** The bridge now authenticatess the /_matrix/provision set of endpoints. It now requires either a `access_token` query parameter or a `Authorization` header containing the `hs_token` provided in the registration file. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -132,12 +132,18 @@ export class Provisioner { | |||||
|
||||||
// Deal with CORS (temporarily for s-web) | ||||||
app.use((req, res, next) => { | ||||||
if (!this.ircBridge.getAppServiceBridge().requestCheckToken(req)) { | ||||||
return res.status(403).send({ | ||||||
errcode: "M_FORBIDDEN", | ||||||
error: "Bad token supplied," | ||||||
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.
Suggested change
|
||||||
}); | ||||||
} | ||||||
if (this.isProvisionRequest(req)) { | ||||||
res.header("Access-Control-Allow-Origin", "*"); | ||||||
res.header("Access-Control-Allow-Headers", | ||||||
"Origin, X-Requested-With, Content-Type, Accept"); | ||||||
} | ||||||
next(); | ||||||
return next(); | ||||||
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. What does returning |
||||||
}); | ||||||
|
||||||
app.post("/_matrix/provision/link", | ||||||
|
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.
This comment which once described the entire purpose of this handler has now become outdated.