From a4626f9bdb4ff4116ef54b6400a5b747442791db Mon Sep 17 00:00:00 2001 From: Elio Bischof Date: Fri, 27 Oct 2023 08:09:07 +0200 Subject: [PATCH] fix: return unauthenticated code (#6819) * fix: return unauthenticated code * remove cfg.yaml --------- Co-authored-by: Livio Spring --- internal/api/authz/context.go | 3 +-- internal/static/i18n/bg.yaml | 1 + internal/static/i18n/de.yaml | 1 + internal/static/i18n/en.yaml | 1 + internal/static/i18n/es.yaml | 1 + internal/static/i18n/fr.yaml | 1 + internal/static/i18n/it.yaml | 1 + internal/static/i18n/ja.yaml | 1 + internal/static/i18n/mk.yaml | 1 + internal/static/i18n/pl.yaml | 1 + internal/static/i18n/pt.yaml | 1 + internal/static/i18n/zh.yaml | 1 + 12 files changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/api/authz/context.go b/internal/api/authz/context.go index 0aa22943dd..52ac598474 100644 --- a/internal/api/authz/context.go +++ b/internal/api/authz/context.go @@ -109,9 +109,8 @@ func VerifyTokenAndCreateCtxData(ctx context.Context, token, orgID, orgDomain st if err != nil { var sysTokenErr error sysMemberships, userID, sysTokenErr = t.VerifySystemToken(ctx, tokenWOBearer, orgID) - err = errors.Join(err, sysTokenErr) if sysTokenErr != nil || sysMemberships == nil { - return CtxData{}, err + return CtxData{}, zitadel_errors.ThrowUnauthenticated(errors.Join(err, sysTokenErr), "AUTH-7fs1e", "Errors.Token.Invalid") } } var projectID string diff --git a/internal/static/i18n/bg.yaml b/internal/static/i18n/bg.yaml index 9c5784e3bd..a0b757ac2c 100644 --- a/internal/static/i18n/bg.yaml +++ b/internal/static/i18n/bg.yaml @@ -436,6 +436,7 @@ Errors: AuditRetention: Историята е извън съхранението на журнала за проверка Token: NotFound: Токенът не е намерен + Invalid: Токенът е невалиден UserSession: NotFound: UserSession не е намерена Key: diff --git a/internal/static/i18n/de.yaml b/internal/static/i18n/de.yaml index 3fe394ce08..e3c357288e 100644 --- a/internal/static/i18n/de.yaml +++ b/internal/static/i18n/de.yaml @@ -424,6 +424,7 @@ Errors: AuditRetention: Änderungsverlauf ist ausserhalb der Audit Log Retention Token: NotFound: Token konnte nicht gefunden werden + Invalid: Token ist ungültig UserSession: NotFound: Benutzer Sitzung konnte nicht gefunden werden Key: diff --git a/internal/static/i18n/en.yaml b/internal/static/i18n/en.yaml index 17a7dea05e..cc9e539446 100644 --- a/internal/static/i18n/en.yaml +++ b/internal/static/i18n/en.yaml @@ -424,6 +424,7 @@ Errors: AuditRetention: History is outside of the Audit Log Retention Token: NotFound: Token not found + Invalid: Token is invalid UserSession: NotFound: UserSession not found Key: diff --git a/internal/static/i18n/es.yaml b/internal/static/i18n/es.yaml index e4e62c72af..066724cb7a 100644 --- a/internal/static/i18n/es.yaml +++ b/internal/static/i18n/es.yaml @@ -424,6 +424,7 @@ Errors: AuditRetention: El histórico está fuera de la retención del registro de auditoría Token: NotFound: Token no encontrado + Invalid: Token no válido UserSession: NotFound: UserSession no encontrado Key: diff --git a/internal/static/i18n/fr.yaml b/internal/static/i18n/fr.yaml index 4defb4e449..43505067c6 100644 --- a/internal/static/i18n/fr.yaml +++ b/internal/static/i18n/fr.yaml @@ -424,6 +424,7 @@ Errors: AuditRetention: L'historique est en dehors de la rétention du journal d'audit Token: NotFound: Token non trouvé + Invalid: Le jeton n'est pas valide UserSession: NotFound: UserSession non trouvé Key: diff --git a/internal/static/i18n/it.yaml b/internal/static/i18n/it.yaml index b8be789620..5c4787be0c 100644 --- a/internal/static/i18n/it.yaml +++ b/internal/static/i18n/it.yaml @@ -425,6 +425,7 @@ Errors: AuditRetention: La storia è al di fuori della Ritenzione Audit Log Token: NotFound: Token non trovato + Invalid: Token non valido UserSession: NotFound: Sessione non trovata Key: diff --git a/internal/static/i18n/ja.yaml b/internal/static/i18n/ja.yaml index d615c1c9b5..9752b68ea2 100644 --- a/internal/static/i18n/ja.yaml +++ b/internal/static/i18n/ja.yaml @@ -413,6 +413,7 @@ Errors: AuditRetention: 履歴は監査ログの管理外にあります Token: NotFound: トークンが見つかりません + Invalid: 無効なトークンです UserSession: NotFound: ユーザーが見つかりません Key: diff --git a/internal/static/i18n/mk.yaml b/internal/static/i18n/mk.yaml index e6ee3052d7..c2544d4321 100644 --- a/internal/static/i18n/mk.yaml +++ b/internal/static/i18n/mk.yaml @@ -424,6 +424,7 @@ Errors: AuditRetention: Историјата е надвор од задржувањето на аудитот Token: NotFound: Токенот не е пронајден + Invalid: Токенот е невалиден UserSession: NotFound: Корисничката сесија не е пронајдена Key: diff --git a/internal/static/i18n/pl.yaml b/internal/static/i18n/pl.yaml index 600c3feac4..230600d059 100644 --- a/internal/static/i18n/pl.yaml +++ b/internal/static/i18n/pl.yaml @@ -424,6 +424,7 @@ Errors: AuditRetention: Historia jest poza zasięgiem retencji dziennika audytu Token: NotFound: Token nie znaleziony + Invalid: Token jest nieprawidłowy UserSession: NotFound: Sesja użytkownika nie znaleziona Key: diff --git a/internal/static/i18n/pt.yaml b/internal/static/i18n/pt.yaml index ae911dcc6a..92a93fb5a9 100644 --- a/internal/static/i18n/pt.yaml +++ b/internal/static/i18n/pt.yaml @@ -422,6 +422,7 @@ Errors: AuditRetention: O histórico está fora do período de retenção do registro de auditoria Token: NotFound: Token não encontrado + Invalid: Token inválido UserSession: NotFound: Sessão do usuário não encontrada Key: diff --git a/internal/static/i18n/zh.yaml b/internal/static/i18n/zh.yaml index 28631eba4e..8c3210925d 100644 --- a/internal/static/i18n/zh.yaml +++ b/internal/static/i18n/zh.yaml @@ -424,6 +424,7 @@ Errors: AuditRetention: 历史记录在审核日志保留范围之外 Token: NotFound: 令牌不存在 + Invalid: 令牌无效 UserSession: NotFound: 用户会话不存在 Key: