TheHive-Project / TheHive-Project/Cortex
Feature Request: Add optional PKCE support for OAuth2 / SSO Authentication
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.6k
- Forks
- 264
- PR merge metrics
- No merged PRs in 30d
Description
Description
Currently, the OAuth2 authentication module in Cortex supports the standard Authorization Code flow. However, many modern Identity Providers (IdPs) now strictly require or strongly recommend using PKCE (Proof Key for Code Exchange) for enhanced security.
Without PKCE support, integrating Cortex with these modern SSO environments can be problematic or completely blocked by strict enterprise security policies.
Proposed Solution
I propose adding PKCE support to the existing OAuth2 flow in Cortex, while keeping it 100% backward compatible for existing installations.
The implementation would include:
- Adding a new configuration boolean parameter
auth.oauth2.pkce(defaulting tofalse) for Cortex application.conf. - If enabled, dynamically generating a
code_verifierand its hashedcode_challenge(S256). - Appending the
code_challengeto the initial authorization URL. - Retrieving the
code_verifierfrom the session and sending it in the payload during the final token exchange request.
Alternatives Considered
Leaving the implementation as-is forces administrators to lower their IdP security requirements. Forcing PKCE for everyone might break integrations with older IdPs that do not tolerate unknown parameters. Making it configurable solves both issues.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Cortex's OAuth2 authentication module and the application.conf configuration entry point; trace the authorization URL, session handling, and final token exchange. Done means an optional auth.oauth2.pkce setting preserves the existing default flow while adding S256 verifier and challenge handling when enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- authentication, security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100