Cook icon indicating copy to clipboard operation
Cook copied to clipboard

Setting quota or share: non-positive values silently ignored

Open DaoWen opened this issue 8 years ago • 1 comments

Posting to the /quota or /share endpoints with a resource value that's negative or zero doesn't result in the correct behavior.

  • #1: Negative values are silently ignored. Expected behavior would be a 400 error.
    • [x] /quota
    • [x] /share
  • #2: Values set to zero are silently ignored. These should be allowed.
    • [x] /quota
    • [ ] /share
  • #3: Providing a non-positive value can also result in other positive values provided in the same query to be silently dropped. This is due to a logic error in the loop base case.
    • [x] /quota
    • [ ] /share

With regard to #3 above, it might be worthwhile to do an audit of anywhere that loop is used in the codebase to check for similar logic errors. In this case, it appears that replacing the loop with mapcat or another higher-order function would result in clearer (and correct) code.

DaoWen avatar Jan 19 '18 14:01 DaoWen

#689 fixes the issues above for the /quota endpoint:

  • Negative values are now disallowed (enforced by the schema). Fixes #1 for both endpoints.
  • Zero values are no longer ignored on the /quota endpoint. Fixes #2 for quota only.
  • Values are no longer silently dropped on the /quota endpoint. Fixes #3 for quota only.

DaoWen avatar Jan 19 '18 14:01 DaoWen