To fix the problem, we need to ensure that any user-provided data is properly sanitized or encoded before being inserted into the HTML. In this case, we can use the he library, which is already imported, to encode the currentLanguage parameter before using it in the HTML.
We will use he.encode to encode currentLanguage before it is used in the newCards HTML string.
This change will be made in the loadMorePokemon function where currentLanguage is used.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.
Fixes https://github.com/kieferhax/pokedex-web-application/security/code-scanning/4
To fix the problem, we need to ensure that any user-provided data is properly sanitized or encoded before being inserted into the HTML. In this case, we can use the
he
library, which is already imported, to encode thecurrentLanguage
parameter before using it in the HTML.he.encode
to encodecurrentLanguage
before it is used in thenewCards
HTML string.loadMorePokemon
function wherecurrentLanguage
is used.Suggested fixes powered by Copilot Autofix. Review carefully before merging.