Page MenuHomePhabricator

Use AuthPopup for reauth on EditPage
Closed, ResolvedPublic

Description

Building on the work in T427955 et al, we should use AuthPopup as the default privilege elevation mechanism for the actual re-authentication event. DataStashTrait will still exist, for now, and be used for noJS/error fallback scenarios.

Details

Related Changes in Gerrit:

Event Timeline

Oh, nice! I experimented with this some time ago. AuthPopup currently only handles authentication, not re-authentication, so if you're logged in, it will just confirm that and close itself. It should be easy to change – the following hacky snippet worked for me locally, I'll leave it up to you how to integrate it into the code better:

const require = await mw.loader.using( 'mediawiki.authenticationPopup' );
const authPopup = require( 'mediawiki.authenticationPopup' );

// Hacky overrides so that this works while you're already logged in
authPopup.loginPopupUrl += '&force=editsitejscss';
authPopup.checkLoggedIn = async function () {
     const resp = await new mw.Api().get( {
         'action': 'query',
         'meta': 'authmanagerinfo',
         'amisecuritysensitiveoperation': 'editsitejscss'
     } );
     return resp.query.authmanagerinfo.securitysensitiveoperationstatus === 'ok';
}

authPopup.startPopupWindow();

Change #1305516 had a related patch set uploaded (by SBassett; author: SBassett):

[mediawiki/core@master] Use AuthPopup for reauth on EditPage

https://gerrit.wikimedia.org/r/1305516

Change #1305516 merged by jenkins-bot:

[mediawiki/core@master] Use AuthPopup for reauth on EditPage

https://gerrit.wikimedia.org/r/1305516

sbassett triaged this task as Medium priority.
sbassett added a project: Security-Team.