Skip to content

Conversation

@matt-lethargic
Copy link
Contributor

This pull request introduces stricter validation for the oauth flag across multiple environment classes and improves type safety in the ConfigurationBase class as highlighted in #2525 . The main changes ensure that only the value "basic" is accepted for the oauth flag, with an appropriate error thrown for invalid values.

Stricter validation for oauth flag:

Improved type safety:

  • src/common/ConfigurationBase.ts: Updated the getOAuthLevel method to explicitly check that this.oauth is a string before processing it, improving type safety.

public oauth(): string | undefined {
return this.flags.oauth;
if (this.flags.oauth !== undefined) {
if (this.flags.oauth !== "basic") {
Copy link
Member

@blueww blueww May 22, 2025

Choose a reason for hiding this comment

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

Please don't hard code "basic".
The basic here means Azurite only do basic validation of the Bearer token. It give the scalability for adding more validation to the bearer token with more value for "--Oauth" in the future.
So please add an enum for the value support by Oauth, and report error when the value not in the enum.
It's better to have the validation code in a single function, instead of several copy of it.


public oauth(): string | undefined {
return this.flags.oauth;
if (this.flags.oauth !== undefined) {
Copy link
Member

Choose a reason for hiding this comment

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

Please add changelog, and better with test cases.

@blueww blueww self-assigned this May 22, 2025
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.

2 participants