Skip to content

Reduce CSP inline style violations in drug stock webviews#5786

Merged
igbanam merged 1 commit intomasterfrom
cursor/top-5-simple-server-errors-e227
Mar 25, 2026
Merged

Reduce CSP inline style violations in drug stock webviews#5786
igbanam merged 1 commit intomasterfrom
cursor/top-5-simple-server-errors-e227

Conversation

@igbanam
Copy link
Contributor

@igbanam igbanam commented Mar 23, 2026

Story card: SIMPLEBACK-95

Because

style-src-attr and style-src-elem CSP violations are among the highest-volume Sentry errors for Simple Server, with a large concentration on the webview drug stock pages.

This addresses

  • Adds CSP nonce attributes to helper-generated inline assets:
    • inline_stylesheet
    • inline_js
  • Removes inline style="..." attributes from the highest-traffic webview templates:
    • app/views/webview/drug_stocks/new.html.erb
    • app/views/webview/drug_stocks/index.html.erb
  • Adds a CSP nonce to the inline script in webview/drug_stocks/new.
  • Removes inline style attributes from SVG assets used on that flow:
    • app/assets/images/chevron-left.svg
    • app/assets/images/check-mark-small.svg

Test instructions

  1. Open the drug stock webview pages:
    • /webview/drug_stocks/new
    • /webview/drug_stocks
  2. Verify both pages render correctly (buttons, footer spacing, icons).
  3. Inspect page source/DOM and confirm there are no inline style="..." attributes on the modified elements.
  4. Confirm helper-generated inline <style> / <script> tags include a nonce attribute.
  5. Monitor Sentry issues SIMPLE-SERVER-1RQ and SIMPLE-SERVER-1RR after deploy for a drop in new events.

Co-authored-by: Igbanam <igbanam@users.noreply.github.com>
@igbanam igbanam marked this pull request as ready for review March 23, 2026 11:16
@igbanam igbanam requested a review from a team March 23, 2026 11:16
@igbanam igbanam self-assigned this Mar 23, 2026
@igbanam igbanam merged commit 68d7cd7 into master Mar 25, 2026
1 check passed
@igbanam igbanam deleted the cursor/top-5-simple-server-errors-e227 branch March 25, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants