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 --sandbox flag to prevent dynamic loading of other files/data. #3092

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Apr 12, 2024

  1. Add --sandbox flag to prevent dynamic loading of other files/data.

    Some use cases for `jq` may involve accepting untrusted input.
    See discussion in jqlang#1361 for some security considerations that
    may be relevant for those use cases.
    
    This commit adds a `--sandbox` flag which is meant to mitigate
    one category of security issue with untrusted input:
    features of jq which are meant to let the jq filter access
    files/data other than the direct input data given to the CLI.
    
    Specifically, the new `--sandbox` flag blocks the implicit
    loading of `$HOME/.jq`, and also blocks the use of
    `import` and `include` for loading other `jq` files.
    
    If other features are added to `jq` in the future which allow
    for reading files/data as part of the filter syntax, it is
    intended that the `--sandbox` flag would also gate access to those.
    jemc committed Apr 12, 2024
    Configuration menu
    Copy the full SHA
    45ac611 View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2024

  1. Update --sandbox flag behavior to clear environment variables.

    In a security-sensitive environment where the `--sandbox` flag
    can be used to mitigate some categories of threats from untrusted
    filter code and/or untrusted JSON data, it is also desirable
    to prevent leaking environment variable values (which often
    can include secrets in some environments).
    
    This commit does so by updating the behavior of `--sandbox` to
    also clear the environment variables seen by the jq filter code
    in the `$ENV` value and `env` builtin.
    jemc committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    c39f447 View commit details
    Browse the repository at this point in the history