Skip to content

Commit 665cb1e

Browse files
authored
fix: lower info-level logs to debug-level (#436)
Libraries should avoid issuing info-level logs. We should stick to debug and trace levels. cc @TheBestTvarynka
1 parent 45a0e18 commit 665cb1e

File tree

5 files changed

+20
-22
lines changed

5 files changed

+20
-22
lines changed

crates/dpapi-web/src/transport.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl Transport for WasmTransport {
122122
get_session_token,
123123
} => {
124124
let session_id = Uuid::new_v4();
125-
info!("session token");
125+
debug!("session token");
126126
let session_token = get_session_token(session_id, destination.clone()).await?;
127127

128128
Self::ws_connect(proxy.clone(), session_id, session_token.as_ref()).await

crates/dpapi/src/client.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ async fn get_key<T: Transport>(
210210
) -> Result<GroupKeyEnvelope> {
211211
let mut connection_options = ConnectOptions::new(server, proxy)?;
212212

213-
// let isd_key_port = {
214213
let mut rpc = RpcClient::<T>::connect(
215214
&connection_options,
216215
AuthProvider::new(
@@ -225,23 +224,22 @@ async fn get_key<T: Transport>(
225224
)
226225
.await?;
227226

228-
info!("RPC connection has been established.");
227+
debug!("RPC connection has been established");
229228

230229
let epm_contexts = get_epm_contexts();
231230
let context_id = epm_contexts[0].context_id;
232231
let bind_ack = rpc.bind(&epm_contexts).await?;
233232

234-
info!("RPC bind/bind_ack finished successfully.");
233+
debug!("RPC bind/bind_ack finished successfully");
235234

236235
process_bind_result(&epm_contexts, bind_ack, context_id)?;
237236

238237
let ept_map = get_ept_map_isd_key();
239238
let response = rpc.request(0, EptMap::OPNUM, ept_map.encode_vec()?).await?;
240239

241240
let isd_key_port = process_ept_map_result(&response.try_into_response()?)?;
242-
// };
243241

244-
info!(isd_key_port);
242+
debug!(isd_key_port);
245243

246244
connection_options.set_destination_port(isd_key_port);
247245

@@ -256,13 +254,13 @@ async fn get_key<T: Transport>(
256254
)
257255
.await?;
258256

259-
info!("RPC connection has been established.");
257+
debug!("RPC connection has been established");
260258

261259
let isd_key_contexts = get_isd_key_key_contexts();
262260
let context_id = isd_key_contexts[0].context_id;
263261
let bind_ack = rpc.bind_authenticate(&isd_key_contexts).await?;
264262

265-
info!("RPC bind/bind_ack finished successfully.");
263+
debug!("RPC bind/bind_ack finished successfully");
266264

267265
process_bind_result(&isd_key_contexts, bind_ack, context_id)?;
268266

@@ -284,7 +282,7 @@ async fn get_key<T: Transport>(
284282
.await?;
285283
let security_trailer = response_pdu.security_trailer.clone();
286284

287-
info!("RPC GetKey Request finished successfully!");
285+
debug!("RPC GetKey Request finished successfully");
288286

289287
process_get_key_result(&response_pdu.try_into_response()?, security_trailer)
290288
}
@@ -379,7 +377,7 @@ pub async fn n_crypt_unprotect_secret<T: Transport>(
379377
}))
380378
.await?;
381379

382-
info!("Successfully requested root key.");
380+
debug!("Successfully requested root key");
383381

384382
Ok(decrypt_blob(&dpapi_blob, &root_key)?.into())
385383
}
@@ -455,7 +453,7 @@ pub async fn n_crypt_protect_secret<T: Transport>(
455453
}))
456454
.await?;
457455

458-
info!("Successfully requested root key.");
456+
debug!("Successfully requested root key");
459457

460458
encrypt_blob(data.as_ref(), &root_key, descriptor)
461459
}

