Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect CORS-related env vars parsing #886

Closed
MOZGIII opened this issue May 26, 2018 · 1 comment
Closed

Incorrect CORS-related env vars parsing #886

MOZGIII opened this issue May 26, 2018 · 1 comment
Assignees
Labels
bug Something is not working.
Milestone

Comments

@MOZGIII
Copy link
Contributor

MOZGIII commented May 26, 2018

Consider this code:

AllowedOrigins: strings.Split(viper.GetString("CORS_ALLOWED_ORIGINS"), ","),
AllowedMethods: strings.Split(viper.GetString("CORS_ALLOWED_METHODS"), ","),
AllowedHeaders: strings.Split(viper.GetString("CORS_ALLOWED_HEADERS"), ","),
ExposedHeaders: strings.Split(viper.GetString("CORS_EXPOSED_HEADERS"), ","),

When a missing or empty CORS_EXPOSED_HEADERS is being parsed, the result contains an array with a single element - empty string, instead of it being an empty array.
Same applies to the rest. This breaks how CORS are handled.

@aeneasr aeneasr added the bug Something is not working. label May 28, 2018
@aeneasr
Copy link
Member

aeneasr commented May 28, 2018

Thank you for reporting this, it's a bug indeed (caused by strings.split always returning at least one element, an empty string)

@aeneasr aeneasr added this to the 1.0.0-alpha.1 milestone May 28, 2018
@aeneasr aeneasr self-assigned this May 28, 2018
aeneasr pushed a commit that referenced this issue May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

2 participants