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

Improve error reporting in JsThemis #384

Merged
merged 27 commits into from
Feb 19, 2019
Merged

Commits on Feb 18, 2019

  1. Error reporting helpers

    Add some functions to help with error reporting. They provided unified
    error message format and convert Themis status code into human-readable
    strings.
    
    Secure Session and Secure Comparator code are handled separately
    because some of their values overlap with generic codes.
    ilammy committed Feb 18, 2019
    Configuration menu
    Copy the full SHA
    db104c1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2c17f16 View commit details
    Browse the repository at this point in the history
  3. Secure Message: length and type checks for arguments

    Keys and messages must be non-empty. Themis does check for that but
    it returns a generic 'invalid parameter' error. Perform early checks
    and report more accurate errors.
    
    Furthermore, check the argument count and their types and report
    appropriate errors as well. Otherwise we risk crashing node.js process
    due to assertion failure in node::Buffer::Data().
    ilammy committed Feb 18, 2019
    Configuration menu
    Copy the full SHA
    9a1f5de View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9a9d27e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8bba743 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6bafbb4 View commit details
    Browse the repository at this point in the history
  7. Secure Cell: tests for empty arguments

    Rename "empty" variable to use distinct names across the tests because
    this "this" thing in JavaScript is magic.
    ilammy committed Feb 18, 2019
    Configuration menu
    Copy the full SHA
    39f753a View commit details
    Browse the repository at this point in the history
  8. Use THEMIS_FAIL as initial status value

    Co-Authored-By: ilammy <[email protected]>
    vixentael and ilammy committed Feb 18, 2019
    Configuration menu
    Copy the full SHA
    a41d268 View commit details
    Browse the repository at this point in the history
  9. Use full sentence in messages

    Co-Authored-By: ilammy <[email protected]>
    vixentael and ilammy committed Feb 18, 2019
    Configuration menu
    Copy the full SHA
    fe575d8 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    cc6d699 View commit details
    Browse the repository at this point in the history
  11. Improve error messages, simplify calls

    Use more descriptive error messages which suggestions on how to fix
    the error. Drop the superfluous error code parameter which is always
    the same. We're going to use these short forms only for parameter
    validation anyway.
    ilammy committed Feb 18, 2019
    Configuration menu
    Copy the full SHA
    4a1b5bd View commit details
    Browse the repository at this point in the history
  12. Don't check exception content

    We're going to improve the exception error messages so remove all these
    hardcoded "invalid parameter" strings for now. We'll replace that with
    some error verification callback later.
    ilammy committed Feb 18, 2019
    Configuration menu
    Copy the full SHA
    67b1299 View commit details
    Browse the repository at this point in the history
  13. Return original Themis status code

    If we have a status code, add it as a "code" property to the Error
    object we throw. Verify the code in tests where appropriate.
    ilammy committed Feb 18, 2019
    Configuration menu
    Copy the full SHA
    27fe0dc View commit details
    Browse the repository at this point in the history
  14. Retain status code for early errors

    Add THEMIS_INVALID_PARAMETER status code to all early parameter checks
    that we perform. Now all Themis errors will have a "code" property.
    Rename the helper function accordinly.
    ilammy committed Feb 18, 2019
    Configuration menu
    Copy the full SHA
    765f2ec View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    3f187da View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    f6b733e View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    74aaa6f View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    bc9786b View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    af03452 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    755e2d4 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    7b29e2c View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    5ae5d6f View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    d24b49a View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2019

  1. Pin mocha to 5.2.0

    Recently released mocha 6.0.0 is not compatible with Node in our CI
    environment. Pin the version to ^5.2.0 while it is still available.
    ilammy committed Feb 19, 2019
    Configuration menu
    Copy the full SHA
    6caa83c View commit details
    Browse the repository at this point in the history
  2. Avoid using deprecated NAN methods

    Call() method on callbacks has been deprecated, it is suggested to use
    Nan::Call() function for synchronous calls. Do this to avoid warnings
    about using deprecated API, who knows when it's going to be removed.
    ilammy committed Feb 19, 2019
    Configuration menu
    Copy the full SHA
    593dedb View commit details
    Browse the repository at this point in the history
  3. Secure Session: add checks to pubkey callback

    It turned out that public key callback did not have enough checks and
    could crash Node process if the user returns unexpected value from it.
    Add type checks for result: an array is okay, null and undefined are
    explicit "not found" values, anything else is also considered "not
    found" but with a different error code (the exact value does not matter
    at the moment). Also add a length check to avoid buffer overflow when
    doing memcpy().
    ilammy committed Feb 19, 2019
    Configuration menu
    Copy the full SHA
    6a6b540 View commit details
    Browse the repository at this point in the history
  4. Revert accidental changes

    Commit 6caa83c contains local changes
    which were not intended to be committed. Revert them.
    ilammy committed Feb 19, 2019
    Configuration menu
    Copy the full SHA
    a437395 View commit details
    Browse the repository at this point in the history