Content Security Policy and SPAs

オープン
#32,405 コメント 1 件 リアクション 15 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
angular, typescript

調査の方向性

Angular CLI のビルドパイプラインから始め、bootstrap JavaScript と index.html がどのように扱われるかを調査します。hashes.json の出力形式を定義し、バックエンドが CSP ヘッダーで使用できるよう、すべての bootstrap スクリプトのハッシュが一覧に含まれていることを確認します。

索引モデルが issue の本文から書いたものです。

説明

angular/build:application area: @angular/build feature feature: votes required
Which @angular/* package(s) are relevant/related to the feature request?

No response

Description

Currently CSP and SPAs don't work well together.

There is however something very simple we could do to make CSP 100% compatible with SPA.

Proposed solution

When Angular builds the app, also output a file called hashes.json. This file contains a list of hashes of all of the bootstrap js scripts. Then, in your backend, say asp.net core, you read this file and add the hashes to your CSP header.

This would be a very simple change that would make a lot of people's lives much easier.

Alternatives considered
  • AutoCSP is not ideal because it uses the meta tag, not http headers.
  • Setting the nonce to CSP_NONCE doesn't work with strict-dynamic.
  • Setting the nonce in index.html breaks caching.
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
16時間 35分
マージ済み PR(30日)
176

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/angular-cli のほかの issue

angular/angular-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。