Skip to content

Conversation

yuhao-su
Copy link
Contributor

@yuhao-su yuhao-su commented Sep 10, 2025

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

This PR implements OAuth audience validation. Fixed #23126 .

Summary of changes:

  • Added OAuth audience (aud) validation functionality

How does this PR work:
The changes add validation logic to ensure that OAuth tokens contain the correct audience claim before accepting authentication.

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • I have added test labels as necessary.
  • I have added fuzzing tests or opened an issue to track them.
  • My PR contains breaking changes.
  • My PR changes performance-critical code, so I will run (micro) benchmarks and present the results.
  • I have checked the Release Timeline and Currently Supported Versions to determine which release branches I need to cherry-pick this PR into.

Documentation

  • My PR needs documentation updates.
Release note

https://docs.risingwave.com/sql/commands/sql-create-user

We need to update this page to tell users when use oauth, the jwt should contains a aud claim with value urn:risingwave:cluster:your_cluster_id

🤖 Generated with Claude Code

@yuhao-su yuhao-su requested a review from a team as a code owner September 10, 2025 02:43
@yuhao-su yuhao-su requested a review from lmatz September 10, 2025 02:43
@github-actions github-actions bot added the type/feature Type: New feature. label Sep 10, 2025
@yuhao-su yuhao-su changed the title feat(connector): implement OAuth audience validation for Snowflake feat(connector): implement OAuth audience validation Sep 10, 2025
@yuhao-su yuhao-su changed the title feat(connector): implement OAuth audience validation feat(pgwire): implement OAuth audience validation Sep 10, 2025
@yezizp2012
Copy link
Member

Seems to solve the same issue as this one 🥵 : #23143 .

metadata: &HashMap<String, String>,
) -> Result<bool, BoxedError> {
let header = decode_header(jwt)?;
let _header = decode_header(jwt)?;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let _header = decode_header(jwt)?;

}

fn audience_from_cluster_id(cluster_id: &str) -> String {
format!("urn:risingwave:cluster:{}", cluster_id)
Copy link
Member

Choose a reason for hiding this comment

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

Please add a user-facing label to this PR, along with any necessary documentation. Especially the audience format, which will be used to generate the token.

With aud becoming a required field after this PR, Cloud must patch and deploy a version that generates tokens with the audience in the specified format, prior to any releases. Cc @xuhui-lu .
And @yuhao-su, we also need a way to expose the internal cluster_id to Cloud, perhaps via a SQL function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature Type: New feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OAuth audience validation fails when JWT contains "aud" claim
2 participants