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 viaRuleContext, 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.0a4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sec_audit_rules-0.1.0a4.tar.gz | 37.9 kB | Without provenance | Details for sec_audit_rules-0.1.0a4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sec_audit_rules-0.1.0a4-py3-none-any.whl | Python 3 | none | any | Details for sec_audit_rules-0.1.0a4-py3-none-any.whl |
Total release size: 78.2 kB
Release files / sec_audit_rules-0.1.0a4.tar.gz
| Download URL | sec_audit_rules-0.1.0a4.tar.gz |
|---|---|
| Size | 37.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eda539649c95d2e9fe26ed58dbb71d6d08673568da39c7af33367b221a001dc5
|
|
BLAKE2b-256 checksum How to use checksums |
c57a9c69a92f500cb82faf0a9891e2ab5cb101574c39019d228b4c46f56ca53d
|
| 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.0a4-py3-none-any.whl
| Download URL | sec_audit_rules-0.1.0a4-py3-none-any.whl |
|---|---|
| Size | 40.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1accd2e952198f85d5dfdbea17485873fabf842679f77cc083f0382c2a274ae
|
|
BLAKE2b-256 checksum How to use checksums |
48966a08d8cae1475fee4494ed5ee108cfd1fa1f1f7ed76ec06ff46285e858aa
|
| 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.0a4
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.