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

feat(echo): Cors specific origin selection for prod environments - DRAFT - Do not Merge #5731

Draft
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

scopsy
Copy link
Contributor

@scopsy scopsy commented Jun 14, 2024

Waiting for dev deployment for testing

Comment on lines +176 to +177
source: string,
headers: { originHeader: string; anonymousHeader: string }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored to easily allowing to add more headers in the future

const { originHeader, anonymousHeader } = headers;
const isProduction = process.env.NODE_ENV === 'production';
const isValidOrigin =
(originHeader && originHeader.includes('https://web.novu.co')) ||

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
https://web.novu.co
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
const isProduction = process.env.NODE_ENV === 'production';
const isValidOrigin =
(originHeader && originHeader.includes('https://web.novu.co')) ||
originHeader.includes('https://eu.web.novu.co') ||

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
https://eu.web.novu.co
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
const isValidOrigin =
(originHeader && originHeader.includes('https://web.novu.co')) ||
originHeader.includes('https://eu.web.novu.co') ||
originHeader.includes('https://dev.web.novu.co');

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
https://dev.web.novu.co
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
Copy link

netlify bot commented Jun 14, 2024

Deploy Preview for dev-web-novu ready!

Name Link
🔨 Latest commit 4215987
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/666bf8489970cc0008a9e96d
😎 Deploy Preview https://deploy-preview-5731--dev-web-novu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jun 14, 2024

Deploy Preview for novu-design failed. Why did it fail? →

Name Link
🔨 Latest commit 4215987
🔍 Latest deploy log https://app.netlify.com/sites/novu-design/deploys/666bf8481c51040008c0bc0f

const { originHeader, anonymousHeader } = headers;
const isProduction = process.env.NODE_ENV === 'production';
const isValidOrigin =
(originHeader && originHeader.includes('https://web.novu.co')) ||
Copy link
Contributor

@rifont rifont Jun 14, 2024

Choose a reason for hiding this comment

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

I suggest we create a NovuWebUrlEnum with all options, then we can simplify this check to:

const isValidOrigin = Object.values(NovuApiUrlEnum).includes(originHeader);

Copy link

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the stale Pull Request that needs to be reviewed label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Pull Request that needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants