Skip to content

Commit fc3ba62

Browse files
authored
Merge pull request #110 from xHeaven/patch-1
Clientside output purifying
2 parents d2767dd + 35faa11 commit fc3ba62

File tree

6 files changed

+19
-5
lines changed

6 files changed

+19
-5
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"prettier": "^1.15.3",
2525
"split-grid": "^1.0.9",
2626
"tailwindcss": "^0.7.2",
27-
"vue": "^2.5.7"
27+
"vue": "^2.5.7",
28+
"dompurify": "^3.2.3"
2829
}
2930
}

public/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"/app.js": "/app.js?id=54675ea5df087610508e",
2+
"/app.js": "/app.js?id=f5f7de2fdbf2c19e7948",
33
"/app.css": "/app.css?id=1e19e507bfac7fe73255"
44
}

resources/js/components/Tinker.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import TinkerInput from './TinkerInput';
1111
import TinkerOutput from './TinkerOutput';
1212
import Split from 'split-grid';
13+
import DOMPurify from 'dompurify';
1314
1415
export default {
1516
components: {
@@ -56,7 +57,7 @@ export default {
5657
5758
methods: {
5859
handleExecute(output) {
59-
this.output = output;
60+
this.output = DOMPurify.sanitize(output);
6061
},
6162
6263
initSplit() {

src/Tinker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ protected function cleanOutput(string $output): string
116116

117117
$output = preg_replace('/(?s)(<whisper.*?<\/whisper>)|INFO Ctrl\+D\./ms', '$2', $output);
118118

119-
return htmlentities(trim($output));
119+
return trim($output);
120120
}
121121
}

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# yarn lockfile v1
33

44

5+
"@types/trusted-types@^2.0.7":
6+
version "2.0.7"
7+
resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.7.tgz#baccb07a970b91707df3a3e8ba6896c57ead2d11"
8+
integrity sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==
9+
510
abbrev@1:
611
version "1.1.1"
712
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
@@ -2077,6 +2082,13 @@ domain-browser@^1.1.1:
20772082
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda"
20782083
integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==
20792084

2085+
dompurify@^3.2.3:
2086+
version "3.2.3"
2087+
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.2.3.tgz#05dd2175225324daabfca6603055a09b2382a4cd"
2088+
integrity sha512-U1U5Hzc2MO0oW3DF+G9qYN0aT7atAou4AgI0XjWz061nyBPbdxkfdhfy5uMgGn6+oLFCfn44ZGbdDqCzVmlOWA==
2089+
optionalDependencies:
2090+
"@types/trusted-types" "^2.0.7"
2091+
20802092
dotenv-expand@^4.2.0:
20812093
version "4.2.0"
20822094
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-4.2.0.tgz#def1f1ca5d6059d24a766e587942c21106ce1275"

0 commit comments

Comments
 (0)