Skip to content
Snippets Groups Projects

Fix CORS and add implicit grant

Closed username-removed-3521 requested to merge medokin/gitlab-ce:master into master
1 unresolved thread

What does this MR do?

Adds missing CORS header and enables implicit oauth grant flow.

Why was this MR needed?

Web clients cannot login with oauth or password and are not allowed to use pagination X-Headers.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Fixes #19470 (closed), #20628 (closed), #2716 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • You're right link header isn't used. I will remove it. What do you mean with other steps?

  • Thanks @medokin! I realise the mistake in my comment above now, but I don't think this is enough. In a web browser, this should use the implicit grant, which we don't currently support: http://docs.gitlab.com/ce/api/oauth2.html#web-application-flow / https://gitlab.com/gitlab-org/gitlab-ce/issues/20628. That is what we should be supporting, unless there's something I'm missing?

    Without that, the JS application will have to leak its own client secret.

  • username-removed-3521 Resolved all discussions

    Resolved all discussions

  • @medokin it seems that way. Do you have an actual client app that can be used to test this? I understand that it isn't really possible to write specs for this, but I'd like something we can test with and perhaps add to gitlab-qa. /cc @grzesiek

    Also, without a test app, we can't really verify that this only works for the cases we want it to!

  • @smcgivern Yes I have an app I will provide when this MR is ready.

  • Added 1 commit:

  • Added 1 commit:

    • e50b401e - Updated CORS exposed headers
  • username-removed-3521 Changed title: WIP: Allow CORS on oauth loginWIP: Fix CORS and add implicit grant

    Changed title: WIP: Allow CORS on oauth loginWIP: Fix CORS and add implicit grant

  • Added 5 commits:

    • 0066cbf9 - Prevent .form-actions element from leaking out of the main container
    • b080f358 - Updated CHANGELOG
    • d96e8959 - Fix due date example in slash commands documentation
    • 59f39776 - Add angle brackets around due date in slash cmds docs
    • cad99a2b - Add Changelog
  • Added 10 commits:

  • Added 1 commit:

  • username-removed-3521 Marked the task CHANGELOG entry added as completed

    Marked the task CHANGELOG entry added as completed

  • username-removed-3521 Marked the task Branch has no merge conflicts with master (if you do - rebase it please) as completed

    Marked the task Branch has no merge conflicts with master (if you do - rebase it please) as completed

  • username-removed-3521 Marked the task Conform by the style guides as completed

    Marked the task Conform by the style guides as completed

  • username-removed-3521 Marked the task All builds are passing as completed

    Marked the task All builds are passing as completed

  • username-removed-3521 Marked the task Branch has no merge conflicts with master (if you do - rebase it please) as incomplete

    Marked the task Branch has no merge conflicts with master (if you do - rebase it please) as incomplete

  • Added 27 commits:

  • username-removed-3521 Unmarked this merge request as a Work In Progress

    Unmarked this merge request as a Work In Progress

  • username-removed-3521 Marked the task Branch has no merge conflicts with master (if you do - rebase it please) as completed

    Marked the task Branch has no merge conflicts with master (if you do - rebase it please) as completed

  • @smcgivern I have an Emberjs app ready to test with. What will be the next step?

  • I've added checking CORS to gitlab-qa todos - gitlab-qa#3.

  • @medokin can you push your test app to a public repo somewhere? If not, it looks like we can use something like https://adodson.com/hello.js

  • Added ~164274 label

  • /cc @nick.thomas (since you've touched the CORS stuff recently)

  • @rymai this looks sensible to me. It's three different things:

    • Fix missing CORS header on /oauth/token
    • Expose pagination headers on /api/*
    • Enable implicit grant auth flow in doorkeeper.

    The first two are easy 👍 but the third is new to me 😊. I've scanned the RFC segments on the matter and it looks like we could enable it, but I'm lacking context on why we didn't in the first place.

  • Looks like implicit was disabled here: 984f8077

    https://github.com/gitlabhq/gitlabhq/pull/9083

    Edited by Nick Thomas
  • Doorkeeper disabled password and implicit flows in jan 2015: https://github.com/doorkeeper-gem/doorkeeper/commit/2115a5243b4663090b49c872a1837f6dda6b0b91 - v2.1.0. So when we upgraded to that version in 1c49c301, the comment became outdated and the implicit and resource owner password flows were disabled.

    I don't think there should be a problem with re-enabling it, based on what I know so far, but that comment needs fixing and we have merge conflicts too (and more on the way).

  • @nick.thomas Thanks for investigating!

  • username-removed-3521 Added 1530 commits:

    Added 1530 commits:

    • d9aee0ad...166c6cd8 - 1524 commits from branch gitlab-org:master
    • 443ac8a6 - Add organization field to user profile
    • e34d04ec - Dispaly organization name at user page
    • 206311d0 - Add User#organization to users api
    • f6c9ed8c - Improvements to user organization field feature after code review
    • dd2ce02d - Add extra check for api users spec
    • 8cd6aa1e - Allow CORS on oauth login
  • username-removed-3521 Changed title: Fix CORS and add implicit grantconflictsFix CORS and add implicit grant

    Changed title: Fix CORS and add implicit grantconflictsFix CORS and add implicit grant

  • username-removed-3521 Changed title: conflictsFix CORS and add implicit grantFix CORS and add implicit grant

    Changed title: conflictsFix CORS and add implicit grantFix CORS and add implicit grant

  • Added 23 commits:

  • Fixed that comment. But I dont get why it still shows merge conflicts.

  • 7 7 - Fix robots.txt disallowing access to groups starting with "s" (Matt Harrison)
    8 8 - Revoke button in Applications Settings underlines on hover.
    9 9 - Add organization field to user profile
    10
  • Maintainer

    From @medokin:

    Currently on vacation. I could get to it in March. The changes are minimal so I guess you can take over.

  • username-removed-128633 added ~480950 ~13884 oauth labels

    added ~480950 ~13884 oauth labels

  • mentioned in merge request !8606 (merged)

  • mentioned in issue #20628 (closed)

  • It seems we cannot see the diff anymore... I'm closing this for now. @medokin Feel free to reopen and update it, thanks!

  • Hi @medokin, any chance you'll follow up on this M/R? If not I'll create a new one cherry picking your changes.

  • @empe feel free to create a new one. Currently I cannot fit it into my schedule.

  • mentioned in merge request !12384 (merged)

  • Please register or sign in to reply
    Loading