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

fix: verify length and hashes of fetched bytes before parsing #325

Merged
merged 7 commits into from
Jun 23, 2022

Commits on Jun 23, 2022

  1. feat: add func to util for comparing raw bytes

    Add BytesMatchLenAndHashes() to verify that fetched bytes match the
    expected length and hashes.
    This is useful to check data before parsing.
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed Jun 23, 2022
    Configuration menu
    Copy the full SHA
    ec385b2 View commit details
    Browse the repository at this point in the history
  2. fix: verify snapshot's len and hashes before parsing

    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed Jun 23, 2022
    Configuration menu
    Copy the full SHA
    0c35db7 View commit details
    Browse the repository at this point in the history
  3. fix: verify targets' len and hashes before parsing

    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed Jun 23, 2022
    Configuration menu
    Copy the full SHA
    0f0388a View commit details
    Browse the repository at this point in the history
  4. feat: export version comparison utility function

    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed Jun 23, 2022
    Configuration menu
    Copy the full SHA
    2be2882 View commit details
    Browse the repository at this point in the history
  5. fix: only check version after parsing fetched ss and ts

    We check the length and hashes of the fetched bytes before parsing them,
    therefore once the data are parsed into a FileMeta we only need to check
    against the expected version. The length and hashes checks are no longer
    required at this point, as they have already been done.
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed Jun 23, 2022
    Configuration menu
    Copy the full SHA
    d73f89f View commit details
    Browse the repository at this point in the history
  6. fix: remove spurious length check

    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed Jun 23, 2022
    Configuration menu
    Copy the full SHA
    39b9b0f View commit details
    Browse the repository at this point in the history
  7. chore: test newly exported util functions

    Add tests for newly exported functions in the util package:
    * VersionEqual() - simple test of version number comparison
    * BytesMatchLenAndHashes() - check function returns appropriate errors
      when incorrect length, hashes, or both are passed
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed Jun 23, 2022
    Configuration menu
    Copy the full SHA
    af46f5d View commit details
    Browse the repository at this point in the history