Skip to content

Commit aedbf93

Browse files
committed
use html escape
1 parent 7337a57 commit aedbf93

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from redis import Redis, RedisError
33
import os
44
import socket
5+
import html
56

67
# Connect to Redis
78
redis = Redis(host="redis", db=0)
@@ -24,7 +25,7 @@ def hello():
2425
"<b>Visits:</b> {visits}<br/>" \
2526
"<b>File:</b> {file}<br/>" \
2627
"<b>Environ:</b> <pre>{environ}</pre>"
27-
return html.format(name=os.getenv('NAME', "world"), hostname=socket.gethostname(), visits=visits, file=__file__, environ=info.replace('<', '&lt;'))
28+
return html.format(name=os.getenv('NAME', "world"), hostname=socket.gethostname(), visits=visits, file=__file__, environ=html.escape(info))
2829

2930

3031
if __name__ == "__main__":

0 commit comments

Comments
 (0)