mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-08 08:04:25 +00:00
fix: skip token expiry notifications for debugger and mcp-oauth tokens (#8316)
* fix: skip token expiry notifications for debugger and mcp-oauth tokens Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: update frontend isUserToken to match backend filter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: add cross-reference comments to token filter functions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
2aef01d18c
commit
8667329110
+10
-1
@@ -880,10 +880,19 @@ struct TokenRow {
|
||||
workspace_id: Option<String>,
|
||||
}
|
||||
|
||||
/// When updating this filter, also update:
|
||||
/// - `register_token_expiry_notification` in windmill-api-auth/src/lib.rs
|
||||
/// - `isUserToken` in frontend/src/lib/components/settings/TokensTable.svelte
|
||||
fn is_user_token(label: Option<&str>) -> bool {
|
||||
match label {
|
||||
None => true,
|
||||
Some(l) => l != "session" && !l.starts_with("ephemeral") && !l.starts_with("Ephemeral"),
|
||||
Some(l) => {
|
||||
l != "session"
|
||||
&& !l.starts_with("ephemeral")
|
||||
&& !l.starts_with("Ephemeral")
|
||||
&& l != "debugger-token"
|
||||
&& !l.starts_with("mcp-oauth-")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -581,6 +581,9 @@ pub async fn create_token_internal(
|
||||
}
|
||||
|
||||
/// Insert a pending expiry notification row for user tokens that have an expiration.
|
||||
/// When updating this filter, also update:
|
||||
/// - `is_user_token` in src/monitor.rs
|
||||
/// - `isUserToken` in frontend/src/lib/components/settings/TokensTable.svelte
|
||||
pub async fn register_token_expiry_notification(
|
||||
tx: &mut sqlx::PgConnection,
|
||||
token: &str,
|
||||
@@ -589,7 +592,12 @@ pub async fn register_token_expiry_notification(
|
||||
) {
|
||||
let Some(expiration) = expiration else { return };
|
||||
if label == Some("session")
|
||||
|| label.is_some_and(|l| l.starts_with("ephemeral") || l.starts_with("Ephemeral"))
|
||||
|| label.is_some_and(|l| {
|
||||
l.starts_with("ephemeral")
|
||||
|| l.starts_with("Ephemeral")
|
||||
|| l == "debugger-token"
|
||||
|| l.starts_with("mcp-oauth-")
|
||||
})
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,9 +38,17 @@
|
||||
listTokens()
|
||||
})
|
||||
|
||||
// When updating this filter, also update:
|
||||
// - `is_user_token` in backend/src/monitor.rs
|
||||
// - `register_token_expiry_notification` in backend/windmill-api-auth/src/lib.rs
|
||||
function isUserToken(label: string | undefined): boolean {
|
||||
if (!label) return true
|
||||
return label !== 'session' && !label.toLowerCase().startsWith('ephemeral')
|
||||
return (
|
||||
label !== 'session' &&
|
||||
!label.toLowerCase().startsWith('ephemeral') &&
|
||||
label !== 'debugger-token' &&
|
||||
!label.startsWith('mcp-oauth-')
|
||||
)
|
||||
}
|
||||
|
||||
function daysUntilExpiration(expiration: string | undefined): number | null {
|
||||
|
||||
Reference in New Issue
Block a user