ikiwiki: Mark secret strings in privileged actions

Tests:

- Run affected privileged actions through UI and notice that secret strings are
not logged.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-08-04 11:05:30 -07:00 committed by James Valleroy
parent 5c0b15d8f8
commit 382b931cd4
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -7,7 +7,7 @@ import re
import shutil
import subprocess
from plinth.actions import privileged
from plinth.actions import privileged, secret_str
SETUP_WIKI = '/etc/ikiwiki/plinth-wiki.setup'
SETUP_BLOG = '/etc/ikiwiki/plinth-blog.setup'
@ -57,7 +57,7 @@ def get_sites() -> list[tuple[str, str]]:
@privileged
def create_wiki(wiki_name: str, admin_name: str, admin_password: str):
def create_wiki(wiki_name: str, admin_name: str, admin_password: secret_str):
"""Create a wiki."""
pw_bytes = admin_password.encode()
input_ = pw_bytes + b'\n' + pw_bytes
@ -68,7 +68,7 @@ def create_wiki(wiki_name: str, admin_name: str, admin_password: str):
@privileged
def create_blog(blog_name: str, admin_name: str, admin_password: str):
def create_blog(blog_name: str, admin_name: str, admin_password: secret_str):
"""Create a blog."""
pw_bytes = admin_password.encode()
input_ = pw_bytes + b'\n' + pw_bytes