Skip to content

Commit

Permalink
Fixed placeholders missing for some blocked embeddings (Tor ticket #2…
Browse files Browse the repository at this point in the history
…8720).
  • Loading branch information
hackademix committed Dec 5, 2018
1 parent 5b625a1 commit 11d9a4d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib/CSP.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
"use strict";

class CSP {

build(...directives) {
return directives.join(';');
}

buildBlocker(...types) {
return this.build(...(types.map(type => `${type.name || type}-src ${type.value || "'none'"}`)));
}

blocks(header, type) {
return `;${header};`.includes(`;${type}-src 'none';`)
}

asHeader(value) {
return {name: CSP.headerName, value};
}
}

CSP.isEmbedType = type => /\b(?:application|video|audio)\b/.test(type);
CSP.isEmbedType = type => /\b(?:application|video|audio)\b/.test(type) && type !== "application/xhtml+xml";
CSP.headerName = "content-security-policy";

0 comments on commit 11d9a4d

Please sign in to comment.