Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Simple Attribute Based Access Control

Description

Python implementation of Attribute Based Access Control (ABAC). Design is based on XACML model, but is not its strict implementation.

Features

Example

from sabac import PDP, PAP, DenyBiasedPEP, deny_unless_permit

# Creating Policy Administration Point
pap = PAP(deny_unless_permit)

# Adding policy to PAP
pap.add_item({
    "description": "Admin permissions",
    "target": {
        'subject.id': 1,
    },
    "algorithm": "DENY_UNLESS_PERMIT",
    'rules': [
        {
            "effect": "PERMIT",
            "description": "Allow to manage users",
            "target": {
                'resource.type': 'user',
                'action': {'@in': ['create', 'view', 'update', 'erase_personal_data', 'delete']},
            },
        }
    ]
})

pdp = PDP(pap_instance=pap)

# Creating Policy Enforcement Point
pep = DenyBiasedPEP(pdp)

# Describing Policy Enforcement Point context
context = {
    'resource.type': 'user',
    'action': 'create',
    'subject.id': 1
}

# Evaluating policy
result = pep.evaluate(context)

print(result)  # Should return True

TODO

  • Implement all combining algorithms

#References

  1. XACML 3.0 standard http://docs.oasis-open.org/xacml/3.0/xacml-3.0-core-spec-os-en.html
  2. XACML Algorithms combining truth tables https://xacml.io
  3. A popular ABAC/XACML introduction in Russian https://habr.com/ru/company/custis/blog/258861/#rule

Metadata

Release files for sabac 0.0.1a0

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

Source distribution (sdist)

Source distribution for sabac 0.0.1a0
File Size Uploaded
sabac-0.0.1a0.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sabac 0.0.1a0
File Interpreter ABI Platform
sabac-0.0.1a0-py3-none-any.whl Python 3 none any Details

Total release size: 38.0 kB

Release files / sabac-0.0.1a0.tar.gz

Download URL sabac-0.0.1a0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2180252cb23071eb949d6b003fe14ebbef7904ce74ef1122feac98e8e6542c1e
BLAKE2b-256 checksum
How to use checksums
e91a4e7f2d2704f10986b3bfb9cf68e825fdb48872ee3d9f16eec24c04eae212
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.4

Release files / sabac-0.0.1a0-py3-none-any.whl

Download URL sabac-0.0.1a0-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba67f0cf3a5cb790e7e60e231401c3959c2c0129d18343f1830854cc4041ee2f
BLAKE2b-256 checksum
How to use checksums
888fda8ce6000bfa071728ae088e7dede30edc0fc755156a93863289a1c86e1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.0.1a0 This release

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