-
Notifications
You must be signed in to change notification settings - Fork 19
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
DESENG-484: Adding max age for cors #2377
Conversation
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work ! Looks like we may be limited in truly reducing OPTIONS calls but the max age value will hopefully help a lot!
Could you please review my question before we proceed with his PR?
# This value is used to indicate how long the results of a preflight request (OPTIONS) can be cached | ||
# by the client, reducing the frequency of preflight requests for the specified HTTP methods. | ||
# Adjust this value based on security considerations. | ||
CORS_MAX_AGE = os.getenv('CORS_MAX_AGE', None) # Default: 0 seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you did this with an environment variable! A couple things:
- Could we make sure to set this in Openshift before we close the ticket? Looks like 2 hours is the maximum value for modern chromium browsers (Firefox is 72 hrs). Either this or we could set the default to be 2 hours.
- Our server is CORS-aware and checking for CORS origins so what are the security considerations here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will set it in Openshift before closing the ticket.
For enhanced security considerations, configuring Access-Control-Max-Age as an environment variable provides the flexibility to adjust its duration or even eliminate it entirely in response to security concerns. Online recommendations suggest maintaining a shorter duration for Access-Control-Max-Age to mitigate potential risks.
* DESENG-484: Adding max age for cors (#2377)
* DESENG-484: Adding max age for cors (#2377)
* DESENG-484: Adding max age for cors (bcgov#2377)
Issue #: https://apps.itsm.gov.bc.ca/jira/browse/DESENG-484
Description of changes:
- Introduces a new configuration variable to specify the maximum age for Cross-Origin Resource Sharing (CORS)
- Modified the CORS preflight method to utilize this newly introduced variable.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the met-public license (Apache 2.0).