Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Widget: support CSP nonces for injected styles

Fechada
#460 2 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@piyusshhjangid já está trabalhando nisso.

Desde 30/10/2026.

  • #473 de @piyusshhjangid — integrado

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
55/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
frontend, security

Direção de pesquisa

Start by locating the loader and the code that creates styles for the chat panel and lazy pre-chat form; the issue does not name files or tests. Trace how script-tag installs can read the script nonce and how ESM configuration is defined, then inspect existing widget tests. Done means every created style element accepts the host nonce, nonce-based tests cover the loader, panel, and lazy pre-chat styles, and behavior without a nonce remains unchanged.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

enhancement
What problem would this solve?

The widget injects <style> elements into its shadow roots for the launcher, chat panel, and pre-chat form. On sites with a strict Content Security Policy that blocks inline styles, those styles can be rejected, leaving the widget unstyled or unusable. This affects both the initial loader and styles added when the pre-chat form loads.

What would you like to happen?

Let the widget apply a host-provided CSP nonce to every style element it creates. For script-tag installs, it could use the nonce on the ChatCops script; ESM users should have a configuration option to provide one. Document the setup and add tests covering the loader, panel, and lazy pre-chat styles under a nonce-based policy. Keep the existing behavior unchanged when no nonce is configured.

Contributing
  • I'd like to work on this myself
Linguagem predominante
TypeScript
Estrelas
13
Forks
7
Merge médio
3h 28min
PRs com merge (30d)
296

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de codercops/chatcops

Todas as issues de codercops/chatcops

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.