Skip to content

Commit 608d884

Browse files
Merge #1013
1013: Switch to `DELETE` for /logout route to prevent CSRF r=carols10cents Other sites are allowed to make `GET` requests so switching to `DELETE` to match the destructive nature of the route. If the user navigates to `GET /logout` we now fall back to the default behavior which is to serve up the ember app. Ember then sends a `DELETE` request. Fortunately we already enforce sameorigin for iframes via the `X-FRAME-OPTIONS` header. Fixes: #986
2 parents fa216e3 + 9cb4c98 commit 608d884

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

app/routes/logout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default Route.extend({
77
ajax: service(),
88

99
activate() {
10-
this.get('ajax').request(`/logout`).then(() => {
10+
this.get('ajax').delete(`/logout`).then(() => {
1111
run(() => {
1212
this.session.logoutUser();
1313
this.transitionTo('index');

docs/ARCHITECTURE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ for another platform.
8787

8888
These files are mostly only relevant when running crates.io's code in development mode.
8989

90+
* `bors.toml` - Configure our instance of [bors-ng][] for continous integration
9091
* `.editorconfig` - Coding style definitions supported by some IDEs // TODO: Reference extensions
9192
for common editors
9293
* `.env` - Environment variables loaded by the backend - (ignored in `.gitignore`)
@@ -103,4 +104,5 @@ local development environment
103104
* `.travis.yml` - Configuration for continous integration at [TravisCI][]
104105
* `.watchmanconfig` - Use by Ember CLI to efficiently watch for file changes if you install watchman
105106

107+
[bors-ng]: https://github.com/bors-ng/bors-ng
106108
[TravisCI]: https://travis-ci.org/rust-lang/crates.io

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub fn middleware(app: Arc<App>) -> MiddlewareBuilder {
194194

195195
router.get("/authorize_url", C(user::github_authorize));
196196
router.get("/authorize", C(user::github_access_token));
197-
router.get("/logout", C(user::logout));
197+
router.delete("/logout", C(user::logout));
198198
router.get("/me", C(user::me));
199199
router.get("/me/updates", C(user::updates));
200200
router.get("/me/tokens", C(token::list));

0 commit comments

Comments
 (0)