Skip to content

Issues sorted by severities #9

@satoridev01

Description

@satoridev01

Ciao!

After executing pyspector scan . --ai I get the list of findings, each with its own severity. If the issues were to be listed under severity titles, less lines would be printed to the stdout and it would be easier to read the findings if they are sorted from CRITICAL, HIGH, MEDIUM to LOW.

Current output:

[*] Total issues after deduplication: 1311

[+] Rule ID: DIR735
    Description: Directory traversal vulnerability in file path.
    Severity: HIGH
    File: /data/tmp.bMpqhvFG05/pelican/docs/conf.py:15
    Code: `with open("../pyproject.toml", "rb") as f:`

[+] Rule ID: FSTRING867
    Description: Potential code injection through f-string formatting.
    Severity: MEDIUM
    File: /data/tmp.bMpqhvFG05/pelican/docs/conf.py:37
    Code: `project_copyright = f"2010–{year}"  # noqa: RUF001`

[+] Rule ID: FSTRING867
    Description: Potential code injection through f-string formatting.
    Severity: MEDIUM
    File: /data/tmp.bMpqhvFG05/pelican/docs/conf.py:52
    Code: `html_title = f"<strong>{project}</strong> <i>{release}</i>"`

[+] Rule ID: FSTRING867
    Description: Potential code injection through f-string formatting.
    Severity: MEDIUM
    File: /data/tmp.bMpqhvFG05/pelican/pelican/__init__.py:197
    Code: `f"Done: Processed {pluralized_articles}, {pluralized_drafts}, {pluralized_hidden_articles}, {pluralized_pages}, {pluralized_hidden_pages} and {pluralized_draft_pages} in {time.time() - 
start_time:.2f} seconds."`

Suggested output:

[*] Total issues after deduplication: 1311

[+] Severity: HIGH
[+] Rule ID: DIR735
    Description: Directory traversal vulnerability in file path.
    File: /data/tmp.bMpqhvFG05/pelican/docs/conf.py:15
    Code: `with open("../pyproject.toml", "rb") as f:`

[+] Severity: MEDIUM
[+] Rule ID: FSTRING867
    Description: Potential code injection through f-string formatting.
    File: /data/tmp.bMpqhvFG05/pelican/docs/conf.py:37
    Code: `project_copyright = f"2010–{year}"  # noqa: RUF001`

[+] Rule ID: FSTRING867
    Description: Potential code injection through f-string formatting.
    File: /data/tmp.bMpqhvFG05/pelican/docs/conf.py:52
    Code: `html_title = f"<strong>{project}</strong> <i>{release}</i>"`

[+] Rule ID: FSTRING867
    Description: Potential code injection through f-string formatting.
    File: /data/tmp.bMpqhvFG05/pelican/pelican/__init__.py:197
    Code: `f"Done: Processed {pluralized_articles}, {pluralized_drafts}, {pluralized_hidden_articles}, {pluralized_pages}, {pluralized_hidden_pages} and {pluralized_draft_pages} in {time.time() - 
start_time:.2f} seconds."`

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions