Commit a44777d
authored
ACM-38694 Replace dangerouslySetInnerHTML with <Trans> in shared resource warnings (#6701)
* fix(applications): replace dangerouslySetInnerHTML with <Trans> (ACM-38694)
The getCodeSpan helper in SharedResourceWarning concatenated a resource name
(a Subscription metadata.name) into raw HTML rendered via dangerouslySetInnerHTML
without encoding (CWE-79). Kubernetes DNS-1123 name validation blocks exploitation
today, but the sink is one data-source change away from XSS.
Render the shared-resource warnings with <Trans> and React children instead, and
remove the getCodeSpan/getWarningSpan raw-HTML helpers. Also convert the remaining
static-string dangerouslySetInnerHTML in DeleteResourceModal to plain JSX. No
dangerouslySetInnerHTML remains in these components.
Signed-off-by: Kevin Cormier <kcormier@redhat.com>
* test(applications): add SharedResourceWarning XSS regression tests (ACM-38694)
Add a regression test that renders SharedResourceWarning with a malicious
subscription name and asserts the payload is rendered as inert, escaped text
(no injected element, no fired handler), plus a jest-axe accessibility test.
The regression test fails against the previous dangerouslySetInnerHTML code
and passes with the <Trans> fix.
Signed-off-by: Kevin Cormier <kcormier@redhat.com>
* chore(applications): use ~/ import aliases in SharedResourceWarning (ACM-38694)
Signed-off-by: Kevin Cormier <kcormier@redhat.com>
* Revert changes for shared resource warning
Signed-off-by: Kevin Cormier <kcormier@redhat.com>
---------
Signed-off-by: Kevin Cormier <kcormier@redhat.com>1 parent 9e0c6d4 commit a44777d
1 file changed
Lines changed: 3 additions & 7 deletions
Lines changed: 3 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
262 | 258 | | |
263 | 259 | | |
264 | 260 | | |
| |||
0 commit comments