Skip to content

Conversation

@alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Nov 5, 2025

Generate the proper content-hash for the page's inline <style> element.

Together with getodk/central#1478, this closes getodk/central#1235.

What has been done to verify that this works as intended?

A whole new test.

Why is this the best possible solution? Were any other approaches considered?

Alternatives:

  1. hardcode this hash into the central nginx config
  2. make a more relaxed CSP for this route

1 would be easy to break if this code changes; 2 is probably not sensible for this route if the aim is improving security.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

No visible effect, low risk.

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

No.

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

Generate the proper content-hash for the page's inline `<style>` element.

Ref getodk/central#1235
Ref getodk/central#1478
@alxndrsn

This comment was marked as resolved.

@alxndrsn alxndrsn marked this pull request as ready for review November 5, 2025 16:02
Copy link
Member

@matthew-white matthew-white left a comment

Choose a reason for hiding this comment

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

I ended up feeling like I had enough context to review this particular CSP PR. I remember when we added the HTML page and <style> element to lib/resources/oidc.js.

The code makes sense to me. 👍 The CSP looks locked down, with exceptions for favicon.ico and for the <style> element. The test also demonstrates that there is no console error.

@matthew-white matthew-white removed the request for review from brontolosone November 17, 2025 23:36
@alxndrsn alxndrsn merged commit 373fd05 into getodk:master Nov 18, 2025
6 checks passed
@alxndrsn alxndrsn deleted the oidc-csp branch November 18, 2025 08:24
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.

oidc: csp: style-src-elem directive violated on login

2 participants