Skip to main content
Pre-release

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

sec-audit-rules

Framework-free audit rules engine, enforcement policies, and SIEM integrations for the sec-audit core.

This package is Django-free and shares the sec_audit namespace with its sibling distributions.

Features

  • Rules — pure, read-only detectors that evaluate an event and optionally return a RuleMatch. All state (counters, history, clock, config) is injected via RuleContext, so rules have no side effects.
  • Engine — filters events by type, isolates rule exceptions, and enforces safety flags (safe_for_enforcement) for pre-request blocking.
  • Enforcement — policies that turn matches into alert/block decisions with persistent block scopes.
  • Integrations — Wazuh XML/YAML detection rules ship as package data (no runtime Wazuh import required).

Install

pip install sec-audit-rules
# with the Wazuh HTTP client extra:
pip install "sec-audit-rules[wazuh]"

Writing a rule

from sec_audit.rules import Rule, RuleMatch

class TooManyFailedLogins(Rule):
    name = 'too_many_failed_logins'
    event_types = {'auth.login.failed'}
    severity = 8
    safe_for_enforcement = True

    def evaluate(self, event, ctx):
        srcip = str(event.fields.get('srcip') or '')
        count = ctx.counters.incr(f'login_fail:{srcip}', ttl=300)
        if count < 5:
            return None
        return RuleMatch(
            self.name, self.severity, ctx.now,
            f'Too many failed logins from {srcip}',
            metadata={'count': count, 'srcip': srcip},
        )

Rules are pure detectors — no logging, DB writes, or external calls; RuleMatch.metadata is immutable after creation.

License

MIT

Metadata

Release files for sec-audit-rules 0.1.0a3

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

Source distribution (sdist)

Source distribution for sec-audit-rules 0.1.0a3
File Size Uploaded Provenance Actions
sec_audit_rules-0.1.0a3.tar.gz 36.3 kB Without provenance Details for sec_audit_rules-0.1.0a3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sec-audit-rules 0.1.0a3
File Interpreter ABI Platform Actions
sec_audit_rules-0.1.0a3-py3-none-any.whl Python 3 none any Details for sec_audit_rules-0.1.0a3-py3-none-any.whl

Total release size: 75.8 kB

Release files / sec_audit_rules-0.1.0a3.tar.gz

Download URL sec_audit_rules-0.1.0a3.tar.gz
Size 36.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1e9961d6ae441da35fb85b94d3fefd6eff0026b2287953e67b2b8c51f8b6b0a4
BLAKE2b-256 checksum
How to use checksums
c63788271d73e994e306191d7e190912c98f0a1aa3a2b708cbe271ed5fc22174
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / sec_audit_rules-0.1.0a3-py3-none-any.whl

Download URL sec_audit_rules-0.1.0a3-py3-none-any.whl
Size 39.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08620bbdb4073968c88576b891e65777ada9e0b3d7b2252edc54c7812e60c928
BLAKE2b-256 checksum
How to use checksums
53f8b4adb31257310c91f7908bb851c3158a0c4c22aafd5c3882acea1a420f0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for sec-audit-rules 0.1.0a3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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