Skip to content

Htmlspecialchars for this?  #226

Closed
Closed

Description

@Pok4

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?

Activity

  1. mabar commented on Aug 18, 2023

    @mabar
    Contributor

    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

  2. locked and limited conversation to collaborators on Aug 21, 2023
  3. converted this issue into a discussion #228 on Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions