Skip to content

Commit 68d02e4

Browse files
authored
fix: do not log at info-level return values (#438)
1 parent 4e866eb commit 68d02e4

File tree

9 files changed

+41
-41
lines changed

9 files changed

+41
-41
lines changed

crates/dpapi/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn process_get_key_result(response: &Response, security_trailer: Option<Security
132132
unpack_response(data)
133133
}
134134

135-
#[instrument(ret)]
135+
#[instrument(ret, level = "debug")]
136136
fn decrypt_blob(blob: &DpapiBlob, key: &GroupKeyEnvelope) -> Result<Vec<u8>> {
137137
let kek = get_kek(key, &blob.key_identifier)?;
138138

@@ -147,7 +147,7 @@ fn decrypt_blob(blob: &DpapiBlob, key: &GroupKeyEnvelope) -> Result<Vec<u8>> {
147147
)?)
148148
}
149149

150-
#[instrument(ret)]
150+
#[instrument(ret, level = "debug")]
151151
fn encrypt_blob(
152152
data: &[u8],
153153
key: &GroupKeyEnvelope,

crates/dpapi/src/rpc/auth.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<'a> AuthProvider<'a> {
135135
/// * `security_trailer_data`: RPC PDU security trailer `auth_value`. Basically, it's a Kerberos Wrap Token.
136136
///
137137
/// All encryption is performed in-place.
138-
#[instrument(ret, skip(self))]
138+
#[instrument(ret, level = "debug", skip(self))]
139139
pub fn wrap_with_header_sign(
140140
&mut self,
141141
header: &mut [u8],
@@ -189,7 +189,7 @@ impl<'a> AuthProvider<'a> {
189189
/// * `security_trailer_data`: `auth_value` of the RPC PDU security trailer. Basically, it's a Kerberos Wrap Token.
190190
///
191191
/// All decryption is performed in-place.
192-
#[instrument(ret, skip(self))]
192+
#[instrument(ret, level = "debug", skip(self))]
193193
pub fn unwrap_with_header_sign(
194194
&mut self,
195195
header: &mut [u8],
@@ -219,7 +219,7 @@ impl<'a> AuthProvider<'a> {
219219
/// * `security_trailer_data`: `auth_value` of the RPC PDU security trailer. Basically, it's a Kerberos Wrap Token.
220220
///
221221
/// All decryption is performed in-place.
222-
#[instrument(ret, skip(self))]
222+
#[instrument(ret, level = "debug", skip(self))]
223223
pub fn unwrap(&mut self, body: &mut [u8], security_trailer_data: &mut [u8]) -> AuthResult<Vec<u8>> {
224224
let mut message = vec![
225225
SecurityBufferRef::data_buf(body),
@@ -234,7 +234,7 @@ impl<'a> AuthProvider<'a> {
234234
/// Performs one step in authorization process.
235235
///
236236
/// The client should call this method until `self.is_finished()` is `true`.
237-
#[instrument(ret, fields(state = ?self.is_finished), skip(self))]
237+
#[instrument(ret, level = "debug", fields(state = ?self.is_finished), skip(self))]
238238
pub async fn initialize_security_context(&mut self, in_token: Vec<u8>) -> AuthResult<SecurityTrailer> {
239239
let mut input_token = [SecurityBuffer::new(in_token, BufferType::Token)];
240240
let mut output_token = vec![SecurityBuffer::new(Vec::with_capacity(1024), BufferType::Token)];

src/credssp/mod.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ impl SspiImpl for SspiContext {
634634
type CredentialsHandle = Option<CredentialsBuffers>;
635635
type AuthenticationData = Credentials;
636636

637-
#[instrument(ret, fields(security_package = self.package_name()), skip_all)]
637+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip_all)]
638638
fn acquire_credentials_handle_impl(
639639
&mut self,
640640
builder: FilledAcquireCredentialsHandle<'_, Self::CredentialsHandle, Self::AuthenticationData>,
@@ -681,7 +681,7 @@ impl SspiImpl for SspiContext {
681681
})
682682
}
683683

684-
#[instrument(ret, fields(security_package = self.package_name()), skip_all)]
684+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip_all)]
685685
fn accept_security_context_impl(
686686
&mut self,
687687
builder: FilledAcceptSecurityContext<'_, Self::CredentialsHandle>,
@@ -736,7 +736,7 @@ impl SspiImpl for SspiContext {
736736
}
737737

738738
impl<'a> SspiContext {
739-
#[instrument(ret, fields(security_package = self.package_name()), skip_all)]
739+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip_all)]
740740
async fn change_password_impl(
741741
&mut self,
742742
yield_point: &mut YieldPointLocal,
@@ -769,7 +769,7 @@ impl<'a> SspiContext {
769769
.resolve_with_default_network_client()
770770
}
771771

772-
#[instrument(ret, fields(security_package = self.package_name()), skip_all)]
772+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip_all)]
773773
async fn initialize_security_context_impl(
774774
&'a mut self,
775775
yield_point: &mut YieldPointLocal,
@@ -807,7 +807,7 @@ impl<'a> SspiContext {
807807
}
808808

809809
impl Sspi for SspiContext {
810-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
810+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
811811
fn complete_auth_token(&mut self, token: &mut [SecurityBuffer]) -> crate::Result<SecurityStatus> {
812812
match self {
813813
SspiContext::Ntlm(ntlm) => ntlm.complete_auth_token(token),
@@ -819,7 +819,7 @@ impl Sspi for SspiContext {
819819
}
820820
}
821821

822-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
822+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
823823
fn encrypt_message(
824824
&mut self,
825825
flags: EncryptionFlags,
@@ -836,7 +836,7 @@ impl Sspi for SspiContext {
836836
}
837837
}
838838

839-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
839+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
840840
fn decrypt_message(
841841
&mut self,
842842
message: &mut [SecurityBufferRef],
@@ -852,7 +852,7 @@ impl Sspi for SspiContext {
852852
}
853853
}
854854

855-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
855+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
856856
fn query_context_sizes(&mut self) -> crate::Result<ContextSizes> {
857857
match self {
858858
SspiContext::Ntlm(ntlm) => ntlm.query_context_sizes(),
@@ -864,7 +864,7 @@ impl Sspi for SspiContext {
864864
}
865865
}
866866

867-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
867+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
868868
fn query_context_names(&mut self) -> crate::Result<ContextNames> {
869869
match self {
870870
SspiContext::Ntlm(ntlm) => ntlm.query_context_names(),
@@ -876,7 +876,7 @@ impl Sspi for SspiContext {
876876
}
877877
}
878878

879-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
879+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
880880
fn query_context_stream_sizes(&mut self) -> crate::Result<StreamSizes> {
881881
match self {
882882
SspiContext::Ntlm(ntlm) => ntlm.query_context_stream_sizes(),
@@ -888,7 +888,7 @@ impl Sspi for SspiContext {
888888
}
889889
}
890890

891-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
891+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
892892
fn query_context_package_info(&mut self) -> crate::Result<PackageInfo> {
893893
match self {
894894
SspiContext::Ntlm(ntlm) => ntlm.query_context_package_info(),
@@ -900,7 +900,7 @@ impl Sspi for SspiContext {
900900
}
901901
}
902902

903-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
903+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
904904
fn query_context_cert_trust_status(&mut self) -> crate::Result<CertTrustStatus> {
905905
match self {
906906
SspiContext::Ntlm(ntlm) => ntlm.query_context_cert_trust_status(),
@@ -912,7 +912,7 @@ impl Sspi for SspiContext {
912912
}
913913
}
914914

915-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
915+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
916916
fn query_context_remote_cert(&mut self) -> crate::Result<CertContext> {
917917
match self {
918918
SspiContext::Ntlm(ntlm) => ntlm.query_context_remote_cert(),
@@ -924,7 +924,7 @@ impl Sspi for SspiContext {
924924
}
925925
}
926926

927-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
927+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
928928
fn query_context_negotiation_package(&mut self) -> crate::Result<PackageInfo> {
929929
match self {
930930
SspiContext::Ntlm(ntlm) => ntlm.query_context_negotiation_package(),
@@ -936,7 +936,7 @@ impl Sspi for SspiContext {
936936
}
937937
}
938938

939-
#[instrument(ret, fields(security_package = self.package_name()), skip(self))]
939+
#[instrument(ret, level = "debug", fields(security_package = self.package_name()), skip(self))]
940940
fn query_context_connection_info(&mut self) -> crate::Result<ConnectionInfo> {
941941
match self {
942942
SspiContext::Ntlm(ntlm) => ntlm.query_context_connection_info(),

src/credssp/sspi_cred_ssp/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ impl SspiImpl for SspiCredSsp {
365365
}
366366

367367
impl SspiCredSsp {
368-
#[instrument(ret, fields(state = ?self.state), skip_all)]
368+
#[instrument(ret, level = "debug", fields(state = ?self.state), skip_all)]
369369
#[async_recursion]
370370
pub(crate) async fn initialize_security_context_impl<'a>(
371371
&mut self,

src/credssp/ts_request/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl TsRequest {
251251
}
252252
}
253253

254-
#[instrument(ret)]
254+
#[instrument(ret, level = "debug")]
255255
fn write_smart_card_credentials(credentials: &SmartCardIdentityBuffers) -> crate::Result<Vec<u8>> {
256256
let smart_card_creds = TsSmartCardCreds {
257257
pin: ExplicitContextTag0::from(OctetStringAsn1::from(credentials.pin.as_ref().to_vec())),
@@ -300,7 +300,7 @@ pub fn write_ts_credentials(credentials: &CredentialsBuffers, cred_ssp_mode: Cre
300300
Ok(picky_asn1_der::to_vec(&ts_creds)?)
301301
}
302302

303-
#[instrument(ret)]
303+
#[instrument(ret, level = "debug")]
304304
fn write_password_credentials(credentials: &AuthIdentityBuffers, cred_ssp_mode: CredSspMode) -> io::Result<Vec<u8>> {
305305
let empty_identity = AuthIdentityBuffers::default();
306306
let identity = match cred_ssp_mode {

src/kdc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn detect_kdc_hosts_from_system(domain: &str) -> Vec<String> {
5353
Vec::new()
5454
}
5555

56-
#[instrument(ret)]
56+
#[instrument(ret, level = "debug")]
5757
pub fn detect_kdc_hosts(domain: &str) -> Vec<String> {
5858
if let Ok(kdc_url) = env::var(format!("SSPI_KDC_URL_{}", domain)) {
5959
return vec![kdc_url];

src/negotiate.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl Negotiate {
130130
// 3) if the provided username is FQDN and we can resolve KDC then it'll use Kerberos
131131
// 4) if SSPI_KDC_URL_ENV is set then it'll also use Kerberos
132132
// 5) in any other cases, it'll use NTLM
133-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip(self))]
133+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip(self))]
134134
fn negotiate_protocol(&mut self, username: &str, domain: &str) -> Result<()> {
135135
if let NegotiatedProtocol::Ntlm(_) = &self.protocol {
136136
#[cfg(target_os = "windows")]
@@ -266,7 +266,7 @@ impl Negotiate {
266266
}
267267

268268
impl SspiEx for Negotiate {
269-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
269+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
270270
fn custom_set_auth_identity(&mut self, identity: Self::AuthenticationData) -> Result<()> {
271271
self.auth_identity = Some(identity.clone().try_into().unwrap());
272272

@@ -293,7 +293,7 @@ impl SspiEx for Negotiate {
293293
}
294294

295295
impl Sspi for Negotiate {
296-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip(self))]
296+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip(self))]
297297
fn complete_auth_token(&mut self, token: &mut [SecurityBuffer]) -> Result<SecurityStatus> {
298298
match &mut self.protocol {
299299
NegotiatedProtocol::Pku2u(pku2u) => pku2u.complete_auth_token(token),
@@ -302,7 +302,7 @@ impl Sspi for Negotiate {
302302
}
303303
}
304304

305-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
305+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
306306
fn encrypt_message(
307307
&mut self,
308308
flags: crate::EncryptionFlags,
@@ -316,7 +316,7 @@ impl Sspi for Negotiate {
316316
}
317317
}
318318

319-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
319+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
320320
fn decrypt_message<'data>(
321321
&mut self,
322322
message: &mut [SecurityBufferRef<'data>],
@@ -329,7 +329,7 @@ impl Sspi for Negotiate {
329329
}
330330
}
331331

332-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
332+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
333333
fn query_context_sizes(&mut self) -> Result<ContextSizes> {
334334
match &mut self.protocol {
335335
NegotiatedProtocol::Pku2u(pku2u) => pku2u.query_context_sizes(),
@@ -338,7 +338,7 @@ impl Sspi for Negotiate {
338338
}
339339
}
340340

341-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
341+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
342342
fn query_context_names(&mut self) -> Result<ContextNames> {
343343
match &mut self.protocol {
344344
NegotiatedProtocol::Pku2u(pku2u) => pku2u.query_context_names(),
@@ -347,12 +347,12 @@ impl Sspi for Negotiate {
347347
}
348348
}
349349

350-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
350+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
351351
fn query_context_package_info(&mut self) -> Result<PackageInfo> {
352352
crate::query_security_package_info(SecurityPackageType::Negotiate)
353353
}
354354

355-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
355+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
356356
fn query_context_negotiation_package(&mut self) -> Result<PackageInfo> {
357357
match &mut self.protocol {
358358
NegotiatedProtocol::Pku2u(pku2u) => pku2u.query_context_package_info(),
@@ -361,7 +361,7 @@ impl Sspi for Negotiate {
361361
}
362362
}
363363

364-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
364+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
365365
fn query_context_cert_trust_status(&mut self) -> Result<CertTrustStatus> {
366366
match &mut self.protocol {
367367
NegotiatedProtocol::Pku2u(pku2u) => pku2u.query_context_cert_trust_status(),
@@ -414,7 +414,7 @@ impl SspiImpl for Negotiate {
414414
type CredentialsHandle = Option<CredentialsBuffers>;
415415
type AuthenticationData = Credentials;
416416

417-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
417+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
418418
fn acquire_credentials_handle_impl(
419419
&mut self,
420420
builder: builders::FilledAcquireCredentialsHandle<'_, Self::CredentialsHandle, Self::AuthenticationData>,
@@ -478,7 +478,7 @@ impl SspiImpl for Negotiate {
478478
})
479479
}
480480

481-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
481+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
482482
fn accept_security_context_impl(
483483
&mut self,
484484
builder: builders::FilledAcceptSecurityContext<'_, Self::CredentialsHandle>,
@@ -517,7 +517,7 @@ impl SspiImpl for Negotiate {
517517
}
518518

519519
impl<'a> Negotiate {
520-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
520+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
521521
pub(crate) async fn change_password(
522522
&'a mut self,
523523
yield_point: &mut YieldPointLocal,
@@ -534,7 +534,7 @@ impl<'a> Negotiate {
534534
}
535535
}
536536

537-
#[instrument(ret, fields(protocol = self.protocol.protocol_name()), skip_all)]
537+
#[instrument(ret, level = "debug", fields(protocol = self.protocol.protocol_name()), skip_all)]
538538
pub(crate) async fn initialize_security_context_impl(
539539
&'a mut self,
540540
yield_point: &mut YieldPointLocal,

src/ntlm/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl SspiImpl for Ntlm {
286286
})
287287
}
288288

289-
#[instrument(ret, fields(state = ?self.state), skip_all)]
289+
#[instrument(ret, level = "debug", fields(state = ?self.state), skip_all)]
290290
fn initialize_security_context_impl(
291291
&mut self,
292292
builder: &mut FilledInitializeSecurityContext<'_, Self::CredentialsHandle>,

src/pku2u/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ impl SspiImpl for Pku2u {
414414
}
415415

416416
impl Pku2u {
417-
#[instrument(ret, fields(state = ?self.state), skip_all)]
417+
#[instrument(ret, level = "debug", fields(state = ?self.state), skip_all)]
418418
pub(crate) fn initialize_security_context_impl(
419419
&mut self,
420420
builder: &mut crate::builders::FilledInitializeSecurityContext<'_, <Self as SspiImpl>::CredentialsHandle>,

0 commit comments

Comments
 (0)