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

feat: add option to skip def_ws prefix in sarif reports #2383

Commits on Apr 9, 2023

  1. feat: add option to skip def_ws prefix in sarif reports

    This PR is a suggestion for solving the use case
    of needing to remove the DEFAULT_WORKSPACE from
    the out put in the generated SARIF output.
    (oxsecurity#2006).
    
    It moves the SARIF logic to an earlier phase, to be handled
    before the aggregate SARIF generation.
    It replaces the prefix if the flag
    SARIF_REPORTER_NORMALIZE_LINTERS_OUTPUT: true is set
    (default: true).
    
    Implementation is done by line parsing and replacing,
    as a node traversal solution quickly grew due to
    the many places in the sarif out put the uri can be found
    (metris, relatedLocations, and so on), and the code
    is much simpler this way to maintain.
    
    Improvements and suggestions:
    Could dumps and resulting json string be used in
    a reliable way to line parse an json file? I didn't
    find a good way.
    Should the option be renamed to
    SARIF_REPORTER_DISABLE_DEFAULT_WORKSPACE_IN_OUTPUT
    or alike. As the pre existing normalization still happens?
    (We don't change that pre existing behaviour in this PR,
    only the DEFAULT_WORKSPACE prefix part).
    
    Signed-off-by: Josef Andersson <josef.andersson@gmail.com>
    janderssonse committed Apr 9, 2023
    Copy the full SHA
    94130ea View commit details
    Browse the repository at this point in the history