Skip to content

Commit

Permalink
Fix csp nonce by removing getAttribute. (by PR Tencent#185 )
Browse files Browse the repository at this point in the history
  • Loading branch information
Maiz committed Jan 17, 2019
1 parent 22bf960 commit dc5464a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/mito.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function render(tpl, data, toString) {
let scriptList = document.getElementsByTagName('script');
let nonce = '';
if (scriptList.length > 0) {
nonce = scriptList[0].getAttribute('nonce') || ''; // get nonce to avoid `unsafe-inline`
nonce = scriptList[0].nonce || ''; // get nonce to avoid `unsafe-inline`
}
let script = document.createElement('SCRIPT');
script.innerHTML = codeWrap;
Expand Down
2 changes: 1 addition & 1 deletion src/log/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class VConsoleDefaultTab extends VConsoleLogTab {
let scriptList = document.getElementsByTagName('script');
let nonce = '';
if (scriptList.length > 0) {
nonce = scriptList[0].getAttribute('nonce') || ''; // get nonce to avoid `unsafe-inline`
nonce = scriptList[0].nonce || ''; // get nonce to avoid `unsafe-inline`
}
let script = document.createElement('SCRIPT');
script.innerHTML = code;
Expand Down

0 comments on commit dc5464a

Please sign in to comment.