Skip to main content

orthauth

PyPI version Build Status Coverage Status

A library to separate configuration and authentication from program logic

THIS IS NOT ENCRYPTED

THIS IS NOT A PASSWORD MANAGER

THIS IS NOT A SECURE SECRET STORAGE SYSTEM

YOU CAN SHOOT YOURSELF IN THE FOOT WITH THIS

There is NO encryption for secrets stored using orthauth. Orthauth can source credientials from a variety of sources but it is INTENTIONALLY INSECURE.

If you do not understand the use case for this as well as the risks if used outside a secure environment then DO NOT USE IT. No one can help you if you get pwnd.

Use case

The primary use case for orthauth is to keep api keys from leaking into source code and winding up in public repositories. orthauth does not provide operational security for any auth store that it uses. It is up to the user to secure those and the systems they reside on as they see fit.

While orthauth attemts to prevent secrets from leaking via debug messages or logging, it doesn't know anything about the secretness of the values it returns, and once it has returned that value, it is up to the consuming code to prevent the contents of the value from leaking.

orthauth is indented to unify two common ways managing configuration variables and credentials: setting them environment variables, and including them in a plain text file with permissions set to 0600 (and preferably kept in a folder set to 0700).

For example running a program in the following way export API_KEY=lolplzdonotstealthis; ./my-script-that-needs-the-key or using a file like ~/.pgpass or emacs .authinfo. Note that pgpass probably shouldn't be a source for most python implementations because libraries like psycopg2 are able to read it directly. However in other languages that do not have a library that supports reading from pgpass directly, then pgpass would be a useful source.

By making it possible to provide credentials seemlessley in multiple ways the hope is to reduce the use of different solutions in different environments without incuring the massive complexity of maintaining a managed authentication infrasturcture.

Approach

  1. Decorators
  2. A layer of indirection between names in a code base and config/secrets structure.
  3. Be clear about what should be considered public information. Thus prevent anything stored as a secret from being used as a key to find another secret.
  4. Bare minimum to store static configuration information, anything more should be implemented in the language consuming the config, not in the config.

Currently supported config formats

Format Support Install
json builtin pip install orthauth
python dictionary literals builtin pip install orthauth
yaml requires pyyaml pip install orthauth[yaml]

Usage

import orthauth as oa
auth = oa.AuthConfig('path/to/config.yaml')

@auth.tangential_init('api_key', 'some-service-api-key')
class ThatNeedsAuth:
    """ needs authenticated connection to some-service """

tna = ThatNeedsAuth()
print(tna.api_key)

Haven't been scared off yet? See the developer guide for more examples.

Release files for orthauth 0.0.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for orthauth 0.0.19
File Size Uploaded
orthauth-0.0.19.tar.gz 32.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for orthauth 0.0.19
File Interpreter ABI Platform
orthauth-0.0.19-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 51.4 kB

Release files / orthauth-0.0.19.tar.gz

Download URL orthauth-0.0.19.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6e32ff7e2337ed23763ce3b78eef87adb8513950b6761317faf9cb4cd1b65ed1
BLAKE2b-256 checksum
How to use checksums
efd2667d415d9ed4f30b4a98d80f9ad82e33e941637a34e5d229a33897c8c631
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / orthauth-0.0.19-py2.py3-none-any.whl

Download URL orthauth-0.0.19-py2.py3-none-any.whl
Size 19.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
fac57cd946cbb935c7b5644e09c692b524242a4ebd3d2db5da8c882090f73dad
BLAKE2b-256 checksum
How to use checksums
8fb334a8fac15025a7fd49c28e0df2dd9615994812d41c1c4ac18385428d843d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.0.19 This release

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.14

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page