Skip to content

Commit c7d1006

Browse files
committed
fix(oauth): bounds-check token slice and redact value from logs
1 parent 488e121 commit c7d1006

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/oauth.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl OauthBackend for MobileSpoofAuth {
284284
.as_u64()
285285
.ok_or_else(|| AuthError::Field((json.clone(), "expires_in: as_u64")))?;
286286

287-
info!("[✅] Success - Retrieved token \"{}...\", expires in {}", &token[..32], expires_in);
287+
info!("[✅] Success - Retrieved token (len={}), expires in {}", token.len(), expires_in);
288288

289289
Ok(OauthResponse {
290290
token,
@@ -399,11 +399,7 @@ impl OauthBackend for GenericWebAuth {
399399
.as_u64()
400400
.ok_or_else(|| AuthError::Field((json.clone(), "expires_in: as_u64")))?;
401401

402-
info!(
403-
"[✅] GenericWebAuth success - Retrieved token \"{}...\", expires in {}",
404-
&token[..32.min(token.len())],
405-
expires_in
406-
);
402+
info!("[✅] GenericWebAuth success - Retrieved token (len={}), expires in {}", token.len(), expires_in);
407403

408404
// Insert a few necessary headers
409405
self.additional_headers.insert("Origin".to_owned(), "https://www.reddit.com".to_owned());

0 commit comments

Comments
 (0)