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

Admin->Basic Configuration: Receiver name can be arbitrarily long #21

Closed
fpietrosanti opened this issue Feb 22, 2013 · 10 comments
Closed

Comments

@fpietrosanti
Copy link
Contributor

The Receiver name created can be artbitrarly long.

The length should be set to a maximum.

Both the client and the server accept a very long string like:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

@vecna
Copy link
Contributor

vecna commented Feb 23, 2013

Ok, I'm ready to fix this.

I can put a limit, that if overcome would return an error (e.g. > than 40 unicode char length, return InvalidInputFormat error) but this perhaps need to be written in the "hint" of the client.

plus, this check would be performed also in email ( > 40), password ( < 6 and > 40) and description ( > 400)

sounds fine as hard coded limits ?

@hellais @fpietrosanti @evilaliv3

@fpietrosanti
Copy link
Contributor Author

Sounds fine to me

@fpietrosanti
Copy link
Contributor Author

@hellais can you also put a cap/limit on the client-side?

@hellais
Copy link
Contributor

hellais commented Feb 23, 2013

Why do we need to have limits to the size of inputs?

I mean these inputs are things that are configurable by the node admin. If the node admin wants to have a receiver description of more than 400 chars I don't see why we should prohibit them from doing so.

If there are some fields that should be of a certain length because they look better, then we should identify them and provide some visual feedback to the user as to how much text the should be inputting in the textarea/input box.

@fpietrosanti
Copy link
Contributor Author

Good, anyhow we should have limits for certain fields's size.

Due to the fact that this does only impact the "visualization" of elements, we may just put those limits into GLClient without enforcing it on GLBackend.

That way the fields that should reasonably have a maximum limits will be client side (i mean, like the name of receiver, that's the one for which i just opened the ticket).

@vecna
Copy link
Contributor

vecna commented Feb 25, 2013

I'll put those limits checks, and the maximum size would be configurable in the settings (now) and in the configure (when it came to be implemented, shortly) or in the admin web page (if requested). I agree that the limits need to be configurable, but at the moment is missing also the part of code that accept those data (I believe the best way is to implement the validation function in Storm), then need to be done.

@hellais
Copy link
Contributor

hellais commented Feb 25, 2013

@hellais
Copy link
Contributor

hellais commented Feb 25, 2013

For the time being lets just stick to validating the length of the name of the receivers.

@hellais hellais closed this as completed Feb 25, 2013
@vecna
Copy link
Contributor

vecna commented Feb 25, 2013

... this is wrong, if I make a pentest on this app, the second POST I made is composed of two megabyte of data :)

  def test_5_create_huge_submission(self):
       submission_request = dict(SubmissionTest.aSubmission)

       submission_request['receivers'] = [ SubmissionTest.receiver_used['receiver_gus']  ]
       submission_request['context_gus'] = SubmissionTest.context_used['context_gus']
       submission_request['wb_fields']['headline'] = unicode("A" * 1000 * 1000)
       submission_request['wb_fields']['Sun'] = unicode("B" * 1000 * 1000)
       submission_request['finalize'] = True

It works! but, is what we want ?

@vecna vecna reopened this Feb 25, 2013
@vecna
Copy link
Contributor

vecna commented Mar 7, 2013

Implemented validator for Storm, in:
https://github.com/globaleaks/GLBackend/commit/42e3b277d49bb2a1f99bd908195bfe8bb5da6910 and tested.

now there are three hardcoded limits:

  1. the "name" fields need to be > than 0 and < than 128
  2. the "description" fiels need to be < than 1024
  3. all the unicode values, inside a dict or directly in the DB, had a limit of 2048

Those limits are written in settings.py, and checked before save in the DB a certain value.

@vecna vecna closed this as completed Mar 11, 2013
hellais pushed a commit to hellais/GLBackend that referenced this issue Sep 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants