safe-netrc
Safe netrc file parser
What it is and what it does
Safe-netrc is a drop-in replacement for Python's standard library netrc parser that adds stricter security and flexibility. It extends the netrc.netrc class to enforce file permissions checks and allows the netrc file path to be specified via the NETRC environment variable instead of always defaulting to ~/.netrc. The package backports permission validation that was added to the standard library in Python 3.1, ensuring consistent security behavior across Python versions.
The package is intended for applications that need to read authentication credentials from netrc files while maintaining strict security posture. It has no external runtime dependencies and installs as a pure Python wheel, making it lightweight and portable. However, the project is no longer actively maintained—the last release was in November 2022.
Use it for:
- Secure credential lookup in CLI tools or scripts that need to authenticate with remote services using netrc files.
- Enforcing strict file permissions on credential files to prevent accidental exposure of passwords.
- Allowing deployment scripts to override the default netrc location via NETRC environment variable for non-standard configurations.
- Backporting secure netrc parsing to Python 3.7–3.9 environments where standard library behavior may differ.
- Validating netrc file permissions in security-sensitive applications before attempting to read credentials.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a safer subclass of Python's standard netrc parser that enforces strict file permissions and supports custom netrc file paths via environment variable.
Yes, if you need secure netrc parsing with strict permissions checks and environment-variable path override in a Python 3.7+ application. The package is stable and has no known vulnerabilities, but be aware it is abandoned and will not receive updates. Use it only if the current behavior meets your needs and you do not expect future maintenance.
Install
safe-netrc on PyPI
pip
pip install safe-netrcuv
uv add safe-netrcpoetry
poetry add safe-netrcInstalling safe-netrc
Before you install
Low friction: pure Python wheel with no runtime dependencies. However, the package is abandoned—last release was 2022-11-29, over 1354 days ago. No active maintenance or security updates.
License in practice
GPL-2.0-or-later is a copyleft license requiring derivative works to be licensed under compatible terms. Any code that imports and modifies this package must be released under GPL-2.0-or-later or a compatible license.
Quickstart
pip install safe-netrc
from safe_netrc import netrc
auth = netrc()
login, _, password = auth.authenticators('example.com')
Requires Python 3.7 or later. The netrc file must have restrictive permissions or the parser will reject it.
Verify before relying
- Whether the abandoned status affects real-world use cases where netrc handling is stable and rarely needs updates.
- Specific permission requirements the parser enforces on netrc files.
- Whether permissions-check backport from Python 3.1 remains relevant given current Python version support (3.7+).
Package facts
| License | GPL-2.0-or-later (copyleft) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,354 days since the last release |
| First released | |
| Downloads | 93,230/month — #13,397 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: safe_netrc-1.0.1-py3-none-any.whl
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
tinynetrcRead, parse, and write .netrc credential files…
permissive · top 15,000 on PyPI
tarsafeTarsafe wraps Python's tarfile module to…
permissive · top 15,000 on PyPI
robocorp-vaultProvides read and write access to secrets…
permissive · top 15,000 on PyPI
requests-credsspAdds CredSSP authentication support to the…
permissive · top 15,000 on PyPI
certifi-linuxRedirects certifi's certificate lookup to use…
permissive · top 15,000 on PyPI
pyspnegoHandles SPNEGO, NTLM, Kerberos, and CredSSP…
permissive · top 1,000 on PyPI
keyringKeyring provides safe password and credential…
permissive · top 1,000 on PyPI
path.pyProvides Path objects that wrap filesystem…
permissive · top 15,000 on PyPI
keeper-secrets-manager-corePython SDK for Keeper Secrets Manager that…
permissive · top 15,000 on PyPI
pathProvides Path objects that wrap filesystem…
permissive · top 5,000 on PyPI