Commit af9c40c
security: fix stored XSS in alertmanager and storegateway status pages (#7512)
* security: fix stored XSS in alertmanager and storegateway status pages
Replace text/template with html/template in alertmanager_http.go and
gateway_http.go to auto-escape HTML special characters. This prevents
stored XSS via crafted gossip member names rendered on status pages.
The html/template package has an identical API to text/template but
automatically escapes HTML, JS, and URI contexts.
Add TestStatusHandler_HTMLEscaping to verify XSS payloads are escaped.
Fixes #22
Signed-off-by: Daniel Blando <ddeluigg@amazon.com>
* Fix lint
Signed-off-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
* changelog
Signed-off-by: Daniel Blando <ddeluigg@amazon.com>
---------
Signed-off-by: Daniel Blando <ddeluigg@amazon.com>
Signed-off-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
Co-authored-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>1 parent a13e3d9 commit af9c40c
4 files changed
Lines changed: 30 additions & 2 deletions
File tree
- pkg
- alertmanager
- storegateway
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
15 | 42 | | |
16 | 43 | | |
17 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments