Skip to content

csp/web-forms: allow data URLs for images#1683

Merged
alxndrsn merged 2 commits intogetodk:nextfrom
alxndrsn:web-forms-img-src
Mar 15, 2026
Merged

csp/web-forms: allow data URLs for images#1683
alxndrsn merged 2 commits intogetodk:nextfrom
alxndrsn:web-forms-img-src

Conversation

@alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Mar 13, 2026

Web-Forms includes the ODK logo as:

<img data-v-8e923f80="" class="logo" src="data:image/svg+xml,%3csvg%20width='426'%20height='223'..." alt="ODK">

This means data: needs to be allowed by the image-src directive in the Content-Security-Policy / Content-Security-Policy-Report-Only header.

Resolves: https://getodk.sentry.io/issues/7094732050/

Example: https://staging.getodk.cloud/projects/210/forms/group_in_group_reg/submissions/new

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

  • updated tests

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

An alternative might be to change the way that web-forms includes the ODK logo.

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 effect, except reduced background HTTP traffic from CSP reports.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • branched off and targeted the next branch OR only changed documentation/infrastructure (master is stable and used in production)
  • verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced

Web-Forms includes the ODK logo as:

	<img data-v-8e923f80="" class="logo" src="data:image/svg+xml,%3csvg%20width='426'%20height='223'..." alt="ODK">

This means `data:` needs to be allowed by the `image-src` directive in the `Content-Security-Policy` / `Content-Security-Policy-Report-Only` header.

Resolves: https://getodk.sentry.io/issues/7094732050/

Example: https://staging.getodk.cloud/projects/210/forms/group_in_group_reg/submissions/new
@alxndrsn alxndrsn marked this pull request as ready for review March 13, 2026 05:30
@alxndrsn alxndrsn merged commit 3c59b1b into getodk:next Mar 15, 2026
5 checks passed
@alxndrsn alxndrsn deleted the web-forms-img-src branch March 15, 2026 05:38
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