Skip to content

Should S108 be detected in tempfile.TemporaryDirectory(dir="/dev/shm")? #6355

@mihaic

Description

@mihaic

Considering the following contents of issue.py (no other files, no pyproject.toml):

import tempfile

with tempfile.TemporaryDirectory(dir="/dev/shm") as tmp:
    pass

S108 is detected:

ruff check --select S108 --isolated issue.py
issue.py:3:38: S108 Probable insecure usage of temporary file or directory: "/dev/shm"
Found 1 error.

Shouldn't the usage of TemporaryDirectory preclude S108?

ruff --version
ruff 0.0.282

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedReady for implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions