Skip to content

Ignore whitespace-only auth environment tokens#325

Open
OnlyYu1996 wants to merge 1 commit into
CortexLM:mainfrom
OnlyYu1996:fix-whoami-blank-env-auth
Open

Ignore whitespace-only auth environment tokens#325
OnlyYu1996 wants to merge 1 commit into
CortexLM:mainfrom
OnlyYu1996:fix-whoami-blank-env-auth

Conversation

@OnlyYu1996
Copy link
Copy Markdown

Fixes PlatformNetwork/bounty-challenge#47006.

Summary

  • Add a shared has_non_blank_token() helper in cortex-login.
  • Treat empty and whitespace-only auth environment values as absent in whoami, login status, and the engine auth paths.
  • Preserve existing token strings when they contain any non-whitespace character.

Validation

  • cargo +1.90.0 fmt --package cortex-login --package cortex-engine --package cortex-cli --check
  • git diff --check
  • Isolated rustc +1.90.0 --edition=2024 --test harness covering empty, whitespace-only, and non-blank tokens

Note: targeted cargo test -p cortex-login test_has_non_blank_token -- --nocapture is still blocked before running tests on this Windows/MSVC environment by the existing aws-lc-sys C build failure.

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 whoami accepts a whitespace-only CORTEX_AUTH_TOKEN as authenticated

1 participant