Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Htmlspecialchars for this? #228

Pok4 started this conversation in General
Discussion options

Does it secure already or i must use htmspecialchars on $id = $httpRequest->getQuery('id'); for example? Like
htmlspecialchars($httpRequest->getQuery('id')) ;
I will pass get and POST variables into db queries.
I'm using pdo prepare. This is my question.. Its already everything secure to be passed in db or not?

You must be logged in to vote

Replies: 1 comment

Comment options

Html context specific escaping should be done when you print data in html, because escaping is context specific. You wouldn't use data escaped for html in json and xml exports for example.

Also check how Latte escapes data, it's not as simple as just htmlspecialchars() https://blog.nette.org/en/quiz-can-you-defend-against-xss-vulnerability

Other types of vulnerabilities that make sense to check in http data of unknown type are handled well by nette/http.
And nette/database uses prepared statements the same way as PDO does for save SQL queries

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #226 on August 21, 2023 17:49.

AltStyle によって変換されたページ (->オリジナル) /