Conversation
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
Signed-off-by: Dinne Kopelevich <[email protected]>
decause-gov
left a comment
There was a problem hiding this comment.
Wowow! So much work here!
I had just one question about whether we keep test-agency-indexes as a path/folder, but everything else looks solid to me, assuming you coordinated with @natalialuzuriaga on the IA.
We could put some comments in places wherever we're using dsacms.github.io/* URLs, so that we can remember we need to swap them out if/when GSA deploys our repos, but, if they wanna just point the URL towards us, that's ok too ;)
LGTM +1 🚢 💪
natalialuzuriaga
left a comment
There was a problem hiding this comment.
Couple of minor issues resolving our tests and files that can be removed. This is an amazing addition to the site 🤩
Signed-off-by: Dinne Kopelevich <[email protected]>
| cardElement.innerHTML = targetType === 'agencies' | ||
| ? createAgencyCardHTML(item) | ||
| : createProjectCardHTML(item) |
Check failure
Code scanning / CodeQL
DOM text reinterpreted as HTML High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 8 months ago
To fix the issue, we need to ensure that any untrusted data used to generate HTML is properly sanitized or escaped. The best approach is to use a library like DOMPurify to sanitize the HTML content before assigning it to innerHTML. Alternatively, we can escape the interpolated values to ensure that special characters are not interpreted as HTML. This fix will involve:
- Importing and using
DOMPurifyto sanitize the output ofcreateAgencyCardHTMLandcreateProjectCardHTMLbefore assigning it toinnerHTML. - Ensuring that all dynamic data interpolated into the HTML is sanitized or escaped.
| @@ -1 +1,3 @@ | ||
| import DOMPurify from 'dompurify'; | ||
|
|
||
| const createFilterState = (data, targetType) => ({ | ||
| @@ -202,5 +204,6 @@ | ||
| const cardElement = document.createElement('div'); | ||
| cardElement.innerHTML = targetType === 'agencies' | ||
| const rawHTML = targetType === 'agencies' | ||
| ? createAgencyCardHTML(item) | ||
| : createProjectCardHTML(item) | ||
| : createProjectCardHTML(item); | ||
| cardElement.innerHTML = DOMPurify.sanitize(rawHTML); | ||
|
|
| @@ -64,3 +64,4 @@ | ||
| "luxon": "^2.3.1", | ||
| "markdown-it-footnote": "^3.0.3" | ||
| "markdown-it-footnote": "^3.0.3", | ||
| "dompurify": "^3.2.6" | ||
| }, |
| Package | Version | Security advisories |
| dompurify (npm) | 3.2.6 | None |
module-name: Agency and project card functionality
Problem
The
code-govfront-end needs a way to display agencies and their projects in an organized and searchable format.Solution
Implemented a comprehensive agency and project card system by creating the following components:
Data
_data/codegovData.jscodegov.jsonHTML tagsFiltering
_includes/filters.htmlandassets/_common/js/filters.jsdebouncefunction to create a real time searchAgencies & Projects
Result
Notes
Test Plan
/agencies/then to/projects/Next steps