Skip to content
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

feat(key-auth) skip authenticating preflight OPTIONS requests #2743

Closed
wants to merge 3 commits into from

Conversation

Tieske
Copy link
Member

@Tieske Tieske commented Jul 27, 2017

rebased version of #1535

fixes #1292, #1535

ecmendenhall and others added 2 commits August 24, 2016 10:34
Preflight OPTIONS requests explicitly exclude user credentials
and custom headers. The key-auth plugin should not attempt to
authenticate OPTIONS requests, since browsers will strip Kong's
apiKey header.

Fix #1292
new config variable authenticate_preflight to control whether or not to
authenticate OPTIONS requests.
@Tieske Tieske self-assigned this Jul 27, 2017
@Tieske Tieske force-pushed the fix/key-auth-cors-options-requests branch 2 times, most recently from 2b3a041 to a454a98 Compare July 27, 2017 13:04
Copy link
Member

@kikito kikito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion to use a "default false" option. The same would apply to the other plugin pr too.

@@ -149,6 +150,15 @@ end
function KeyAuthHandler:access(conf)
KeyAuthHandler.super.access(self)

-- check if preflight request and wether it should be authenticated
if conf.authenticate_preflight == false and get_method() == "OPTIONS" then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making a "default true" option (authenticate_preflight) we could make a "default false" one (skip_preflight). That way the default nil would just work: if conf.skip_preflight and .... No migration needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are others already: https://github.com/Mashape/kong/blob/master/kong/plugins/cors/schema.lua#L24

if this gets merged into master I plan to create a PR against next that removes the comments, reverts this to if not conf.authenticate_preflight and ..., and implements the migration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good then!

Tieske added a commit that referenced this pull request Jul 31, 2017
This belongs to PR #2743 which went into a minor version.
Tieske added a commit that referenced this pull request Aug 1, 2017
This belongs to PR #2743 which went into a minor version.
@Tieske Tieske force-pushed the fix/key-auth-cors-options-requests branch from a454a98 to 3c10393 Compare August 2, 2017 07:10
@Tieske Tieske force-pushed the fix/key-auth-cors-options-requests branch from 3c10393 to 59b607a Compare August 2, 2017 08:42
Tieske added a commit that referenced this pull request Aug 2, 2017
This belongs to PR #2743 which went into a minor version.
@Tieske Tieske closed this Aug 31, 2017
@Tieske Tieske deleted the fix/key-auth-cors-options-requests branch August 31, 2017 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: key-auth plugin validating OPTIONS requests with CORS and preflight_continue=true
4 participants