diff --git a/charmcraft/main.py b/charmcraft/main.py
index 716cc14..bf24e73 100644
--- a/charmcraft/main.py
+++ b/charmcraft/main.py
@@ -102,16 +102,20 @@ EXTRA_ENVIRONMENT = ("DESKTOP_SESSION", "XDG_CURRENT_DESKTOP")
 
 def _get_system_details():
     """Produce details about the system."""
-    # prepare the useful environment variables: all CHARMCRAFT* (except AUTH keys)
+    # prepare the useful environment variables: all CHARMCRAFT* (hiding AUTH keys)
     # and desktop/session
-    useful_env = {name for name in os.environ if name.startswith("CHARMCRAFT")}
-    useful_env.discard(ALTERNATE_AUTH_ENV_VAR)
-    useful_env.update(EXTRA_ENVIRONMENT)
-
-    os_platform = utils.get_os_platform()
-    env_string = ", ".join(f"{k}={v!r}" for k, v in sorted(os.environ.items()) if k in useful_env)
+    useful_env = {
+        name: value
+        for name, value in os.environ.items()
+        if name.startswith("CHARMCRAFT") or name in EXTRA_ENVIRONMENT
+    }
+    if ALTERNATE_AUTH_ENV_VAR in useful_env:
+        useful_env[ALTERNATE_AUTH_ENV_VAR] = "<hidden>"
+    env_string = ", ".join(f"{name}={value!r}" for name, value in sorted(useful_env.items()))
     if not env_string:
         env_string = "None"
+
+    os_platform = utils.get_os_platform()
     return f"System details: {os_platform}; Environment: {env_string}"
 
 

diff --git a/tests/test_main.py b/tests/test_main.py
index 5c5aa3c..48202da 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -334,8 +334,8 @@ def test_systemdetails_charmcraft_environment():
     )
 
 
