@@ -552,6 +552,23 @@ def _load_secrets_from_env_file(env_file_path: str) -> Dict[str, str]:
552552 return secrets
553553
554554
555+ def _mask_secret_value (value : str ) -> str :
556+ """
557+ Return a masked representation of a secret showing only a small prefix/suffix.
558+ Example: fw_3Z*******Xgnk
559+ """
560+ try :
561+ if not isinstance (value , str ) or not value :
562+ return "<empty>"
563+ prefix_len = 6
564+ suffix_len = 4
565+ if len (value ) <= prefix_len + suffix_len :
566+ return value [0 ] + "***" + value [- 1 ]
567+ return f"{ value [:prefix_len ]} ***{ value [- suffix_len :]} "
568+ except Exception :
569+ return "<masked>"
570+
571+
555572def upload_command (args : argparse .Namespace ) -> int :
556573 root = os .path .abspath (getattr (args , "path" , "." ))
557574 entries_arg = getattr (args , "entry" , None )
@@ -622,7 +639,11 @@ def upload_command(args: argparse.Namespace) -> int:
622639 print (f"Loading secrets from: { env_file_path } " )
623640
624641 for secret_name , secret_value in secrets_from_file .items ():
625- print (f"Ensuring { secret_name } is registered as a secret on Fireworks for rollout..." )
642+ source = ".env" if secret_name in secrets_from_env_file else "environment"
643+ print (
644+ f"Ensuring { secret_name } is registered as a secret on Fireworks for rollout... "
645+ f"({ source } : { _mask_secret_value (secret_value )} )"
646+ )
626647 if create_or_update_fireworks_secret (
627648 account_id = fw_account_id ,
628649 key_name = secret_name ,
0 commit comments