cosmo
cosmo copied to clipboard
Cors AllowWildcard never set - Wildcard origins not taken into account
router v0.92.3
Description
Using only a config.yaml to setup the router, it is impossible to make use of wildcards in cors.allow_origins as AllowWildcard is never set and therefore parseWildcardRules() doesn't pickup any rules.
Steps to Reproduce
Start a router with the following in the config:
cors:
allow_origins: [http://*]
allow_headers: ["*"]
allow_credentials: true
Use chrome to make a fetch request to your router and you will get 403 Forbidden in the OPTIONS request.
Expected Result
OPTIONS request should go through
Actual Result
403 Forbidden in the OPTIONS request
Useful links
allow_wildcardshould be added here ? https://github.com/wundergraph/cosmo/blob/main/router/pkg/config/config.go#L112- AllowWildcard is never set anywhere (Except in tests where its manually set to true) https://github.com/search?q=repo%3Awundergraph%2Fcosmo+AllowWildcard&type=code saved_reply_id: issue[textarea_helper_element]: ## Description
Using only a config.yaml to setup the router, it is impossible to make use of wildcards in cors.allow_origins as AllowWildcard is never set and therefore parseWildcardRules() doesn't pickup any rules.
Steps to Reproduce
Start a router with the following in the config:
cors:
allow_origins: [http://*]
allow_headers: ["*"]
allow_credentials: true
Use chrome to make a fetch request to your router and you will get 403 Forbidden in the OPTIONS request.
Expected Result
OPTIONS request should go through
Actual Result
403 Forbidden in the OPTIONS request
Useful links
allow_wildcardshould be added here ? https://github.com/wundergraph/cosmo/blob/main/router/pkg/config/config.go#L112- AllowWildcard is never set anywhere (Except in tests where its manually set to true) https://github.com/search?q=repo%3Awundergraph%2Fcosmo+AllowWildcard&type=code
Config
version: '1'
dev_mode: true
router_config_path: config.json
graph:
token: ''
listen_addr: 0.0.0.0:3002
graphql_path: '/'
headers:
all:
request:
- op: 'propagate'
named: authorization
- op: 'propagate'
named: Cookie
- op: 'propagate'
named: origin
cors:
allow_origins: [http://*]
allow_headers: ["*"]
allow_credentials: true
telemetry:
prometheus:
enabled: false # Side node: disabling prometheus doesn't work too
WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible. The roadmap is driven by our customers and we have to prioritize issues that are important to them. You can influence the priority by becoming a customer. Please contact us here.