rustdesk / rustdesk/rustdesk-server-pro
Add trusted_audiences OIDC config for providers with multi-audience tokens (Zitadel)
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 317
- Forks
- 119
- PR merge metrics
- No merged PRs in 30d
Description
Problem
RustDesk Server Pro's OIDC implementation rejects ID tokens that contain additional values in the aud claim beyond the configured client_id. This breaks compatibility with OIDC providers that include extra audience entries by design.
Error:
Failed to verify ID token, Invalid audiences: `<project_id>` is not a trusted audience
Affected provider: Zitadel — a CNCF-listed, open-source OIDC provider popular in self-hosted environments. Zitadel always includes the project ID alongside the client ID in the aud claim for all project-scoped applications. This is by design and cannot currently be disabled.
The same issue affects other tools that use the openidconnect-rs crate with default audience validation, including Proxmox VE.
Suggested Fix
The openidconnect-rs crate's IdTokenVerifier supports set_other_audience_verifier_fn to accept additional audience values. This is a minimal change:
// Before
let verifier = id_token_verifier();
// After — trust configured additional audiences
let trusted: HashSet<String> = config.trusted_audiences.iter().cloned().collect();
let verifier = id_token_verifier()
.set_other_audience_verifier_fn(move |aud| trusted.contains(aud.as_str()));
And a new field in the OIDC provider config (oidc_config.toml):
[providers.Zitadel]
client_id = "..."
# ...existing fields...
trusted_audiences = ["<zitadel_project_id>"]
Precedent
Vaultwarden solved this same issue by adding an SSO_AUDIENCE_TRUSTED environment variable (dani-garcia/vaultwarden#6650).
Environment
- RustDesk Server Pro: latest
- OIDC Provider: Zitadel v4.12.1
- Deployment: Kubernetes (self-hosted)
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 by locating the OIDC provider configuration represented by oidc_config.toml and the code that builds the openidconnect-rs IdTokenVerifier. Check how configured audiences are parsed and validated, then add trusted_audiences support as described. Done means additional configured audiences are accepted without weakening validation of other token claims, with coverage for a multi-audience provider such as Zitadel.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- authentication
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100