AmbireTech / adex-validator-stack-rust

The Ambire AdEx Validator Stack implemented in Rust: sentry, validator worker, adapter, adview manager
https://adex.network
GNU Affero General Public License v3.0
11 stars 10 forks source link

Input validation #8

Closed elpiel closed 5 years ago

elpiel commented 5 years ago

We need a way to validate the input data from the request to make sure it is valid according to our domain. E.g. Channel should always be created with a positive deposit amount.

Ivshti commented 5 years ago

The JS validator stack has two kinds of validation

Type (schema validation - this is not needed in rust since serde does it implicitly; this includes stuff like “this number should be >=0”; this should be done by enforcing it on a type level: all BigNums in AdEx should be >=0 anyway

The second type of validation is “adapter validation”: checks that are specific to an adapter; for example, whether a channel is on the ethereum blockchain; this validation should be performed by an async function that each adapter exports

On Fri, 10 May 2019 at 10:24, Lachezar Lechev notifications@github.com wrote:

We need a way to validate the input data from the request to make sure it is valid according to our domain. E.g. Channel should always be created with a positive deposit amount.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AdExNetwork/adex-validator-stack-rust/issues/8, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJQTDIW2B7EAIXC3IJF3QTPUUPKZANCNFSM4HMAQ4AQ .

--

[image: photo] Ivo Georgiev Founder & CEO, Stremio

https://www.stremio.com http://www.stremio.com

GPG: AC692BE9EB6E024B5C58A8EAC1E94996BC56BACE http://www.stremio.com http://www.facebook.com/stremio/ http://twitter.com/stremio http://www.instagram.com/stremioofficial/ http://www.reddit.com/r/Stremio/ http://blog.stremio.com/

https://play.google.com/store/apps/details?id=com.stremio.beta https://itunes.apple.com/us/app/stremio/id987232010?mt=8

elpiel commented 5 years ago

Sadly atm we cannot propagate and handle the Errors from the (de)serialization of serde: https://github.com/AdExNetwork/adex-validator-stack-rust/issues/7#issue-442572175 This limit us to not show the concrete error if the validation fails, but I would leave this opened so that we can fix this once tower-web gives us the option or we switch to framework that gives us that option.

elpiel commented 5 years ago

No need for this any more.