-
-
Notifications
You must be signed in to change notification settings - Fork 16
[MNT] Use new test database image #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
509eccf
c4a459e
d327685
c7a220b
17b1794
89d623a
f87ecf5
d866253
cb1689a
10a17d6
a31bd5c
9fb0bde
3a18200
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,19 @@ | |
| from pydantic import StringConstraints | ||
| from sqlalchemy import Connection, text | ||
|
|
||
| from config import load_configuration | ||
|
|
||
| # Enforces str is 32 hexadecimal characters, does not check validity. | ||
PGijsbers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| APIKey = Annotated[str, StringConstraints(pattern=r"^[0-9a-fA-F]{32}$")] | ||
| # If `allow_test_api_keys` is set, the key may also be one of `normaluser`, | ||
| # `normaluser2`, or `abc` (admin). | ||
| api_key_pattern = r"^[0-9a-fA-F]{32}$" | ||
| if load_configuration()["development"].get("allow_test_api_keys"): | ||
| api_key_pattern = r"^([0-9a-fA-F]{32}|normaluser|normaluser2|abc)$" | ||
|
Comment on lines
+13
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Line 13 mixes strict ( Proposed fix-api_key_pattern = r"^[0-9a-fA-F]{32}$"
-if load_configuration()["development"].get("allow_test_api_keys"):
- api_key_pattern = r"^([0-9a-fA-F]{32}|normaluser|normaluser2|abc)$"
+api_key_pattern = r"^[0-9a-fA-F]{32}$"
+_config = load_configuration()
+if _config.get("development", {}).get("allow_test_api_keys"):
+ api_key_pattern = r"^([0-9a-fA-F]{32}|normaluser|normaluser2|abc)$"#!/bin/bash
# Check if [development] section is always present in config files
fd "config.toml" --exec cat {}🤖 Prompt for AI Agents |
||
|
|
||
| APIKey = Annotated[ | ||
| str, | ||
| StringConstraints(pattern=api_key_pattern), | ||
| ] | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| class UserGroup(IntEnum): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,12 +4,14 @@ | |
|
|
||
| NO_USER = None | ||
| SOME_USER = User(user_id=2, _database=None, _groups=[UserGroup.READ_WRITE]) | ||
| OWNER_USER = User(user_id=16, _database=None, _groups=[UserGroup.READ_WRITE]) | ||
| ADMIN_USER = User(user_id=1, _database=None, _groups=[UserGroup.ADMIN, UserGroup.READ_WRITE]) | ||
| OWNER_USER = User(user_id=3229, _database=None, _groups=[UserGroup.READ_WRITE]) | ||
| DATASET_130_OWNER = User(user_id=16, _database=None, _groups=[UserGroup.READ_WRITE]) | ||
| ADMIN_USER = User(user_id=1159, _database=None, _groups=[UserGroup.ADMIN, UserGroup.READ_WRITE]) | ||
|
|
||
|
|
||
| class ApiKey(StrEnum): | ||
| ADMIN = "AD000000000000000000000000000000" | ||
| SOME_USER = "00000000000000000000000000000000" | ||
| OWNER_USER = "DA1A0000000000000000000000000000" | ||
| ADMIN = "abc" | ||
| SOME_USER = "normaluser2" | ||
| OWNER_USER = "normaluser" | ||
| DATASET_130_OWNER = "DA1A0000000000000000000000000000" | ||
|
Comment on lines
12
to
+16
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Non-hex API keys drive the production validation change — consider updating the test DB instead. The literal keys 🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, which is why I had constructed the previous test database keys that way. But the new keys were chosen by @josvandervelde and are now used in both openml-python and openml java. We need to coordinate changing the keys again, so I am not updating the image for this PR.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| INVALID = "11111111111111111111111111111111" | ||
Uh oh!
There was an error while loading. Please reload this page.