X10nD
X10nD

Reputation: 22030

Is there a security issue parsing urls using php

I will be using parsing urls, so there any known or possible security issues associated with parsing urls?

Upvotes: 0

Views: 90

Answers (2)

esycat
esycat

Reputation: 1364

What kind of parsing are you going to do and for what purpose?

There already is parse_url. As noted by others, you should not trust any user input, so do quote properly before strong in the database or displaying back to the user. You may also need to consider, if it is relevant, that spaces and special characters may be represented differently depending on source of your data. But there's no potential harm in just comparing parts as like in comparing strings.

Upvotes: 0

Quentin
Quentin

Reputation: 943097

There is nothing intrinsically insecure about parsing URLs.

Blindly trusting data from a URI might introduce security issues.

There may or may not be known security issues with particular functions you might use to parse URLs in particular versions of PHP.

Upvotes: 3

Related Questions