-
Notifications
You must be signed in to change notification settings - Fork 9
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
Require OAuth for search engine checks #52
Conversation
Holding this until 14:00 UTC (or slightly later) to wait for comments from Earwig, then will deploy to Toolforge. |
984943b
to
cb72361
Compare
Just added a workflow speedup: the query attempted at request time should be run immediately after finishing the auth flow. |
cb72361
to
45a6317
Compare
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.
Looks good aside from a couple minor comments!
e90b4c9
to
3c367f0
Compare
3c367f0
to
e267151
Compare
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.
Just a couple more.
Adds the initial backend requirements for the OAuth flow, which will be made required for all search engine checks. This adds three new routes: - `/login` (GET, POST) - for logging in - `/logout` (GET, POST) - for logging out - `/oauth-callback` - OAuth 1.0a callback route Login/logout state can be checked through the header. By default, a separate page navigation is not required when the link is clicked by the user. When following a link to `/log(in|out)`, however, an extra button will be shown to prevent inadvertent logins/logouts.
Begin requiring OAuth for search engine checks. This adds an extra validation step in checker.py. It occurs after a cached result is checked for, which allows unauthenticated viewers to still preview cached results.
e267151
to
10add79
Compare
This PR adds the initial backend requirements for the OAuth flow and makes authentication required for all uncached search engine checks. This adds three new routes:
/login
(GET, POST) - for logging in/logout
(GET, POST) - for logging out/oauth-callback
- OAuth 1.0a callback route, used by MediaWikiThis requires the following
.earwigbot/config.yml
values:wiki.copyvios.oauth.consumer_token
wiki.copyvios.oauth.consumer_secret
This requires a new file in the root folder (on Toolforge,
~/git/copyvios/
) namedconfig.py
, to be used by Flask. This has already been added on Toolforge. This should export a single value,SECRET_KEY
, which will be used to encrypt session data. An exampleconfig.py
file can be as follows:This adds
mwoauth==0.3.8
as a requirement.0.4.0
is not a possible version since it is Python 3.x-only. There doesn't seem to be any significant differences between the two which would be detrimental to the auth flow.Login/logout state can be checked through the page header. By default, a separate page navigation is not required when the link is clicked by the user. When following a link to
/log(in|out)
, however, an extra button will be shown to prevent inadvertent logins/logouts.Cached data is still shown to unauthenticated users when available.
The commit which enables the requirement is separated to make it easily revertible in case something bad happens during deployment.