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

Increase role http error and test quality #222

Merged
merged 5 commits into from
Mar 15, 2024

Commits on Mar 8, 2024

  1. check action against policy on access check

    This updates access check requests to ensure the requested action exists
    in the policy for the provided resource beforce executing the request to
    spicedb and failing for this error.
    
    Knowing this we can return a relevant error (ErrInvalidAction) which we
    can now handle and return a 400 Bad Request status code instead of the
    previous 500 Internal Server Error status code we were returning due to
    the spicedb error we were receiving before.
    
    Signed-off-by: Mike Mason <[email protected]>
    mikemrm committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    b635853 View commit details
    Browse the repository at this point in the history
  2. handle context canceled request 500 errors

    Context Canceled errors from http requests should not produce 500 errors
    as those are client requests.
    This change adds an error middleware which can capture the canceled
    context error and return a 422 status instead.
    
    Signed-off-by: Mike Mason <[email protected]>
    mikemrm committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    2b918d1 View commit details
    Browse the repository at this point in the history
  3. validate create/update role actions requests

    This validates create/update role action requests before submitting the
    request to spicedb and handles the errors gracefully by returning 400
    errors instead of generic 500 errors to the client.
    
    Signed-off-by: Mike Mason <[email protected]>
    mikemrm committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    7f9726c View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2024

  1. handle role http errors better and add http tests

    This handles role http endpoint errors better by better handling the
    errors returned and setting the response status codes.
    
    Additionally this adds testing to the http api so we may test these http
    status codes to ensure they are working as we expect.
    
    Signed-off-by: Mike Mason <[email protected]>
    mikemrm committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    5d0f308 View commit details
    Browse the repository at this point in the history
  2. fix and add tests for role assignment endpoints

    This adds http tests and fixes the http status codes for the role
    assignment and unassignment endpoints to resolve 500 errors occurring
    when provided role ids were didn't exist.
    
    Signed-off-by: Mike Mason <[email protected]>
    mikemrm committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    a61e1f6 View commit details
    Browse the repository at this point in the history