Skip to content

Commit 286e4b2

Browse files
committed
fix: change ulid regex to validate correct range
1 parent 6d79572 commit 286e4b2

File tree

16 files changed

+40
-40
lines changed

16 files changed

+40
-40
lines changed

bases/renku_data_services/data_api/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
def register_all_handlers(app: Sanic, config: Config) -> Sanic:
2828
"""Register all handlers on the application."""
29-
app.router.register_pattern("ulid", ULID.from_str, r"^[0-9A-HJKMNP-TV-Z]{26}$")
29+
app.router.register_pattern("ulid", ULID.from_str, r"^[0-7][0-9A-HJKMNP-TV-Z]{25}$")
3030
app.router.register_pattern("renku_slug", str, r"^[a-zA-Z0-9][a-zA-Z0-9\-_.]*$")
3131

3232
url_prefix = "/api/data"

components/renku_data_services/connected_services/api.spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ components:
309309
type: string
310310
minLength: 26
311311
maxLength: 26
312-
pattern: "^[A-Z0-9]{26}$" # This is case-insensitive
312+
pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive
313313
ProviderId:
314314
description: ID of a OAuth2 provider, e.g. "gitlab.com".
315315
type: string

components/renku_data_services/connected_services/apispec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: api.spec.yaml
3-
# timestamp: 2024-08-06T05:55:35+00:00
3+
# timestamp: 2024-08-12T06:46:18+00:00
44

55
from __future__ import annotations
66

@@ -153,7 +153,7 @@ class Connection(BaseAPISpec):
153153
description="ULID identifier",
154154
max_length=26,
155155
min_length=26,
156-
pattern="^[A-Z0-9]{26}$",
156+
pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
157157
)
158158
provider_id: str = Field(
159159
...,

components/renku_data_services/namespace/api.spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ components:
365365
type: string
366366
minLength: 26
367367
maxLength: 26
368-
pattern: "^[A-Z0-9]{26}$" # This is case-insensitive
368+
pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive
369369
NamespaceName:
370370
description: Renku group or namespace name
371371
type: string

components/renku_data_services/namespace/apispec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: api.spec.yaml
3-
# timestamp: 2024-08-06T08:46:00+00:00
3+
# timestamp: 2024-08-12T06:46:16+00:00
44

55
from __future__ import annotations
66

@@ -29,7 +29,7 @@ class NamespaceResponse(BaseAPISpec):
2929
description="ULID identifier",
3030
max_length=26,
3131
min_length=26,
32-
pattern="^[A-Z0-9]{26}$",
32+
pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
3333
)
3434
name: Optional[str] = Field(
3535
None,
@@ -93,7 +93,7 @@ class GroupResponse(BaseAPISpec):
9393
description="ULID identifier",
9494
max_length=26,
9595
min_length=26,
96-
pattern="^[A-Z0-9]{26}$",
96+
pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
9797
)
9898
name: str = Field(
9999
...,

components/renku_data_services/project/api.spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ components:
360360
type: string
361361
minLength: 26
362362
maxLength: 26
363-
pattern: "^[A-Z0-9]{26}$" # This is case-insensitive
363+
pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive
364364
ProjectName:
365365
description: Renku project name
366366
type: string

components/renku_data_services/project/apispec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: api.spec.yaml
3-
# timestamp: 2024-08-06T05:55:31+00:00
3+
# timestamp: 2024-08-12T06:46:15+00:00
44

55
from __future__ import annotations
66

@@ -112,7 +112,7 @@ class Project(BaseAPISpec):
112112
description="ULID identifier",
113113
max_length=26,
114114
min_length=26,
115-
pattern="^[A-Z0-9]{26}$",
115+
pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
116116
)
117117
name: str = Field(
118118
...,

components/renku_data_services/repositories/api.spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ components:
103103
type: string
104104
minLength: 26
105105
maxLength: 26
106-
pattern: "^[A-Z0-9]{26}$" # This is case-insensitive
106+
pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive
107107
ProviderId:
108108
description: ID of a OAuth2 provider, e.g. "gitlab.com".
109109
type: string

components/renku_data_services/repositories/apispec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: api.spec.yaml
3-
# timestamp: 2024-08-06T05:55:37+00:00
3+
# timestamp: 2024-08-12T06:46:19+00:00
44

55
from __future__ import annotations
66

@@ -61,6 +61,6 @@ class RepositoryProviderMatch(BaseAPISpec):
6161
description="ULID identifier",
6262
max_length=26,
6363
min_length=26,
64-
pattern="^[A-Z0-9]{26}$",
64+
pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
6565
)
6666
repository_metadata: Optional[RepositoryMetadata] = None

components/renku_data_services/secrets/api.spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ components:
8989
type: string
9090
minLength: 26
9191
maxLength: 26
92-
pattern: "^[A-Z0-9]{26}$" # This is case-insensitive
92+
pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive
9393
ErrorResponse:
9494
type: object
9595
properties:

0 commit comments

Comments
 (0)