Skip to content

Mask login tokens with UTF-8 safe slicing#387

Open
GreyforgeLabs wants to merge 1 commit into
CortexLM:mainfrom
GreyforgeLabs:fix-login-token-utf8-mask
Open

Mask login tokens with UTF-8 safe slicing#387
GreyforgeLabs wants to merge 1 commit into
CortexLM:mainfrom
GreyforgeLabs:fix-login-token-utf8-mask

Conversation

@GreyforgeLabs
Copy link
Copy Markdown

Summary

  • Update login token masking to count and slice by Unicode scalar values instead of byte offsets.
  • Preserve existing ASCII masking behavior for long and short API keys.
  • Add regressions for the non-ASCII boundary case from the report and a longer non-ASCII token.

Fixes PlatformNetwork/bounty-challenge#51202.

Validation

  • cargo test -p cortex-login safe_format_key -- --nocapture
  • cargo check -p cortex-login
  • cargo fmt --package cortex-login --check
  • git diff --check

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [v0.0.7] cortex login status panics on non-ASCII CORTEX_AUTH_TOKEN — byte-slice at char boundary in cortex-login/utils.rs:11

1 participant