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

fix: allow configuration of AllowWildcard #880

Closed
wants to merge 2 commits into from

Conversation

YassineElbouchaibi
Copy link
Contributor

This MR fixes #879

Motivation and Context

Wildcard added to cors.allow_origins won't work without this MR as AllowWildcard is always false.

Let me know if my PR is missing stuff!

@YassineElbouchaibi YassineElbouchaibi changed the title #879: Allow configuration of AllowWildcard fix: Allow configuration of AllowWildcard Jun 21, 2024
@@ -519,6 +519,11 @@
"default": true,
"description": "The allowed credentials. The default value is to allow credentials. This allows the browser to send cookies and authentication headers."
},
"allow_wildcard": {
Copy link
Contributor

Choose a reason for hiding this comment

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

@YassineElbouchaibi You also need to pass it to core.WithTLSConfig in instance.go otherwise the setting is not applied. How did you test it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes sorry missed that... I have added it to core.WithCors now. I did not test unfortunately as I have made these changes directly in the web and I don't have a working local setup. I was hoping the pipeline tests would pickup anything wrong. Let me know if you think something else is missing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have approved the run. After the build, you can test the image with

docker pull ghcr.io/wundergraph/cosmo/router:pr-880

Would that work for you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I definitely can test that, thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, you can add an integration test to https://github.com/wundergraph/cosmo/tree/main/router-tests but since we did not have any tests for CORS, I can help you with that (if needed). Let me know what you think.

Copy link
Contributor

@StarpTech StarpTech Jun 21, 2024

Choose a reason for hiding this comment

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

My bad. Images from external contributors aren't pushed due to insufficient permissions. You can build the image locally with cd router && docker build -t router:latest .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the delay, my local setup was not able to build the image locally because of the following:

image

so I had to go through various hoops to get it working..

But I can now confirm wild card origins work and stop working when the setting is changed to false.

Regarding integration tests, It will be hard for me to find time for it.. I'm not very familiar with golang let alone testing in golang.. but if you give me enough time I can look into it.

@StarpTech StarpTech changed the title fix: Allow configuration of AllowWildcard fix: allow configuration of AllowWildcard Jun 21, 2024
Copy link

github-actions bot commented Jul 6, 2024

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jul 6, 2024
Copy link

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Jul 20, 2024
@StarpTech StarpTech removed the Stale label Jul 20, 2024
@StarpTech StarpTech reopened this Jul 20, 2024
Copy link

github-actions bot commented Aug 4, 2024

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Aug 4, 2024
Copy link

Closed as inactive. Feel free to reopen if this PR is still being worked on.

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

Successfully merging this pull request may close these issues.

Cors AllowWildcard never set - Wildcard origins not taken into account
2 participants