Skip to content

Commit f26551c

Browse files
bug: assert search query renders escaped in the DOM
Signed-off-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Alister Mac Cormack <alister.maccormack@cognition.ai>
1 parent bc63d92 commit f26551c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

frontend/src/app/search-result/search-result.component.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,13 @@ describe('SearchResultComponent', () => {
221221
expect(component.searchValue).toEqual('<script>scripttag</script>')
222222
expect(sanitizer.bypassSecurityTrustHtml).not.toHaveBeenCalledWith('<script>scripttag</script>')
223223
})
224+
225+
it('should render the search query escaped in the DOM', () => {
226+
activatedRoute.setQueryParameter('<img src=x onerror=alert(1)>')
227+
component.filterTable()
228+
fixture.detectChanges()
229+
const element: HTMLElement = fixture.nativeElement.querySelector('#searchValue')
230+
expect(element.childElementCount).toBe(0)
231+
expect(element.textContent).toEqual('<img src=x onerror=alert(1)>')
232+
})
224233
})

0 commit comments

Comments
 (0)