truchain icon indicating copy to clipboard operation
truchain copied to clipboard

Added the validation for the argument body max count

Open mohitmamoria opened this issue 5 years ago • 5 comments

  • [ ] Linked to Github issues that this PR fixes (if any)
  • [ ] Wrote tests
  • [ ] Updated README.md if needed
  • [ ] Updated docs/spec if needed
  • [x] Tested running truchain, truapi, and truapp locally (https://gist.github.com/shanev/3897a80072ac4147677fa596ada497fb)

Works with https://github.com/TruStory/truapp/pull/84 in truapp.

mohitmamoria avatar Oct 03 '19 07:10 mohitmamoria

Not really sure if we want the chain to be content specific aware , in this case markdown. I think the solution previously discussed was increasing the limit in the chain but keep it in the client (truapi/truapp) and the limit could be checked in truapi (strip markdown, etc), not really sure how well this would work

thoughts @shanev ?

jhernandezb avatar Oct 03 '19 16:10 jhernandezb

Maybe in the future the chain can accept different content types, but for now importing a markdown library limits the generality of the blockchain. Other clients should be free to use HTML or whatever text based content type they want. So I say we go with the solution we talked about previously of making the length fixed on the chain, and adding smarts to the client to not go over this limit. Lowers attack vectors as well.

shanev avatar Oct 03 '19 17:10 shanev

Maybe in the future the chain can accept different content types, but for now importing a markdown library limits the generality of the blockchain. Other clients should be free to use HTML or whatever text based content type they want. So I say we go with the solution we talked about previously of making the length fixed on the chain, and adding smarts to the client to not go over this limit. Lowers attack vectors as well.

I propose:

  1. Update this PR and remove strip markdown, but check that argument length <= ArgumentBodyMaxLength
  2. 5000 characters argument body limit on chain (can update using CLI)
  3. 1500 stripped markdown character limit on client

truted avatar Oct 03 '19 19:10 truted

Codecov Report

Merging #804 into develop will decrease coverage by 0.02%. The diff coverage is 0%.

@@             Coverage Diff             @@
##           develop     #804      +/-   ##
===========================================
- Coverage    58.78%   58.76%   -0.03%     
===========================================
  Files           73       73              
  Lines         4164     4166       +2     
===========================================
  Hits          2448     2448              
- Misses        1507     1508       +1     
- Partials       209      210       +1

codecov[bot] avatar Oct 04 '19 06:10 codecov[bot]

Okay, so I have updated this PR to check the body length. Would request @shanev to update the params on the beta and devnet (so that I don't mess something up).

Have overridden this limit on the client in https://github.com/TruStory/truapp/pull/84.

mohitmamoria avatar Oct 04 '19 06:10 mohitmamoria