Contains reusable logic to apply Oomnitza ssrf protection.
Project description
Oomnitza SSRF Protection
Package contains reusable logic to apply Oomnitza SSRF protection.
Overview
The SSRF Protector library is a Python library designed to protect against Server-Side Request Forgery (SSRF) attacks. SecuritySSRFProtection class provides a check_url method that allows you to validate URLs and ensure they do not point to sensitive or internal resources.
Installation
You can install the SSRF Protector library using pip:
pip install oomnitza-ssrf-protection
Usage
To use the SSRF Protector library, follow the steps below:
Import the SecuritySSRFProtection class from the library and call the check_url method with the URL you want to validate:
url = "https://example.com"
result = await SecuritySSRFProtection().check_url(url)
SecuritySSRFProtection class also supports synchronous version of check_url method
url = "https://example.com"
result = SecuritySSRFProtection().sync_check_url(url)
It's also possible to pass whitelist of URLs to SecuritySSRFProtection
url_to_check = "https://example.com"
allowed_urls=["http://127.0.0.1", "http://169.254.1.194"]
result = await SecuritySSRFProtection(
allowed_urls=allowed_urls
).check_url(url_to_check)
The check_url method will raise SSRFProtectionError if the URL is potentially dangerous (e.g., pointing to internal resources).
Development
Install package with or without test dependencies.
python3 -m venv .venv
source .venv/bin/activate
pip install oomnitza-ssrf-protection
pip install -e '.[tests]'
Feel free to write additional tests to cover the new changes and run test suite.
Distribution
Build and upload the package to the PyPi repository.
Upload package to testpypi
python3 -m build
python3 -m twine upload --repository testpypi dist/*
Upload package to pypi
python3 -m build
python3 -m twine upload dist/*
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for oomnitza_ssrf_protection-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | adc8bf04b2ef4fc6108d295df4cfa0e7aa147e361adc2f6c434132cfcaa36b86 |
|
MD5 | e8220482806c1588190637d464d59be9 |
|
BLAKE2b-256 | 156108f222f94830e217ee09b3df57caa707d612f7d7af03e3aeea73d5ba4191 |
Hashes for oomnitza_ssrf_protection-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39b071a803e0c7cc6bbb392fa51a010a6fee0ef05030cc0f77666346155fe162 |
|
MD5 | a79baff08807ebcc8ead06898ea03acd |
|
BLAKE2b-256 | f5a168fc4ed87871e320a1e9f2f75cf7898f69f1bf07f96e2eba5875fd4f2573 |