Urgent.News

One page, thousands of outlets. See who else covered it.

Editions

Tech

Permission Audit CLI: Find World-Writable Files in Python

Permission Audit CLI: A Minimal Tool for Security Reviews and Compliance Checks Security audits, compliance reviews, or permission normalization—how do you efficiently check which files need attention? This CLI tool reports file permissions (octal modes) and flags world-writable files that violate principle-of-least-access policies. Uses only Python standard library. What It Does Permission…

This CLI tool, named perm-audit, is designed to assist with security audits and compliance checks by identifying files with improper file permissions on a filesystem. It provides a minimal and efficient way to detect world-writable files and other permission-related issues using only Python's standard library. The tool can be installed by simply copying the perm-audit.py script to a location within the system's PATH, such as /usr/local/bin/perm-audit, and then granting it execute permissions with chmod +x.

When run, the tool scans a specified directory and reports on the file permissions in octal format, such as 644, 755, and 0600. It flags world-writable files and group-writable files, which could potentially pose security risks. The tool also highlights when the file's UID (user ID) differs from the real user, indicating that there might be leftover write access after cleanup or when an elevated process created the file.

The output can be presented in two modes: a compact summary mode that shows the count of files for each permission mode, or a verbose listing mode that provides more detailed information about each file, including its path, permissions, and whether it is executable or writable. This detailed mode is particularly useful for spotting unusual permissions across a directory tree and quickly identifying files that may need attention.

The tool is especially useful for security audits before deployments or migrations, CI/CD checks that fail on files with overly permissive permissions (like 0777), team directory reviews to ensure shared folders have proper group access, and regulatory compliance by documenting file states according to specific policies. Installation is straightforward and does not require any additional packages via pip, making it easy to drop the script into any location and run it.

Overall, this tool streamlines the process of auditing file permissions on a filesystem, providing a clear and concise overview of potential security issues in an easy-to-read format.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Thursday 20 August →