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 more debugging info #83

Merged
merged 10 commits into from
Dec 4, 2016
Merged

Add more debugging info #83

merged 10 commits into from
Dec 4, 2016

Conversation

dinoboff
Copy link
Collaborator

@dinoboff dinoboff commented Nov 13, 2016

Print the each expression evaluation result; e.g., with chai:

2) A valid set of security rules and data can have write errors:
   AssertionError: Expected a user authenticated via Password Login to be able to write true to users/password:500f6e96-92c6-4f60-ad5d-207253aee4d3/innocent, but the rules denied the write.
    /users/password:500f6e96-92c6-4f60-ad5d-207253aee4d3: write "auth !== null && root.child('users').child(auth.uid).child('king').val() === true"  => false
      (
        auth !== null  [=> true]
        && root.child("users").child(auth.uid).child("king").val() === true  [=> false]
      )  [=> false]
      using [
        auth = {"uid":"password:500f6e96-92c6-4f60-ad5d-207253aee4d3","id":1,"provider":"password"}
        auth.uid = "password:500f6e96-92c6-4f60-ad5d-207253aee4d3"
        root = {"path":"","exists":true}
        root.child('users') = {"path":"users","exists":true}
        root.child('users').child(auth.uid) = {"path":"users/password:500f6e96-92c6-4f60-ad5d-207253aee4d3","exists":true}
        root.child('users').child(auth.uid).child('king') = {"path":"users/password:500f6e96-92c6-4f60-ad5d-207253aee4d3/king","exists":false}
        root.child('users').child(auth.uid).child('king').val() = null
      ]

    /users/password:500f6e96-92c6-4f60-ad5d-207253aee4d3/innocent: validate "data.parent().child('on-fire').val() === false"  => false
      data.parent().child("on-fire").val() === false  [=> false]
      using [
        data = {"path":"users/password:500f6e96-92c6-4f60-ad5d-207253aee4d3/innocent","exists":false}
        data.parent() = {"path":"users/password:500f6e96-92c6-4f60-ad5d-207253aee4d3","exists":true}
        data.parent().child('on-fire') = {"path":"users/password:500f6e96-92c6-4f60-ad5d-207253aee4d3/on-fire","exists":false}
        data.parent().child('on-fire').val() = null
      ]

    No .write rule allowed the operation.
    One or more .validate rules disallowed the operation.
    write was denied.
    at Assertion.<anonymous> (plugins/chai.js:98:12)
    at Assertion.ctx.(anonymous function) [as path] (node_modules/chai/lib/chai/utils/addMethod.js:41:25)
    at Context.<anonymous> (docs/chai/examples/failing.js:25:9)

@dinoboff dinoboff added this to the 3.0 milestone Nov 13, 2016
@dinoboff dinoboff force-pushed the feature-inspect branch 4 times, most recently from 397449b to 13ae7ba Compare November 14, 2016 08:14
@dinoboff dinoboff merged commit 8f36b79 into goldibex:next Dec 4, 2016
@dinoboff dinoboff deleted the feature-inspect branch December 4, 2016 15:00
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.

1 participant