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

add length check to vouch text #178

Merged
merged 2 commits into from Apr 9, 2020
Merged

add length check to vouch text #178

merged 2 commits into from Apr 9, 2020

Conversation

mmou
Copy link
Contributor

@mmou mmou commented Apr 8, 2020

this is branched off of #177, so merge that first

@mmou mmou requested review from heronhaye and mlsteele April 8, 2020 22:29
@mmou mmou mentioned this pull request Apr 8, 2020
Copy link
Contributor

@heronhaye heronhaye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm after snake_case and test fix

src/schema3.iced Outdated
_check : ({path, obj}) ->
if typeof(obj) isnt 'string' or obj.length is 0 then return mkerr path, "value must be a string"
if @_args? and @_args.maxLength?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use snake_case in iced

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you like, you can do if (max_length = @_args?.max_length)? as well, then use that value in the next block

verifier = alloc out.inner.obj.body.type, me
varg = { armored : out.armored, skip_ids : true, make_ids : true, inner : out.inner.str, expansions : out.expansions, require_packet_hash :true}
await verifier.verify_v2 varg, defer err
T.assert err?, "expecting error"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should check the specific type of error. seems to be a bit annoying in this case (thanks javascript), maybe you can just T.assert err?.message.includes("vouch.confidence.other")

(but @mlsteele may have a stronger opinion)

@mmou mmou merged commit ec534da into master Apr 9, 2020
@mmou mmou deleted the mmou/PICNIC-1059-len branch April 9, 2020 17:37
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

Successfully merging this pull request may close these issues.

None yet

3 participants