File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 9
9
},
10
10
"dependencies" : {
11
11
"@atproto/common" : " ^0.4.0" ,
12
+ "@types/escape-html" : " ^1.0.4" ,
12
13
"body-parser" : " ^1.20.2" ,
13
14
"cors" : " ^2.8.5" ,
15
+ "escape-html" : " ^1.0.3" ,
14
16
"express" : " ^4.19.2" ,
15
17
"http-terminator" : " ^3.2.0" ,
16
18
"kysely" : " ^0.27.3" ,
Original file line number Diff line number Diff line change 1
1
import assert from 'node:assert'
2
2
3
3
import { DAY , SECOND } from '@atproto/common'
4
+ import escapeHTML from 'escape-html'
4
5
import { Express } from 'express'
5
6
6
7
import { AppContext } from '../context.js'
@@ -42,8 +43,10 @@ export default function (ctx: AppContext, app: Express) {
42
43
res . setHeader ( 'Cache-Control' , `max-age=${ ( 7 * DAY ) / SECOND } ` )
43
44
res . type ( 'html' )
44
45
res . status ( 200 )
46
+
47
+ const escaped = escapeHTML ( url . href )
45
48
return res . send (
46
- `<html><head><meta http-equiv="refresh" content="0; URL='${ url . href } '" /><style>:root { color-scheme: light dark; }</style></head></html>` ,
49
+ `<html><head><meta http-equiv="refresh" content="0; URL='${ escaped } '" /><style>:root { color-scheme: light dark; }</style></head></html>` ,
47
50
)
48
51
} ) ,
49
52
)
Original file line number Diff line number Diff line change 69
69
dependencies :
70
70
" @types/node" " *"
71
71
72
+ " @types/escape-html@^1.0.4 " :
73
+ version "1.0.4"
74
+ resolved "https://registry.yarnpkg.com/@types/escape-html/-/escape-html-1.0.4.tgz#dc7c166b76c7b03b27e32f80edf01d91eb5d9af2"
75
+ integrity sha512-qZ72SFTgUAZ5a7Tj6kf2SHLetiH5S6f8G5frB2SPQ3EyF02kxdyBFf4Tz4banE3xCgGnKgWLt//a6VuYHKYJTg==
76
+
72
77
" @types/node@* " :
73
78
version "20.14.2"
74
79
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.2.tgz#a5f4d2bcb4b6a87bffcaa717718c5a0f208f4a18"
@@ -276,7 +281,7 @@ es-errors@^1.3.0:
276
281
resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f"
277
282
integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==
278
283
279
- escape-html@~1.0.3 :
284
+ escape-html@^1.0.3, escape-html@ ~1.0.3 :
280
285
version "1.0.3"
281
286
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
282
287
integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==
You can’t perform that action at this time.
0 commit comments