mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
appsv2: we don't want to store user-provided passwords by default, but they should still be set in the env for the script to use it
This commit is contained in:
parent
bf070f1763
commit
9bd4344f25
1 changed files with 12 additions and 0 deletions
12
src/app.py
12
src/app.py
|
@ -1050,6 +1050,7 @@ def app_install(
|
|||
if packaging_format >= 2:
|
||||
for question in questions:
|
||||
# Except user-provider passwords
|
||||
# ... which we need to reinject later in the env_dict
|
||||
if question.type == "password":
|
||||
continue
|
||||
|
||||
|
@ -1101,11 +1102,22 @@ def app_install(
|
|||
app_instance_name, args=args, workdir=extracted_app_folder, action="install"
|
||||
)
|
||||
|
||||
# If packaging_format v2+, save all install questions as settings
|
||||
if packaging_format >= 2:
|
||||
for question in questions:
|
||||
# Reinject user-provider passwords which are not in the app settings
|
||||
# (cf a few line before)
|
||||
if question.type == "password":
|
||||
env_dict[question.name] = question.value
|
||||
|
||||
# We want to hav the env_dict in the log ... but not password values
|
||||
env_dict_for_logging = env_dict.copy()
|
||||
for question in questions:
|
||||
# Or should it be more generally question.redact ?
|
||||
if question.type == "password":
|
||||
del env_dict_for_logging[f"YNH_APP_ARG_{question.name.upper()}"]
|
||||
if question.name in env_dict_for_logging:
|
||||
del env_dict_for_logging[question.name]
|
||||
|
||||
operation_logger.extra.update({"env": env_dict_for_logging})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue