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

fixes chaostoolkit/chaostoolkit#178 #208

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions chaoslib/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,30 @@ def _run(self, strategy: Strategy, schedule: Schedule, # noqa: C901
finally:
event_registry.finish(journal)

# Parse journal and hide secrets
# Secrets can be on top level secrets block
if "secrets" in journal:
hide_secrets(journal['secrets'])

# Or can be in experiment
if "secrets" in journal['experiment']:
hide_secrets(journal['experiment']['secrets'])

return journal


def hide_secrets(secrets: dict) -> dict:
for secret in secrets:
for sname in secrets[secret]:
# If secret is a env var of vault, no need to hide it
if type(secrets[secret][sname]) is dict:
if secrets[secret][sname].get('type') not in ('env', 'vault'):
for secretsubname in secrets[secret][sname]:
secrets[secret][sname][secretsubname] = '*****'
else:
secrets[secret][sname] = '*****'


def should_run_before_method(strategy: Strategy) -> bool:
return strategy in [
Strategy.BEFORE_METHOD, Strategy.DEFAULT, Strategy.CONTINOUS]
Expand Down