File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -693,7 +693,7 @@ fn dns_cred_to_proto(cred: DnsCredential) -> DnsCredentialInfo {
693693 let ( provider_type, cf_api_token, cf_api_url) = match & cred. provider {
694694 DnsProvider :: Cloudflare { api_token, api_url } => (
695695 "cloudflare" . to_string ( ) ,
696- api_token . clone ( ) ,
696+ redact_token ( api_token ) ,
697697 api_url. clone ( ) . unwrap_or_default ( ) ,
698698 ) ,
699699 } ;
@@ -710,6 +710,15 @@ fn dns_cred_to_proto(cred: DnsCredential) -> DnsCredentialInfo {
710710 }
711711}
712712
713+ fn redact_token ( token : & str ) -> String {
714+ let len = token. len ( ) ;
715+ if len <= 8 {
716+ "*" . repeat ( len)
717+ } else {
718+ format ! ( "{}...{}" , & token[ ..4 ] , & token[ len - 4 ..] )
719+ }
720+ }
721+
713722/// Convert proto ZtDomainConfig to internal ZtDomainConfig
714723fn proto_to_zt_domain_config (
715724 proto : & ProtoZtDomainConfig ,
You can’t perform that action at this time.
0 commit comments