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

topdown/json: Fix panic in json.filter on empty JSON paths. #5200

Commits on Sep 29, 2022

  1. topdown/json: Fix panic in json.filter on empty JSON paths.

    This commit fixes a panic discovered in the `json.filter` builtin that
    could be triggered with an empty JSON path parameter, such as `""`. This
    panic was caused by indexing logic in a helper function always assuming
    it had at least one path segment to work with, and thus indexing
    out-of-bounds when no path segment was present.
    
    The issue was fixed by adding an extra check to the helper function for
    the null path case, and adding new unit tests to check for the issue.
    
    Fixes: open-policy-agent#5199
    
    Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
    philipaconrad committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    d1acc16 View commit details
    Browse the repository at this point in the history
  2. topdown/json: Add clarifying comments.

    Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
    philipaconrad committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    586185d View commit details
    Browse the repository at this point in the history