Python bindings for libmodsecurity (OWASP ModSecurity v3)
Project description
python-modsecurity
Python bindings for libmodsecurity.
Install
pip install libmodsecurity
with uv:
uv venv --python 3.13
uv add libmodsecurity
Usage
from libmodsecurity import ModSecurity, RulesSet
engine = ModSecurity()
engine.set_connector_information("my-app/1.0")
rules = RulesSet()
rules.load("""
SecRuleEngine On
SecRule REQUEST_URI "@contains /admin" \
"id:1,phase:1,deny,status:403,log,msg:'blocked'"
""")
with engine.transaction(rules) as t:
t.process_connection("127.0.0.1", 12345, "127.0.0.1", 80)
t.process_uri("/admin", "GET", "1.1")
t.add_request_header("Host", "example.com")
t.process_request_headers()
if it := t.intervention():
print(f"blocked with {it.status}: {it.log}")
ASGI middleware
The package ships a ready-to-use ASGI middleware at libmodsecurity.asgi. Point
it at your application via WAF_APP (module:attr) and a SecRules config via
WAF_RULES:
WAF_APP=app:app WAF_RULES=./config/init.conf \
uv run gunicorn -k gunicorn.workers.gasgi.ASGIWorker libmodsecurity.asgi:app
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libmodsecurity-3.0.15.post2.tar.gz.
File metadata
- Download URL: libmodsecurity-3.0.15.post2.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b313384fa6192c79c2af15e3ec9d9830582d5d82e92a04b57455b9f853e5a64
|
|
| MD5 |
23ab18b1eb1d59aa83f8b0973976ade0
|
|
| BLAKE2b-256 |
ec348dc15758adaf592dca7882046b19f3d8677a09abfc949584d509d21fef01
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2.tar.gz:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2.tar.gz -
Subject digest:
2b313384fa6192c79c2af15e3ec9d9830582d5d82e92a04b57455b9f853e5a64 - Sigstore transparency entry: 1462937412
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libmodsecurity-3.0.15.post2-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: libmodsecurity-3.0.15.post2-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7930df69184bd6023b93109b54dd28ae4e761e184568c4b7a0a6dda1f5609357
|
|
| MD5 |
9e7a13bafabdb826317d3c8af4d5c56e
|
|
| BLAKE2b-256 |
e4ed3f048a32cdde8a8153ad7b12f9232c79dd5bd80f5bfc16d4c5b0d8f90fd1
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2-cp313-cp313-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2-cp313-cp313-manylinux_2_28_x86_64.whl -
Subject digest:
7930df69184bd6023b93109b54dd28ae4e761e184568c4b7a0a6dda1f5609357 - Sigstore transparency entry: 1462937448
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libmodsecurity-3.0.15.post2-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: libmodsecurity-3.0.15.post2-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaeb3c9f254f8d4e4a64e7cdfe7bbf9565a6b337ea38b987cea4fb70464d89d0
|
|
| MD5 |
e83a36d2ebd6f5f2c62fba6f9ebf6235
|
|
| BLAKE2b-256 |
d0f25efa5384c1f142470f3b098479a17c64e233c4571babed392608d0cf8584
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
eaeb3c9f254f8d4e4a64e7cdfe7bbf9565a6b337ea38b987cea4fb70464d89d0 - Sigstore transparency entry: 1462937826
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libmodsecurity-3.0.15.post2-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: libmodsecurity-3.0.15.post2-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2e50cda39f1e73c90d2a30b2e11ad81454bf7d7c788c770df2001d24c645cac
|
|
| MD5 |
23978157a8336d91efbb3df6bc5d50e9
|
|
| BLAKE2b-256 |
40337023d01d922c79f827ffc915d1d3ea5950249e994b12a64606efb5d467aa
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2-cp312-cp312-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2-cp312-cp312-manylinux_2_28_x86_64.whl -
Subject digest:
f2e50cda39f1e73c90d2a30b2e11ad81454bf7d7c788c770df2001d24c645cac - Sigstore transparency entry: 1462937686
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libmodsecurity-3.0.15.post2-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: libmodsecurity-3.0.15.post2-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b2f0bc08ee7e789d92f587f0ce63bcbffe536dd5eaa0c7db531d6c262b42b18
|
|
| MD5 |
806b97eeb4f5a0adeb919c454b8df1ca
|
|
| BLAKE2b-256 |
b27a1d16cb9eec11d2fff5427bf0b2d2e980047ecaeb77f049ab9c9d4c318782
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
6b2f0bc08ee7e789d92f587f0ce63bcbffe536dd5eaa0c7db531d6c262b42b18 - Sigstore transparency entry: 1462937485
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libmodsecurity-3.0.15.post2-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: libmodsecurity-3.0.15.post2-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12a02e8c0d47fe23e2948e89c8a3862b3f8176c8a140db9abb743e98557eff94
|
|
| MD5 |
1fd0dfd171bfe6695e3ab08fcd6affca
|
|
| BLAKE2b-256 |
68796039c40ea3e25906372238eb47c29484363beeb1962d4528710ba2f50878
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2-cp311-cp311-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2-cp311-cp311-manylinux_2_28_x86_64.whl -
Subject digest:
12a02e8c0d47fe23e2948e89c8a3862b3f8176c8a140db9abb743e98557eff94 - Sigstore transparency entry: 1462937793
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libmodsecurity-3.0.15.post2-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: libmodsecurity-3.0.15.post2-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06726b7db70262ec5cf3848e06e707c3a9c730a05a82924155e60f4350a4f624
|
|
| MD5 |
17cefa36dc498d2acf706545d792d2f9
|
|
| BLAKE2b-256 |
b97c090f5f1992910f7282acf801dcce31eb416c71191b6f40640615528b9f32
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
06726b7db70262ec5cf3848e06e707c3a9c730a05a82924155e60f4350a4f624 - Sigstore transparency entry: 1462937853
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libmodsecurity-3.0.15.post2-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: libmodsecurity-3.0.15.post2-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
826a1e12ba3077fa6a3068fb2fa38f00422ee992b5790d56100dee551c231e28
|
|
| MD5 |
f501cf9c686736c02caaa13145358408
|
|
| BLAKE2b-256 |
a83aba5945d6526207207df51dd7f1fa6659cb08c839ece5d5595b641d1733db
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2-cp310-cp310-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2-cp310-cp310-manylinux_2_28_x86_64.whl -
Subject digest:
826a1e12ba3077fa6a3068fb2fa38f00422ee992b5790d56100dee551c231e28 - Sigstore transparency entry: 1462937903
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libmodsecurity-3.0.15.post2-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: libmodsecurity-3.0.15.post2-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e97a33f1a2dc0645fbbf4b6d2a6763ece22a22d56d1a44b5cb3fc126f55bbd57
|
|
| MD5 |
61293d53ebb137d24189d8bfc11cf97e
|
|
| BLAKE2b-256 |
d1faab1323469e1367451c29b94807605f69d8a566eee73d42934c7282031075
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2-cp310-cp310-macosx_11_0_arm64.whl:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2-cp310-cp310-macosx_11_0_arm64.whl -
Subject digest:
e97a33f1a2dc0645fbbf4b6d2a6763ece22a22d56d1a44b5cb3fc126f55bbd57 - Sigstore transparency entry: 1462937740
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libmodsecurity-3.0.15.post2-cp39-cp39-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: libmodsecurity-3.0.15.post2-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02b3fe092f675be44fb4025b0bb2d719ab778f18f60112b00e05eb7a5589f144
|
|
| MD5 |
b819be9739970a614dccc53705989657
|
|
| BLAKE2b-256 |
b246dc73d1d8fa90293ecab545d022da5c0b9976094167cf551ae31ee062d93d
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2-cp39-cp39-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2-cp39-cp39-manylinux_2_28_x86_64.whl -
Subject digest:
02b3fe092f675be44fb4025b0bb2d719ab778f18f60112b00e05eb7a5589f144 - Sigstore transparency entry: 1462937616
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libmodsecurity-3.0.15.post2-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: libmodsecurity-3.0.15.post2-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a725d8ad4c8c385beed436aa12d935f7e4d899b7781a2fd14616d3d546afa14
|
|
| MD5 |
868b3334007ab787958cb2e19e2ac51c
|
|
| BLAKE2b-256 |
a4e331dc88d08f2989223e9cddabfe40131616ad9584e239cb727ae3ba4c4e9c
|
Provenance
The following attestation bundles were made for libmodsecurity-3.0.15.post2-cp39-cp39-macosx_11_0_arm64.whl:
Publisher:
wheels.yml on meirdev/python-modsecurity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libmodsecurity-3.0.15.post2-cp39-cp39-macosx_11_0_arm64.whl -
Subject digest:
1a725d8ad4c8c385beed436aa12d935f7e4d899b7781a2fd14616d3d546afa14 - Sigstore transparency entry: 1462937555
- Sigstore integration time:
-
Permalink:
meirdev/python-modsecurity@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Branch / Tag:
refs/tags/v3.0.15.post2 - Owner: https://github.com/meirdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@57a462ee9e0281fc0e1ed5ee6470f69ad0feda01 -
Trigger Event:
push
-
Statement type: