Skip to content
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

fix: Mask sensitive fields when reading container registry via the manager GQL API #1627

Merged
merged 6 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/1627.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mask sensitive fields when reading the container registry information via the manager GraphQL API
2 changes: 2 additions & 0 deletions src/ai/backend/manager/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# The default container role name for multi-container sessions
DEFAULT_ROLE: Final = "main"

PASSWORD_PLACEHOLDER: Final = "*****"

_RESERVED_VFOLDER_PATTERNS = [r"^\.[a-z0-9]+rc$", r"^\.[a-z0-9]+_profile$"]
RESERVED_DOTFILES = [".terminfo", ".jupyter", ".ssh", ".ssh/authorized_keys", ".local", ".config"]
RESERVED_VFOLDERS = [
Expand Down
4 changes: 3 additions & 1 deletion src/ai/backend/manager/models/etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from ai.backend.common.logging import BraceStyleAdapter

from ..defs import PASSWORD_PLACEHOLDER
from . import UserRole
from .base import privileged_mutation, set_if_set

Expand Down Expand Up @@ -67,6 +68,7 @@ class Meta:

@classmethod
def from_row(cls, hostname: str, config: Mapping[str, str | list | None]) -> ContainerRegistry:
password = config.get("password", None)
return cls(
id=hostname,
hostname=hostname,
Expand All @@ -75,7 +77,7 @@ def from_row(cls, hostname: str, config: Mapping[str, str | list | None]) -> Con
type=config.get("type"),
project=config.get("project", None),
username=config.get("username", None),
password=config.get("password", None),
password=PASSWORD_PLACEHOLDER if password is not None else None,
ssl_verify=config.get("ssl_verify", None),
),
)
Expand Down
Loading