Repository navigation
2026 06 10 Security XSS ItemToString
Category: Security - XSS (Cross-Site Scripting)
Effort: Medium
Priority: High
Component: frontend/src/components/waste/WasteSearch/WasteSearchFiltersAdvanced/AdvancedFilterClientInput/index.tsx
The AutoCompleteInput component uses itemToString={(item) => item!.description} to render items. If the description field from the backend contains malicious HTML or JavaScript (e.g., <script>alert('xss')</script>), and if Carbon's AutoCompleteInput renders this as raw HTML rather than escaped text, this could lead to stored XSS attacks.
Attack vector:
- Malicious user or compromised backend stores a
CodeDescriptionDtowith adescriptioncontaining script tags - When this item is rendered in the autocomplete dropdown, the script executes in the context of the victim's session
import DOMPurify from 'dompurify';
// In the AutoCompleteInput props:
itemToString={(item) => DOMPurify.sanitize(item!.description)}itemToString={(item) => {
const desc = item!.description
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
return desc;
}}Ensure forestClientAutocompleteResult2CodeDescription sanitizes the description field before it reaches the component.
frontend/src/components/waste/WasteSearch/WasteSearchFiltersAdvanced/AdvancedFilterClientInput/index.tsx-
frontend/src/services/utils.ts(checkforestClientAutocompleteResult2CodeDescription) - Backend API:
forestclient.searchForestClientsendpoint
- May require adding
dompurifypackage:npm install dompurify
- Verify that
<script>tags in descriptions are rendered as text, not executed - Test with special characters (
<,>,&,",') to ensure proper escaping
This wiki documents NR Waste Plus for users and developers. Verify security and deployment guidance against the current application configuration before applying it elsewhere.
- Report an issue or ask a question in the GitHub repository.
- Follow the Contributing Guidelines to propose an update.
- Read the Code of Conduct.
Collection indexes support human browsing and machine retrieval. Keep both current when adding or moving wiki pages.
NR Waste Plus Wiki | GitHub Repository