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

Change source file paths to be relative to input #101

Closed
willarmiros opened this issue Feb 7, 2024 · 0 comments · Fixed by #104
Closed

Change source file paths to be relative to input #101

willarmiros opened this issue Feb 7, 2024 · 0 comments · Fixed by #104
Assignees
Labels
enhancement New feature or request

Comments

@willarmiros
Copy link
Member

  1. Add new attribute in JSON report for absolute_path, which provides the absolute path of the input path provided by the user. This will make it clearer what is being resolved if the user provides a relative path as the input_path. IMPORTANT: If the input_path is to a file, the absolute_path should be the absolute path to the directory that file is in.
  2. In the source, scanned_files, and skipped_files fields, only reference file paths relative to the input path. For example, if the input path is /path/to/my/directory, and the directory has model1.pkl and model2.pkl, then output may look like this:
{
    "summary": {
        "total_issues_by_severity": {
            "LOW": 0,
            "MEDIUM": 0,
            "HIGH": 1,
            "CRITICAL": 0
        },
        "total_issues": 2,
        "input_path": "/tmp/test_model",
        "absolute_path": "/path/to/my/directory",
        "modelscan_version": "0.1",
        "timestamp": datetime.datetime.now(),
        "skipped": {
            "total_skipped": 0,
            "skipped_files": []
        },
        "scanned": {
            "total_scanned": 2,
            "scanned_files": ["model1.pkl", "model2.pkl"]
        }
    },
    "issues": [
        {
            "description": "Use of unsafe operator 'get' from module 'requests.api'",
            "operator": "get",
            "module": "requests.api",
            "source": "model1.pkl",
            "scanner": "pytorch",
            "severity": "HIGH"
        }
    ],
    "errors": []
}

If the input path is a file, then the source, scanned_files, and skipped_files fields can all just be the file name (no absolute path).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants