Skip to content

Commit 1490960

Browse files
committed
fix(collapse): xss in parent option
1 parent 2d90d36 commit 1490960

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

js/src/collapse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ const Collapse = (($) => {
289289
parent = this._config.parent[0]
290290
}
291291
} else {
292-
parent = $(this._config.parent)[0]
292+
parent = document.querySelector(this._config.parent)
293293
}
294294

295295
const selector =

js/tests/visual/collapse.html

+14
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@ <h5 class="mb-0">
5454
</div>
5555
</div>
5656
</div>
57+
<div class="card">
58+
<div class="card-header" role="tab" id="headingFour">
59+
<h5 class="mb-0">
60+
<a class="collapsed" data-toggle="collapse" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
61+
Collapsible Group Item with XSS in data-parent
62+
</a>
63+
</h5>
64+
</div>
65+
<div id="collapseFour" class="collapse" data-parent="<img src=1 onerror=alert(123) />" role="tabpanel" aria-labelledby="headingFour">
66+
<div class="card-body">
67+
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
68+
</div>
69+
</div>
70+
</div>
5771
</div>
5872
</div>
5973

0 commit comments

Comments
 (0)