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

Whitelist S3 bucket in CSP #1266

Merged
merged 4 commits into from
Mar 2, 2021
Merged

Whitelist S3 bucket in CSP #1266

merged 4 commits into from
Mar 2, 2021

Conversation

yong-jie
Copy link
Member

@yong-jie yong-jie commented Mar 2, 2021

Problem

Announcement modals were designed to be configurable without deployments. Images, however, had to be added into the bundle they could be used in these modals.

To fully decouple announcement modal updates with code deployment/releases, we will need a way for the modal to load images from external sources. The most straightforward approach would be to use a file-link.

In order for this to work, we need to whitelist our file bucket's url in the content security policy.

Solution

A single codebase is now responsible for customising the CSP for 4 different environments. Fortunately, it turns out the S3_BUCKET is a compulsory env var which can be directly mapped to the correct bucket url, so I'm opting to use that.

Result

image

@yong-jie yong-jie requested review from LoneRifle and barnettx March 2, 2021 09:07
@yong-jie yong-jie merged commit b6304d2 into develop Mar 2, 2021
@yong-jie yong-jie deleted the csp-image-bucket branch March 2, 2021 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants