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 slicing on secrets output #192

Merged
merged 3 commits into from
Feb 26, 2024
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 WHATSNEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
### Fixed

- Better handling of EMS license expiry evaluation
- Fix slicing on secrets output
- Better syntax for lists in documentation (developer/architecture/1_introduction_goals.html)
3 changes: 2 additions & 1 deletion fotoobo/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

Caution: Use docstrings with care as they are used to print help texts on any command.
"""

# pylint: disable=anomalous-backslash-in-string
import logging
import os
Expand Down Expand Up @@ -103,7 +104,7 @@ def callback( # pylint: disable=too-many-arguments
if attr in ["audit_logging", "logging", "vault"] and getattr(config, attr):
for sub_attr, value in getattr(config, attr).items():
if attr == "vault" and sub_attr in ["role_id", "secret_id"]:
value = f"{value[:4]}...{value[-5:-1]}"
value = f"{value[:4]}...{value[-4:]}"

log.debug("Option '%s.%s' is '%s'", attr, sub_attr, value)

Expand Down
6 changes: 3 additions & 3 deletions fotoobo/helpers/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def __init__( # pylint: disable=too-many-arguments
log.debug("vault_client_ssl_verify: '%s'", self.ssl_verify)
log.debug("vault_client_namespace: '%s'", self.namespace)
log.debug("vault_client_data_path: '%s'", self.data_path)
log.debug("vault_client_role_id: '%s...%s'", self.role_id[:4], self.role_id[-5:-1])
log.debug("vault_client_secret_id: '%s...%s'", self.secret_id[:4], self.secret_id[-5:-1])
log.debug("vault_client_role_id: '%s...%s'", self.role_id[:4], self.role_id[-4:])
log.debug("vault_client_secret_id: '%s...%s'", self.secret_id[:4], self.secret_id[-4:])
log.debug("vault_client_token_ttl_limit: '%s'", self.token_ttl_limit)

if token_file:
Expand Down Expand Up @@ -200,7 +200,7 @@ def validate_token(self, timeout: int = 3) -> bool:

if response.ok:
log.debug("Vault token is valid for '%s' seconds", response.json()["data"]["ttl"])
log.debug("vault_client_token: '%s...%s'", self.token[:8], self.token[-5:-1])
log.debug("vault_client_token: '%s...%s'", self.token[:8], self.token[-4:])
if response.json()["data"]["ttl"] < self.token_ttl_limit:
log.debug("Invalidate token due to ttl limit")
self.token = ""
Expand Down