Skip to content

Commit d118c3a

Browse files
authored
fix: do not validate user emails (#366)
* fix: do not validate user emails This causes problems because invalid emails can show up in Keycloak either from other other identity providers.
1 parent 5bfd1f9 commit d118c3a

File tree

6 files changed

+21
-12
lines changed

6 files changed

+21
-12
lines changed

components/renku_data_services/namespace/api.spec.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,10 @@ components:
519519
maxLength: 256
520520
UserEmail:
521521
type: string
522-
format: email
522+
# We can get invalid emails when people log in via Github or other services
523+
# It seems that in some cases Keycloak does not verify emails and this will then fail
524+
# See: https://github.com/SwissDataScienceCenter/renku-data-services/issues/367
525+
# format: email
523526
description: User email
524527
525528
NamespaceGetQuery:

components/renku_data_services/namespace/apispec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# generated by datamodel-codegen:
22
# filename: api.spec.yaml
3-
# timestamp: 2024-08-13T13:29:48+00:00
3+
# timestamp: 2024-08-23T11:11:50+00:00
44

55
from __future__ import annotations
66

77
from datetime import datetime
88
from enum import Enum
99
from typing import List, Optional
1010

11-
from pydantic import ConfigDict, EmailStr, Field, RootModel
11+
from pydantic import ConfigDict, Field, RootModel
1212
from renku_data_services.namespace.apispec_base import BaseAPISpec
1313

1414

@@ -185,7 +185,7 @@ class GroupMemberResponse(BaseAPISpec):
185185
example="f74a228b-1790-4276-af5f-25c2424e9b0c",
186186
pattern="^[A-Za-z0-9]{1}[A-Za-z0-9-]+$",
187187
)
188-
email: Optional[EmailStr] = Field(
188+
email: Optional[str] = Field(
189189
None, description="User email", example="[email protected]"
190190
)
191191
first_name: Optional[str] = Field(

components/renku_data_services/project/api.spec.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,10 @@ components:
493493
maxLength: 256
494494
UserEmail:
495495
type: string
496-
format: email
496+
# We can get invalid emails when people log in via Github or other services
497+
# It seems that in some cases Keycloak does not verify emails and this will then fail
498+
# See: https://github.com/SwissDataScienceCenter/renku-data-services/issues/367
499+
# format: email
497500
description: User email
498501
499502
ETag:

components/renku_data_services/project/apispec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# generated by datamodel-codegen:
22
# filename: api.spec.yaml
3-
# timestamp: 2024-08-13T13:29:47+00:00
3+
# timestamp: 2024-08-23T11:11:48+00:00
44

55
from __future__ import annotations
66

77
from datetime import datetime
88
from enum import Enum
99
from typing import List, Optional
1010

11-
from pydantic import ConfigDict, EmailStr, Field, RootModel
11+
from pydantic import ConfigDict, Field, RootModel
1212
from renku_data_services.project.apispec_base import BaseAPISpec
1313

1414

@@ -78,7 +78,7 @@ class ProjectMemberResponse(BaseAPISpec):
7878
example="f74a228b-1790-4276-af5f-25c2424e9b0c",
7979
pattern="^[A-Za-z0-9]{1}[A-Za-z0-9-]+$",
8080
)
81-
email: Optional[EmailStr] = Field(
81+
email: Optional[str] = Field(
8282
None, description="User email", example="[email protected]"
8383
)
8484
first_name: Optional[str] = Field(

components/renku_data_services/users/api.spec.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,10 @@ components:
360360
maxLength: 256
361361
UserEmail:
362362
type: string
363-
format: email
363+
# We can get invalid emails when people log in via Github or other services
364+
# It seems that in some cases Keycloak does not verify emails and this will then fail
365+
# See: https://github.com/SwissDataScienceCenter/renku-data-services/issues/367
366+
# format: email
364367
description: User email
365368
366369
SecretsList:

components/renku_data_services/users/apispec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# generated by datamodel-codegen:
22
# filename: api.spec.yaml
3-
# timestamp: 2024-08-13T13:29:47+00:00
3+
# timestamp: 2024-08-23T11:11:45+00:00
44

55
from __future__ import annotations
66

77
from datetime import datetime
88
from enum import Enum
99
from typing import List, Optional
1010

11-
from pydantic import ConfigDict, EmailStr, Field, RootModel
11+
from pydantic import ConfigDict, Field, RootModel
1212
from renku_data_services.users.apispec_base import BaseAPISpec
1313

1414

@@ -117,7 +117,7 @@ class UserWithId(BaseAPISpec):
117117
max_length=99,
118118
min_length=1,
119119
)
120-
email: Optional[EmailStr] = Field(
120+
email: Optional[str] = Field(
121121
None, description="User email", example="[email protected]"
122122
)
123123
first_name: Optional[str] = Field(

0 commit comments

Comments
 (0)