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

[feature/bugfix] Probe S3 storage for CSP uri, add config flag for extra URIs #2134

Merged
merged 2 commits into from Aug 20, 2023

Conversation

tsmethurst
Copy link
Contributor

Description

If this is a code change, please include a summary of what you've coded, and link to the issue(s) it closes/implements.

If this is a documentation change, please briefly describe what you've changed and why.

This pull request updates our CSP construction logic to add extra URIs from config, and s3 URI from probed storage. This should fix cases where the S3 endpoint differs from the domain where images etc actually end up getting served from, while also adding flexibility for instance admins to specify their own URIs if they wish.

Tested this locally by connecting the testrig to an actual S3 bucket, and it works OK :)

Closes #2123

Checklist

Please put an x inside each checkbox to indicate that you've read and followed it: [ ] -> [x]

If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

Copy link
Member

@daenney daenney left a comment

Choose a reason for hiding this comment

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

That's some good probing.

@tsmethurst tsmethurst merged commit 1e2db7a into main Aug 20, 2023
3 checks passed
@tsmethurst tsmethurst deleted the further_adventures_in_csp branch August 20, 2023 11:35
tsmethurst added a commit that referenced this pull request Aug 21, 2023
…tra URIs (#2134)

* [feature/bugfix] Probe S3 storage for CSP uri, add config flag for extra URIs

* env parsing tests, my coy mistress
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.

[bug] Recurring Content Security Policy Error with AWS S3
3 participants