-def test_systemdetails_no_auth():
-    """System details specifically excluding secrets."""
+def test_systemdetails_hidden_auth():
+    """System details specifically hiding secrets."""
     with patch("os.environ", {ALTERNATE_AUTH_ENV_VAR: "supersecret"}):
         with patch("charmcraft.utils.get_os_platform") as platform_mock:
             platform_mock.return_value = utils.OSPlatform(
@@ -344,7 +344,7 @@ def test_systemdetails_no_auth():
             result = _get_system_details()
     assert result == (
         "System details: OSPlatform(system='test-system', release='test-release', "
-        "machine='test-machine'); Environment: None"
+        f"machine='test-machine'); Environment: {ALTERNATE_AUTH_ENV_VAR}='<hidden>'"
     )
 
 

The presence of CHARMCRAFT_AUTH should be logged
Currently we're logging all CHARMCRAFT_* environment variables, but specifically excluding `CHARMCRAFT_AUTH` to not leak secrets.

However, it's very useful, for debugging purposes, know that `CHARMCRAFT_AUTH` is present or not, so we should log it with a different value, something like...

```
System details: (...); Environment: DESKTOP_SESSION='plasma', CHARMCRAFT_AUTH='<hidden>', ...
```
tests/test_main.py::test_systemdetails_hidden_auth
tests/test_main.py::test_main_ok tests/test_main.py::test_main_managed_instance_init tests/test_main.py::test_main_managed_instance_error[side_effect0] tests/test_main.py::test_main_managed_instance_error[side_effect1] tests/test_main.py::test_main_managed_instance_error[side_effect2] tests/test_main.py::test_main_managed_instance_error[side_effect3] tests/test_main.py::test_main_load_config_ok tests/test_main.py::test_main_load_config_not_present_ok tests/test_main.py::test_main_load_config_not_present_but_needed tests/test_main.py::test_main_no_args tests/test_main.py::test_main_controlled_error tests/test_main.py::test_main_controlled_return_code tests/test_main.py::test_main_crash tests/test_main.py::test_main_interrupted tests/test_main.py::test_main_controlled_arguments_error tests/test_main.py::test_main_providing_help tests/test_main.py::test_main_logs_system_details tests/test_main.py::test_systemdetails_basic tests/test_main.py::test_systemdetails_extra_environment tests/test_main.py::test_systemdetails_charmcraft_environment tests/test_main.py::test_commands[AnalyzeCommand] tests/test_main.py::test_commands[CleanCommand] tests/test_main.py::test_commands[PackCommand] tests/test_main.py::test_commands[InitCommand] tests/test_main.py::test_commands[VersionCommand] tests/test_main.py::test_commands[LoginCommand] tests/test_main.py::test_commands[LogoutCommand] tests/test_main.py::test_commands[WhoamiCommand] tests/test_main.py::test_commands[RegisterCharmNameCommand] tests/test_main.py::test_commands[RegisterBundleNameCommand] tests/test_main.py::test_commands[ListNamesCommand] tests/test_main.py::test_commands[UploadCommand] tests/test_main.py::test_commands[ListRevisionsCommand] tests/test_main.py::test_commands[ReleaseCommand] tests/test_main.py::test_commands[StatusCommand] tests/test_main.py::test_commands[CloseCommand] tests/test_main.py::test_commands[CreateLibCommand] tests/test_main.py::test_commands[PublishLibCommand] tests/test_main.py::test_commands[ListLibCommand] tests/test_main.py::test_commands[FetchLibCommand] tests/test_main.py::test_commands[ListResourcesCommand] tests/test_main.py::test_commands[UploadResourceCommand] tests/test_main.py::test_commands[ListResourceRevisionsCommand] tests/test_main.py::test_aesthetic_help_msg[AnalyzeCommand] tests/test_main.py::test_aesthetic_help_msg[CleanCommand] tests/test_main.py::test_aesthetic_help_msg[PackCommand] tests/test_main.py::test_aesthetic_help_msg[InitCommand] tests/test_main.py::test_aesthetic_help_msg[VersionCommand] tests/test_main.py::test_aesthetic_help_msg[LoginCommand] tests/test_main.py::test_aesthetic_help_msg[LogoutCommand] tests/test_main.py::test_aesthetic_help_msg[WhoamiCommand] tests/test_main.py::test_aesthetic_help_msg[RegisterCharmNameCommand] tests/test_main.py::test_aesthetic_help_msg[RegisterBundleNameCommand] tests/test_main.py::test_aesthetic_help_msg[ListNamesCommand] tests/test_main.py::test_aesthetic_help_msg[UploadCommand] tests/test_main.py::test_aesthetic_help_msg[ListRevisionsCommand] tests/test_main.py::test_aesthetic_help_msg[ReleaseCommand] tests/test_main.py::test_aesthetic_help_msg[StatusCommand] tests/test_main.py::test_aesthetic_help_msg[CloseCommand] tests/test_main.py::test_aesthetic_help_msg[CreateLibCommand] tests/test_main.py::test_aesthetic_help_msg[PublishLibCommand] tests/test_main.py::test_aesthetic_help_msg[ListLibCommand] tests/test_main.py::test_aesthetic_help_msg[FetchLibCommand] tests/test_main.py::test_aesthetic_help_msg[ListResourcesCommand] tests/test_main.py::test_aesthetic_help_msg[UploadResourceCommand] tests/test_main.py::test_aesthetic_help_msg[ListResourceRevisionsCommand] tests/test_main.py::test_aesthetic_args_options_msg[AnalyzeCommand] tests/test_main.py::test_aesthetic_args_options_msg[CleanCommand] tests/test_main.py::test_aesthetic_args_options_msg[PackCommand] tests/test_main.py::test_aesthetic_args_options_msg[InitCommand] tests/test_main.py::test_aesthetic_args_options_msg[VersionCommand] tests/test_main.py::test_aesthetic_args_options_msg[LoginCommand] tests/test_main.py::test_aesthetic_args_options_msg[LogoutCommand] tests/test_main.py::test_aesthetic_args_options_msg[WhoamiCommand] tests/test_main.py::test_aesthetic_args_options_msg[RegisterCharmNameCommand] tests/test_main.py::test_aesthetic_args_options_msg[RegisterBundleNameCommand] tests/test_main.py::test_aesthetic_args_options_msg[ListNamesCommand] tests/test_main.py::test_aesthetic_args_options_msg[UploadCommand] tests/test_main.py::test_aesthetic_args_options_msg[ListRevisionsCommand] tests/test_main.py::test_aesthetic_args_options_msg[ReleaseCommand] tests/test_main.py::test_aesthetic_args_options_msg[StatusCommand] tests/test_main.py::test_aesthetic_args_options_msg[CloseCommand] tests/test_main.py::test_aesthetic_args_options_msg[CreateLibCommand] tests/test_main.py::test_aesthetic_args_options_msg[PublishLibCommand] tests/test_main.py::test_aesthetic_args_options_msg[ListLibCommand] tests/test_main.py::test_aesthetic_args_options_msg[FetchLibCommand] tests/test_main.py::test_aesthetic_args_options_msg[ListResourcesCommand] tests/test_main.py::test_aesthetic_args_options_msg[UploadResourceCommand] tests/test_main.py::test_aesthetic_args_options_msg[ListResourceRevisionsCommand] tests/test_main.py::test_usage_of_parsed_args[AnalyzeCommand] tests/test_main.py::test_usage_of_parsed_args[CleanCommand] tests/test_main.py::test_usage_of_parsed_args[PackCommand] tests/test_main.py::test_usage_of_parsed_args[InitCommand] tests/test_main.py::test_usage_of_parsed_args[VersionCommand] tests/test_main.py::test_usage_of_parsed_args[LoginCommand] tests/test_main.py::test_usage_of_parsed_args[LogoutCommand] tests/test_main.py::test_usage_of_parsed_args[WhoamiCommand] tests/test_main.py::test_usage_of_parsed_args[RegisterCharmNameCommand] tests/test_main.py::test_usage_of_parsed_args[RegisterBundleNameCommand] tests/test_main.py::test_usage_of_parsed_args[ListNamesCommand] tests/test_main.py::test_usage_of_parsed_args[UploadCommand] tests/test_main.py::test_usage_of_parsed_args[ListRevisionsCommand] tests/test_main.py::test_usage_of_parsed_args[ReleaseCommand] tests/test_main.py::test_usage_of_parsed_args[StatusCommand] tests/test_main.py::test_usage_of_parsed_args[CloseCommand] tests/test_main.py::test_usage_of_parsed_args[CreateLibCommand] tests/test_main.py::test_usage_of_parsed_args[PublishLibCommand] tests/test_main.py::test_usage_of_parsed_args[ListLibCommand] tests/test_main.py::test_usage_of_parsed_args[FetchLibCommand] tests/test_main.py::test_usage_of_parsed_args[ListResourcesCommand] tests/test_main.py::test_usage_of_parsed_args[UploadResourceCommand] tests/test_main.py::test_usage_of_parsed_args[ListResourceRevisionsCommand] tests/test_main.py::test_basecommand_needs_config_default tests/test_main.py::test_basecommand_include_format_option tests/test_main.py::test_basecommand_format_content_json tests/test_main.py::test_basecommand_format_content_unkown