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

RequestFactory: remove or improve binary mode #34

Closed
JanTvrdik opened this issue Dec 18, 2014 · 11 comments
Closed

RequestFactory: remove or improve binary mode #34

JanTvrdik opened this issue Dec 18, 2014 · 11 comments

Comments

@JanTvrdik
Copy link
Contributor

Current implementation of binary mode (RequestFactory::setBinary()) is stupid and encourages insecure behavior, because I usually want to transfer only a single parameter in binary. To achieve that user should not disable UTF-8 validation on all input parameters.

We should either

  • remove the binary mode entirely or
  • improve it to support binary mode only for parameter with certain name.

Currently I'm in favor of the first option for the following reasons:

  • transporting binary data is rare
  • users can very easily just use $_GET['binaryData'] or $_POST['binaryData'] – its ugly but practical
  • users can implement wrapper around RequstFactory which would allow specifying that certain parameters should be treated as binary.

Thoughts? cc @dg, @fprochazka


Note: If we choose the remove the binary mode entirely with the vision that users may implement custom wrapper around RequestFactory we may no longer throw exception (see #30 for related discussion) for invalid parameters.

@fprochazka
Copy link
Contributor

My only contribution to this discussion would be stating that I've never needed to allow binary on RequestFactory, which is by itself not an argument for removing it :) I really have no idea what is it good for.

Now that I think about it, I usually transfer binary data using base64_encode.

Ideal would be to find somebody who is using it.

@dg
Copy link
Member

dg commented Dec 18, 2014

Binary mode is not intended for transfering single parameter, it makes RequestFactory able to work with non-utf8 encodings.

@JanTvrdik
Copy link
Contributor Author

I didn't know that, the name is confusing. What are the real-word use cases when you would enable binary mode? When designing an API for somebody who is not enable to send you UTF-8?

@dg
Copy link
Member

dg commented Dec 18, 2014

Real-world use case is each web with non-utf8 encoding.

@mishak87
Copy link

@dg What was there reason to remove support for other encodings. Binary only seems bit unsafe (everyone has to count with it while working with presenters and so on).

@dg
Copy link
Member

dg commented Dec 18, 2014

Nette supports only utf-8 since 2.0. It doesn't prevent when you want to use other encoding, but either doesn't help you.

@JanTvrdik
Copy link
Contributor Author

I'm wondering if there is a single Nette application that uses non-utf-8 encoding. Because for example you cannot use Latte with non-utf-8 encoding. There is not a single setBinary mention on forum.

@dg What is your decision – can I remove the binary mode entirely or do you think we should keep it and close therefore this issue?

@dg
Copy link
Member

dg commented Dec 18, 2014

I think it can be removed in next big version, but now it is unnecessary BC break.

@JanTvrdik
Copy link
Contributor Author

Ok, closing for now. I'll put it on my list of things to do in Nette 3.

@dg
Copy link
Member

dg commented Dec 19, 2014

Why closing?

@JanTvrdik
Copy link
Contributor Author

Because it's won't fix for know because you have not yet opened a branch that can accept this change.

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

4 participants