Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Filter segments for malicious characters", really ? #47

Closed
bitbucket-import opened this issue Aug 19, 2011 · 13 comments
Closed

"Filter segments for malicious characters", really ? #47

bitbucket-import opened this issue Aug 19, 2011 · 13 comments

Comments

@bitbucket-import
Copy link

When requesting a URI containing URI encoded parenthesis (I mean %28 and %29), they reach the controller maimed and unusable. Their strlen() reads wrong and they wont be matched as parenthesis by regex.

The reason for this is in system/core/URI.php at lines 238-241. Why would the parenthesis be replaced by shitty HTML entities that damage the string ?

// Convert programatic characters to entities
$bad    = array('$',        '(',        ')',        '%28',      '%29');
$good   = array('$',    '(',    ')',    '(',    ')');
return str_replace($bad, $good, $str);

Unless there's a good reason for it, I think this replacement should be removed altogether. You don't want to know how many hours it took me to pinpoint this issue.

With love,

Antoine Gersant

@narfbg
Copy link
Contributor

narfbg commented Jun 19, 2012

This really depends on wether #388 is considered a bug or not.

@narfbg
Copy link
Contributor

narfbg commented Oct 31, 2012

... or not - ignore my last comment.

@iamjochem
Copy link

+1 for scrapping the "conversion programatic characters" - it is pointless, has the potential to waste a lot of time 'debugging' and it is incorrect. the code essentially performs a limited "html entitizing" ... html entitizing is something you do to output not input!

@jim-parry
Copy link
Contributor

Hasn't this been address by #388? Can this be closed?

@narfbg
Copy link
Contributor

narfbg commented Nov 11, 2014

#388 has nothing to do with this ... other issues related to this one have been fixed, but the suggestion here is to remove this filter altogether.

@Razican
Copy link
Contributor

Razican commented Nov 11, 2014

I think enough people are having issues with it and that it does not have a clear advantage, so in my opinion it should be removed.

@jim-parry
Copy link
Contributor

I agree that the substitution should be removed. RFC 3986 says that the dollar sign and parentheses are safe characters and do not need encoding. They are also flagged as "reserved" characters, which can be encoded and interpreted by an application, but that appears to be subsequent to any use as a URI.

@ostrolucky
Copy link
Contributor

I'm voting for removing it.

@ivantcholakov
Copy link
Contributor

+1 for "conversion programatic characters" removal. The three presented justifications are good enough.


Edit: Justification 4: Such characters within a segment may be needed as a result of sloppy slug generation. If you use url_title() for this purpose, the segment would be clean, and then the "programatic characters" simply may not be enabled using the setting $config['permitted_uri_chars'].

url_title() may be reworked to transliterate from non-Latin languages, but this is another story.

@Razican
Copy link
Contributor

Razican commented Dec 2, 2014

I vote for it too.

@narfbg
Copy link
Contributor

narfbg commented Dec 3, 2014

Well, the public opinion seems to be unanimous.

@pfote @benedmunds @druu @lonnieezell Any objections?

@benedmunds
Copy link
Contributor

No objection.

@lonnieezell
Copy link
Contributor

I can't think of a reason it's really needed, but haven't scoured the code about this either.

No objection.

@narfbg narfbg closed this as completed in bc11439 Dec 5, 2014
narfbg added a commit that referenced this issue Dec 5, 2014
 - Removed a test that was created specifically for the 'convert programmatic characters to entities' feature.
 - Changed filter_uri() to accept by reference and to not return anything as its only purpose now is to trigger a show_error() call.
 - Added changelog messages and updated the upgrade instructions.
ghost pushed a commit to goreilly/CodeIgniter that referenced this issue Jan 3, 2015
ghost pushed a commit to goreilly/CodeIgniter that referenced this issue Jan 3, 2015
 - Removed a test that was created specifically for the 'convert programmatic characters to entities' feature.
 - Changed filter_uri() to accept by reference and to not return anything as its only purpose now is to trigger a show_error() call.
 - Added changelog messages and updated the upgrade instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants