Skip to content

Switch to DELETE for /logout route to prevent CSRF #1013

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

Merged
merged 1 commit into from
Aug 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/routes/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default Route.extend({
ajax: service(),

activate() {
this.get('ajax').request(`/logout`).then(() => {
this.get('ajax').delete(`/logout`).then(() => {
run(() => {
this.session.logoutUser();
this.transitionTo('index');
Expand Down
2 changes: 2 additions & 0 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ for another platform.

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

* `bors.toml` - Configure our instance of [bors-ng][] for continous integration
* `.editorconfig` - Coding style definitions supported by some IDEs // TODO: Reference extensions
for common editors
* `.env` - Environment variables loaded by the backend - (ignored in `.gitignore`)
Expand All @@ -101,4 +102,5 @@ These files are mostly only relevant when running crates.io's code in developmen
* `.travis.yml` - Configuration for continous integration at [TravisCI][]
* `.watchmanconfig` - Use by Ember CLI to efficiently watch for file changes if you install watchman

[bors-ng]: https://github.com/bors-ng/bors-ng
[TravisCI]: https://travis-ci.org/rust-lang/crates.io
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pub fn middleware(app: Arc<App>) -> MiddlewareBuilder {

router.get("/authorize_url", C(user::github_authorize));
router.get("/authorize", C(user::github_access_token));
router.get("/logout", C(user::logout));
router.delete("/logout", C(user::logout));
router.get("/me", C(user::me));
router.get("/me/updates", C(user::updates));
router.get("/me/tokens", C(token::list));
Expand Down