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

Unexpected handling of dollar signs ($) in URL during conversion. #13

Open
janzankowski opened this issue Jun 5, 2018 · 0 comments
Open

Comments

@janzankowski
Copy link

Steps to reproduce:

  1. Paste the following string into the conversion box:
    curl 'http://sejm.gov.pl/Sejm8.nsf/posel.xsp?id=001&type=A&$$ajaxid=view%3A_id1%3A_id2%3AfacetMain%3A_id187%3AholdBiura'
  2. Wait until result is produced.

Result:

// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $_ENV["http://sejm.gov.pl/Sejm8.nsf/posel.xsp?id=001&type=A&ajaxid=view%3A_id1%3A_id2%3AfacetMain%3A_id187%3AholdBiura"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);

In particular, please note the part: $_ENV["http://sejm.gov.pl/Sejm8.nsf/posel.xsp?id=001&type=A&ajaxid=view%3A_id1%3A_id2%3AfacetMain%3A_id187%3AholdBiura"].

I see there's something clever going on here, because of adding the $_ENV bit. This is easy to catch because on executing this, PHP will complain about 'no index found' (in array $_ENV). However, only after quite some time I also realized the dollar signs ($) in the bit $$ajaxid in the input string were dropped in the resulting code, and caused the requests not to work. If this needs to be done to prevent some XSS, etc, then could the converter be more explicit about it?

Proposed solution:
Provide a warning label if dollar characters are removed from input URL.

Thank you for a great tool.

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

1 participant