src/credssp/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl CredSspClient {
309309
ts_request.nego_tokens = Some(output_token.remove(0).buffer);
310310

311311
if result.status == SecurityStatus::Ok {
312-
info!("CredSSp finished NLA stage.");
312+
debug!("CredSSP finished NLA stage");
313313

314314
let peer_version =
315315
self.context.as_ref().unwrap().peer_version.expect(
@@ -368,7 +368,7 @@ impl CredSspClient {
368368
.unwrap()
369369
.encrypt_ts_credentials(self.credentials_handle.as_ref().unwrap(), self.cred_ssp_mode)?,
370370
);
371-
info!("tscredentials has been written");
371+
debug!("tscredentials has been written");
372372

373373
self.state = CredSspState::Final;
374374

src/kerberos/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -716,12 +716,12 @@ impl<'a> Kerberos {
716716

717717
let as_rep = self.as_exchange(yield_point, &kdc_req_body, pa_data_options).await?;
718718

719-
info!("AS exchange finished successfully.");
719+
debug!("AS exchange finished successfully.");
720720

721721
self.realm = Some(as_rep.0.crealm.0.to_string());
722722

723723
let (encryption_type, salt) = extract_encryption_params_from_as_rep(&as_rep)?;
724-
info!(?encryption_type, "Negotiated encryption type");
724+
debug!(?encryption_type, "Negotiated encryption type");
725725

726726
self.encryption_params.encryption_type = Some(CipherSuite::try_from(usize::from(encryption_type))?);
727727

@@ -940,7 +940,7 @@ impl<'a> Kerberos {
940940

941941
let as_rep = self.as_exchange(yield_point, &kdc_req_body, pa_data_options).await?;
942942

943-
info!("AS exchange finished successfully.");
943+
debug!("AS exchange finished successfully.");
944944

945945
self.realm = Some(as_rep.0.crealm.0.to_string());
946946

@@ -997,7 +997,7 @@ impl<'a> Kerberos {
997997
let tgs_rep: KrbResult<TgsRep> = KrbResult::deserialize(&mut d)?;
998998
let tgs_rep = tgs_rep?;
999999

1000-
info!("TGS exchange finished successfully");
1000+
debug!("TGS exchange finished successfully");
10011001

10021002
let session_key_2 =
10031003
extract_session_key_from_tgs_rep(&tgs_rep, &session_key_1, &self.encryption_params)?;
@@ -1030,7 +1030,7 @@ impl<'a> Kerberos {
10301030
warn!("Kerberos ApReq Authenticator checksum GSS_C_DELEG_FLAG is not supported. Turning it off...");
10311031
flags.remove(GssFlags::GSS_C_DELEG_FLAG);
10321032
}
1033-
info!(?flags, "ApReq Authenticator checksum flags");
1033+
debug!(?flags, "ApReq Authenticator checksum flags");
10341034

10351035
let mut checksum_value = ChecksumValues::default();
10361036
checksum_value.set_flags(flags);
@@ -1056,7 +1056,7 @@ impl<'a> Kerberos {
10561056

10571057
let authenticator = generate_authenticator(authenticator_options)?;
10581058
let encoded_auth = picky_asn1_der::to_vec(&authenticator)?;
1059-
info!(encoded_ap_req_authenticator = ?encoded_auth);
1059+
debug!(encoded_ap_req_authenticator = ?encoded_auth);
10601060

10611061
let mut context_requirements = builder.context_requirements;
10621062

src/negotiate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ impl Negotiate {
137137
if is_azure_ad_domain(domain) {
138138
use super::pku2u::Pku2uConfig;
139139

140-
info!("Negotiate: try Pku2u");
140+
debug!("Negotiate: try Pku2u");
141141

142142
self.protocol = NegotiatedProtocol::Pku2u(Pku2u::new_client_from_config(
143143
Pku2uConfig::default_client_config(self.client_computer_name.clone())?,
144144
)?);
145145
}
146146

147147
if let Some(host) = detect_kdc_url(&get_client_principal_realm(username, domain)) {
148-
info!("Negotiate: try Kerberos");
148+
debug!("Negotiate: try Kerberos");
149149

150150
self.protocol =
151151
NegotiatedProtocol::Kerberos(Kerberos::new_client_from_config(crate::KerberosConfig {
@@ -558,7 +558,7 @@ impl<'a> Negotiate {
558558
let username = crate::utils::bytes_to_utf16_string(&identity.username);
559559
let host = detect_kdc_url(&get_client_principal_realm(&username, ""))
560560
.ok_or_else(|| Error::new(ErrorKind::NoAuthenticatingAuthority, "can not detect KDC url"))?;
561-
info!("Negotiate: try Kerberos");
561+
debug!("Negotiate: try Kerberos");
562562

563563
let config = crate::KerberosConfig {
564564
kdc_url: Some(host),

0 commit comments

Comments
 (0)