Strict CSP breaks ngx‑bootstrap: inline `style` attributes & `javascript:void(0)` links still present

Open
#6,740 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
43/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
angular, typescript
Domain
frontend, security

Research direction

Start by locating inline style creation in the positioning engine under libs/util/positioning and the host styles in Modal, Popover, and Datepicker; then inspect the Carousel, Timepicker, and Tabs templates for javascript: links. Check the CSP console errors while reviewing these entry points. Done means those widgets no longer rely on inline style attributes or javascript: anchors and work under the described strict CSP.

Written by the indexing model from the issue text.

Description

A strict Content‑Security‑Policy that omits 'unsafe-inline' (and doesn’t add style-src-attr) blocks several ngx‑bootstrap widgets:

  • Positioning engine (libs/util/positioning…) sets inline style="…".
  • Components such as Modal, Popover, Datepicker use host: { style: '…' }.
  • Templates for Carousel / Timepicker / Tabs include href="javascript:void(0)".

Resulting console errors:

Refused to apply inline style … "style-src 'self'"
Refused to execute inline script … "script-src 'self'"

Please refactor to:

  • Replace setAttribute('style', …) with property assignments or CSS classes.
  • Remove javascript: anchors (use <button> or role="button").

This will let ngx‑bootstrap run under a modern CSP without unsafe-inline.

Dominant language
TypeScript
Stars
5.5k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from valor-software/ngx-bootstrap

All issues in valor-software/ngx-bootstrap

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.