Page MenuHomePhabricator

Extend MediaWiki Session framework to support OpenAPI metadata
Closed, ResolvedPublic5 Estimated Story Points

Description

Update SessionProvider and SessionManager to allow Session Cookies and OAuth to declare OpenAPI characteristics necessary for OpenAPI specs.

Currently, our OpenAPI specification generator has no way to dynamically determine which authentication methods are loaded and how they are configured. Instead of hard-coding security definitions in the spec generator, this task allows each session provider to define its own metadata. The SessionManager will aggregate these definitions and generate safe, unique dictionary keys for the final spec.

Conditions of Acceptance

References

components:
 securitySchemes:
   MediaWiki-Session-CookieSessionProvider-Session:
     type: apiKey
     in: cookie
     name: hewikiSession
     description: |
       MediaWiki Session ID cookie.
       Note: Write operations using this method also require a CSRF token to be submitted in the request body.
   MediaWiki-Session-CookieSessionProvider-UserID:
     type: apiKey
     in: cookie
     name: hewikiUserID
     description: |
       MediaWiki User ID cookie.
       Required alongside the session ID.   
   MediaWiki-Session-CookieSessionProvider-Token:
     type: apiKey
     in: cookie
     name: hewikiToken
     description: |
       MediaWiki User Token cookie.
       Required for persistent session verification.
   MediaWiki-Extension-OAuth-SessionProvider:
     type: oauth2
     description: Authorization code flow
     flows:
       authorizationCode:
         authorizationUrl: https://example.com/w/rest.php/oauth2/authorize
         tokenUrl: https://example.com/w/rest.php/oauth2/token
         scopes: {}

View of This Task in Context of Related Tasks

implementation_tasks_result_T423552_spike_security_scheme_information_MediaWiki_REST_API_description.png (4,372×8,192 px, 1 MB)

Event Timeline

KBach triaged this task as Medium priority.May 28 2026, 8:55 AM
KineticPelagic renamed this task from Add security scheme information to MediaWiki REST API description to Extend Session framework to support OpenAPI metadata.May 28 2026, 2:27 PM
KineticPelagic updated the task description. (Show Details)
KineticPelagic renamed this task from Extend Session framework to support OpenAPI metadata to Extend MediaWiki Session framework to support OpenAPI metadata.Jun 1 2026, 4:56 AM
KineticPelagic updated the task description. (Show Details)
KineticPelagic updated the task description. (Show Details)
KineticPelagic updated the task description. (Show Details)
BPirkle set the point value for this task to 5.Jun 2 2026, 2:52 PM
BPirkle subscribed.

Estimated synchronously during sprint planning

Change #1302980 had a related patch set uploaded (by Aghirelli; author: Aghirelli):

[mediawiki/core@master] session: Let session providers declare OpenAPI security schemes

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

Change #1302980 merged by jenkins-bot:

[mediawiki/core@master] session: Let session providers declare OpenAPI security schemes

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

HCoplin-WMF subscribed.

Marking as resolved to close out sprint.