fileaudit 0.2.3__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fileaudit-0.2.3 → fileaudit-0.2.4}/.github/workflows/docbuild.yml +3 -3
- {fileaudit-0.2.3 → fileaudit-0.2.4}/CHANGELOG.md +29 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/PKG-INFO +6 -11
- {fileaudit-0.2.3 → fileaudit-0.2.4}/README.md +4 -10
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/CONTRIBUTE.md +68 -1
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/_toc.yml +6 -3
- fileaudit-0.2.4/docs/ai_policy.md +50 -0
- fileaudit-0.2.4/docs/architecture/architecture_overview.md +90 -0
- fileaudit-0.2.4/docs/architecture/xml.md +21 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/csv_validations.md +36 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/examples.md +1 -1
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/general_use.md +1 -1
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/gz_validations.md +37 -1
- fileaudit-0.2.4/docs/images/fileaudit_deps.png +0 -0
- fileaudit-0.2.4/docs/images/fileaudit_logo.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/intro.md +3 -2
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/json_validations.md +46 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/python_validations.md +50 -2
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/tar_validations.md +35 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/targz_validations.md +29 -1
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/xml_validations.md +38 -1
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/zip_validations.md +34 -0
- fileaudit-0.2.4/fileaudit.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/pyproject.toml +2 -1
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/__about__.py +1 -1
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/cli.py +5 -7
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/csv_check.py +1 -2
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/gz_check.py +10 -14
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/python_check.py +139 -89
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/zip_check.py +2 -2
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_python_timeouts.py +35 -5
- {fileaudit-0.2.3 → fileaudit-0.2.4}/.github/workflows/sastvalidation.yml +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/.github/workflows/testsuite.yml +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/.gitignore +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/CONTRIBUTE.md +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/LICENSE +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/SECURITY.md +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/SECURITY.md +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/_config.yml +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/_static/nocxstyle.css +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/about.md +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/changelog.md +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/help.md +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/OO.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/ROI_logo.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/YourLogoHere.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/ai_use.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/architecture_overview.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/ca_logo.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/codeauditlogo.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/filescan_screenshot_16012026.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/modulescan_screenshot_16012026.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/nocxbanner.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/overview_linkaudit.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/images/overview_screenshot_16012026.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/installation.md +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/license.md +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/notebooks/json_check_demo.ipynb +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/notebooks/validate_csv_examples.ipynb +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/fileaudit.cli.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/fileaudit.csv_check.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/fileaudit.gz_check.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/fileaudit.json_check.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/fileaudit.python_check.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/fileaudit.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/fileaudit.tar_check.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/fileaudit.targz_check.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/fileaudit.xml_check.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/fileaudit.zip_check.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/reference/modules.rst +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/docs/sponsors.md +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/.gitignore +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/class_index.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/coverage_html_cb_dd2e7eb5.js +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/favicon_32_cb_c827f16f.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/function_index.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/index.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/keybd_closed_cb_900cfef5.png +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/status.json +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/style_cb_4667309f.css +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf___about___py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf___init___py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf_cli_py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf_csv_check_py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf_gz_check_py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf_json_check_py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf_python_check_py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf_tar_check_py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf_targz_check_py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf_xml_check_py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/htmlcov/z_65b8f32785d686bf_zip_check_py.html +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/__init__.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/json_check.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/tar_check.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/targz_check.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/src/fileaudit/xml_check.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_cli.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_csv.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_csv_extra.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_gz.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_gz_extra.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_gz_validation.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_json.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_json_core.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_python.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_tar.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_targz.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_targz_core.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_unittest_json.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_validate_tar.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_xml.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_xml_extra.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_xml_files.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/test_zip.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/csv/sample.csv +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/gz/samplefile.txt.gz +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/json/codeaudit_scan.json +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/json/nojsonfile.json +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/python/sample_with_null.py +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/xml/cyclic.xml +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/xml/expansion.xml +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/xml/external.xml +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/xml/nlnetfeed.atom +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/xml/nocx_rss.xml +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/xml/xmlbomb.xml +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/xml/xmlbomb2.xml +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/xml/xmlbomb3.xml +0 -0
- {fileaudit-0.2.3 → fileaudit-0.2.4}/tests/validationfiles/zip/sample.zip +0 -0
|
@@ -22,9 +22,9 @@ jobs:
|
|
|
22
22
|
uses: actions/checkout@v6
|
|
23
23
|
|
|
24
24
|
- name: Set up Python
|
|
25
|
-
uses: actions/setup-python@
|
|
25
|
+
uses: actions/setup-python@v6
|
|
26
26
|
with:
|
|
27
|
-
python-version: "3.
|
|
27
|
+
python-version: "3.14"
|
|
28
28
|
cache: pip
|
|
29
29
|
|
|
30
30
|
- name: Install package and Jupyter Book
|
|
@@ -43,7 +43,7 @@ jobs:
|
|
|
43
43
|
find docs/_build/html -maxdepth 2 -type f | sort
|
|
44
44
|
|
|
45
45
|
- name: Upload documentation
|
|
46
|
-
uses: actions/upload-pages-artifact@
|
|
46
|
+
uses: actions/upload-pages-artifact@v4
|
|
47
47
|
with:
|
|
48
48
|
path: docs/_build/html
|
|
49
49
|
|
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## Version 0.2.4
|
|
6
|
+
|
|
7
|
+
**Added**
|
|
8
|
+
|
|
9
|
+
* Added AI/LLM policy in the "Contribute" section.
|
|
10
|
+
|
|
11
|
+
* Added validation and confirmed support for Python 3.15.
|
|
12
|
+
|
|
13
|
+
**Changed**
|
|
14
|
+
|
|
15
|
+
* Improved test scripts.
|
|
16
|
+
|
|
17
|
+
* Enhanced Python validation code.
|
|
18
|
+
|
|
19
|
+
* Made minor improvements to the output text displayed in the CLI.
|
|
20
|
+
|
|
21
|
+
**Fixed**
|
|
22
|
+
|
|
23
|
+
* Fixed GitHub Action workflow warning regarding Node.js 20 deprecation for automated documentation builds.
|
|
24
|
+
|
|
25
|
+
* Applied manual improvements and general fixes.
|
|
26
|
+
|
|
27
|
+
**Documentation**
|
|
28
|
+
|
|
29
|
+
* Improvements and updates
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
5
34
|
## Version 0.2.3
|
|
6
35
|
|
|
7
36
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fileaudit
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Python file security validator.
|
|
5
5
|
Project-URL: Homepage, https://github.com/nocomplexity/fileaudit
|
|
6
6
|
Project-URL: Documentation, https://github.com/nocomplexity/fileaudit#readme
|
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
21
22
|
Classifier: Topic :: Security
|
|
22
23
|
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
24
|
Requires-Python: >=3.12
|
|
@@ -37,10 +38,12 @@ Description-Content-Type: text/markdown
|
|
|
37
38
|
[](https://nocomplexity.github.io/fileaudit/)
|
|
38
39
|
[](https://github.com/nocomplexity/fileaudit/blob/main/docs/license.md)
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
[](https://fileaudit.nocomplexity.com/)
|
|
42
|
+
|
|
43
|
+
File Audit – Simplify Python Security by adding one line!
|
|
41
44
|
**Build secure Python applications by default. Validate files before you use them.**
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
A robust file-validation library designed to protect your Python applications and scripts against untrusted or malicious files.
|
|
44
47
|
|
|
45
48
|
|
|
46
49
|
## Safety Checks
|
|
@@ -60,14 +63,6 @@ Python File Audit protects you from using insecure files and file-based attacks
|
|
|
60
63
|
|
|
61
64
|
These checks can be used via a simple API or by adding a decorator — without changing your existing code.
|
|
62
65
|
|
|
63
|
-
## Installation
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
pip install fileaudit
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
66
|
## Installation
|
|
72
67
|
|
|
73
68
|
```bash
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
[](https://nocomplexity.github.io/fileaudit/)
|
|
8
8
|
[](https://github.com/nocomplexity/fileaudit/blob/main/docs/license.md)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
[](https://fileaudit.nocomplexity.com/)
|
|
11
|
+
|
|
12
|
+
File Audit – Simplify Python Security by adding one line!
|
|
11
13
|
**Build secure Python applications by default. Validate files before you use them.**
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
A robust file-validation library designed to protect your Python applications and scripts against untrusted or malicious files.
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
## Safety Checks
|
|
@@ -30,14 +32,6 @@ Python File Audit protects you from using insecure files and file-based attacks
|
|
|
30
32
|
|
|
31
33
|
These checks can be used via a simple API or by adding a decorator — without changing your existing code.
|
|
32
34
|
|
|
33
|
-
## Installation
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
pip install fileaudit
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
35
|
## Installation
|
|
42
36
|
|
|
43
37
|
```bash
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Contribute
|
|
2
2
|
|
|
3
|
+
## A Warm Welcome
|
|
4
|
+
|
|
3
5
|
Great that you want to contribute!
|
|
4
6
|
|
|
5
7
|
:::{tip}
|
|
@@ -29,6 +31,7 @@ The **File Audit** code repository is hosted at [Github](https://github.com/noco
|
|
|
29
31
|
Simple Guidelines:
|
|
30
32
|
|
|
31
33
|
* Questions, Feature Requests, Bug Reports should all be reported on the [Github Issue Tracker](https://github.com/nocomplexity/fileaudit/issues) .
|
|
34
|
+
* Make the pull request *small*, so one issue or improvement per pull request. All improvements are verified by a human!
|
|
32
35
|
* [Black](https://black.readthedocs.io/en/stable/index.html) is used for code style. But for a simple fix, using `Black` is not required!
|
|
33
36
|
|
|
34
37
|
This fileaudit tool is designed by applying [Zero Complexity By Design principles](https://nocomplexity.com/documents/0complexity/abstract.html). So the goal is to keep the tool simple to use and the code simple to adjust or to extend.
|
|
@@ -61,6 +64,66 @@ Making code contributions to **Python File Audit** should be fun and simple!
|
|
|
61
64
|
|
|
62
65
|
:::
|
|
63
66
|
|
|
67
|
+
|
|
68
|
+
## Setting Up a Local Development Environment
|
|
69
|
+
|
|
70
|
+
Follow these steps to create a local development environment so you can contribute to **Python File Audit**.
|
|
71
|
+
|
|
72
|
+
### 1. Create and activate a Conda environment
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
conda create --name fileaudit_dev python=3.15
|
|
76
|
+
conda activate fileaudit_dev
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 2. Install required tools
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install hatch
|
|
83
|
+
pip install codeaudit
|
|
84
|
+
pip install -U pytest
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Clone the repository and install in editable mode
|
|
88
|
+
|
|
89
|
+
Clone the repository from GitHub, then install the package in editable mode from the project root:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/nocomplexity/fileaudit.git
|
|
93
|
+
cd fileaudit
|
|
94
|
+
pip install -e .
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 4. Verify the installation
|
|
98
|
+
|
|
99
|
+
Run the test suite to confirm everything is working:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pytest
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
All tests should pass.
|
|
106
|
+
|
|
107
|
+
### 5. Build the documentation (optional)
|
|
108
|
+
|
|
109
|
+
To build the documentation, install Jupyter Book **version 1** (the 100% Sphinx-compatible version):
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pip install "jupyter-book<2"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
You can then build the docs locally from the `docs/` directory using the standard Jupyter Book commands.
|
|
116
|
+
To build the documentation, switch to the documentation directory, `cd docs` from the project root and do:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
jb build .
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
But mind the manual is automatically build using a gitbub action when files under `docs` are changed.
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
64
127
|
(CoC-label)=
|
|
65
128
|
## Code of Conduct
|
|
66
129
|
|
|
@@ -86,4 +149,8 @@ Instances of abusive, harassing, or otherwise unacceptable behavior may be repor
|
|
|
86
149
|
|
|
87
150
|
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
|
|
88
151
|
|
|
89
|
-
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](https://www.contributor-covenant.org/version/1/2/0/code-of-conduct/).
|
|
152
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](https://www.contributor-covenant.org/version/1/2/0/code-of-conduct/).
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
```{include} ai_policy.md
|
|
156
|
+
```
|
|
@@ -5,6 +5,7 @@ parts:
|
|
|
5
5
|
- caption: Getting Started
|
|
6
6
|
chapters:
|
|
7
7
|
- file: installation
|
|
8
|
+
- file: general_use
|
|
8
9
|
- url: https://securitytesting.nocomplexity.com/
|
|
9
10
|
title: Security Testing for Python
|
|
10
11
|
- url: http://securitybydesign.nocomplexity.com/
|
|
@@ -13,8 +14,7 @@ parts:
|
|
|
13
14
|
title: Python Security Handbook
|
|
14
15
|
|
|
15
16
|
- caption: User Guide
|
|
16
|
-
chapters:
|
|
17
|
-
- file: general_use
|
|
17
|
+
chapters:
|
|
18
18
|
- file: json_validations
|
|
19
19
|
- file: targz_validations
|
|
20
20
|
- file: tar_validations
|
|
@@ -38,9 +38,12 @@ parts:
|
|
|
38
38
|
|
|
39
39
|
- caption: Architecture
|
|
40
40
|
chapters:
|
|
41
|
+
- file: architecture/architecture_overview
|
|
42
|
+
sections:
|
|
43
|
+
- file: architecture/xml
|
|
41
44
|
- file: SECURITY
|
|
42
45
|
- file: changelog
|
|
43
|
-
|
|
46
|
+
|
|
44
47
|
# - file: project_philosophy
|
|
45
48
|
|
|
46
49
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
## Generative AI / LLM Policy
|
|
2
|
+
|
|
3
|
+
Everyone is free to make contributions with or without AI assistance. Especially since English is not the native language of many people and users.
|
|
4
|
+
|
|
5
|
+
**BUT:** Due to both legal and human reasons, we have to establish boundaries.
|
|
6
|
+
|
|
7
|
+
:::{caution}
|
|
8
|
+
- We take the responsibility for this project very seriously and we expect you to take your responsibility for your contributions seriously, too.
|
|
9
|
+
- Every contribution has to be backed by a human who unequivocally owns the copyright for all changes.
|
|
10
|
+
|
|
11
|
+
No LLM bots in `Co-authored-by:`s.
|
|
12
|
+
- Absolutely **no** unsupervised agentic tools like OpenClaw.
|
|
13
|
+
|
|
14
|
+
By submitting a pull request, you declare that:
|
|
15
|
+
- You are the author of the contribution.
|
|
16
|
+
- You **understand** the code.
|
|
17
|
+
- You accept full responsibility for it.
|
|
18
|
+
:::
|
|
19
|
+
|
|
20
|
+
### Legal
|
|
21
|
+
|
|
22
|
+
When you contribute to **Python Code Audit** (On PyPI `codeaudit`), your contributions (with or without AI support) are made under the same license as the file you are working on. You retain your copyright to your changes to this project.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Human
|
|
26
|
+
|
|
27
|
+
We take responsibility to our users very serious. Every code change is reviewed manually before merging because it's our responsibility to keep the project **stable and secure**.
|
|
28
|
+
|
|
29
|
+
Please understand that by opening low-quality pull requests generated by AI you're not helping. Make small pull request that are easy to review and merge.
|
|
30
|
+
:::{note}
|
|
31
|
+
Every pull request must be created by a Human or reviewed by a human. A human is responsible for all text in an issue or pull request.
|
|
32
|
+
:::
|
|
33
|
+
|
|
34
|
+
We have no time to become part of your vibe coding loop where you drop LLM slop and we spend time and energy to review it, and you just feed it back into the LLM for another iteration.
|
|
35
|
+
|
|
36
|
+
In practice, this means:
|
|
37
|
+
|
|
38
|
+
- Pull requests that have an LLM product listed as co-author can't be merged and will be closed without further discussion.
|
|
39
|
+
|
|
40
|
+
If you used LLM tools during development, you may still submit. But you must remove all LLM author tags and take full ownership of every line.
|
|
41
|
+
|
|
42
|
+
- By submitting a pull request, **you** take full responsibility for the contents of the pull request.
|
|
43
|
+
|
|
44
|
+
*"An LLM wrote it"* is **not** an acceptable response to questions or review remarks.
|
|
45
|
+
|
|
46
|
+
So:
|
|
47
|
+
- Do **not** post LLM-generated review comments.
|
|
48
|
+
- Do **not** post summaries unless you've fact-checked them and take responsibility for 100% of their content.
|
|
49
|
+
|
|
50
|
+
*Attribution: This AI policy is based on [attrs' AI_POLICY.md](https://github.com/python-attrs/attrs/blob/main/.github/AI_POLICY.md).*
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Architecture Overview
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Good security software, especially open-source security software, **should** have a written architecture document. Having an architecture document is vital from a security perspective.
|
|
5
|
+
|
|
6
|
+
An architecture document:
|
|
7
|
+
|
|
8
|
+
* Helps developers **understand** how and where to make changes, whether they are new to a project or not.
|
|
9
|
+
* Has a strong emphasis on the ‘**what**’ and provides boundaries for the ‘**how**’ (the implementation). A detailed implementation description is not part of the architecture document.
|
|
10
|
+
|
|
11
|
+
Within the IT industry, there is continuous debate about what architecture is and what a design is. Being a TOGAF certified practitioner myself, I like to keep things simple and always make sure that the purpose of any document is clear. Therefore, this document is **not a** detailed design; instead, it covers crucial architecture and design decisions that steer the implementation.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
In my opinion, open-source software for security **SHOULD** have an open architecture document. This architecture is:
|
|
15
|
+
|
|
16
|
+
* **Available to** everyone. This architecture document is part of the FOSS product, Python File Audit, and is released under a Creative Commons licence.
|
|
17
|
+
* Part of an open process in which everyone can participate to improve the architecture. See section [CONTRIBUTE](../CONTRIBUTE.md).
|
|
18
|
+
|
|
19
|
+
If you are interested in learning more about architecture—and especially open architecture, see:
|
|
20
|
+
- [The Architecture Playbook](https://nocomplexity.com/documents/arplaybook/introduction.html) and
|
|
21
|
+
- [Open Architectures do not work: The need for real open Architectures](http://www.slideshare.net/maikelm/open-architectures-do-not-work-the-need-for-real-open-architectures).
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## High-Level Design
|
|
25
|
+
|
|
26
|
+
Python File Audit performs security validations on different types of files.
|
|
27
|
+
|
|
28
|
+
A dedicated validation checker is implemented for each supported file type.
|
|
29
|
+
|
|
30
|
+
During prototyping, validation can be performed either in a Jupyter Notebook using one of the available APIs, or through the CLI.
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Architecture Principles
|
|
36
|
+
|
|
37
|
+
Python File Audit is built using the following guiding principles:
|
|
38
|
+
|
|
39
|
+
* **Separation of concerns**: Functionality for validation is separated. This to make maintenance simple and each module more easily to extend and test!
|
|
40
|
+
|
|
41
|
+
* **Simple to use:** Python File Audit is designed for ease of use by anyone, regardless of experience level.
|
|
42
|
+
|
|
43
|
+
* **Simple to extend:** The program must be easy to adapt and build upon for future needs. You can overload existing methods if needed for a special use-case. A Python decorator can be extended, parameterized, stacked, or designed with multiple behaviours (a form of overloading its usage/interface).
|
|
44
|
+
|
|
45
|
+
* **Simple to maintain:** We follow [0Complexity design principles](https://nocomplexity.com/documents/0complexity/abstract.html). E.g. simplicity enhances security. This means minimising dependencies and keeping both design and implementation straightforward and transparent.
|
|
46
|
+
* **Transparent:** All code is released under the FOSS (Free and Open Source Software) [GPLv3 licence](https://nocomplexity.com/documents/codeaudit/license.html). Transparency builds trust.
|
|
47
|
+
* **Clear scope:** No tool can do everything well, so we make strong, opinionated choices regarding the functionality we support.
|
|
48
|
+
|
|
49
|
+
**Implications:**
|
|
50
|
+
|
|
51
|
+
:::{note}
|
|
52
|
+
We focus on delivering a simple, trustworthy security library that performs its defined tasks exceptionally well—without compromise.
|
|
53
|
+
:::
|
|
54
|
+
|
|
55
|
+
## Design Choices
|
|
56
|
+
|
|
57
|
+
The following design choices have been made for Python File Audit:
|
|
58
|
+
|
|
59
|
+
* **No TLS checking**
|
|
60
|
+
* **Rationale:**
|
|
61
|
+
1. Checking TLS headers and other crucial HTTPS attributes is highly complex and dynamic. This module only accept valid HTTPS calls.
|
|
62
|
+
|
|
63
|
+
+++
|
|
64
|
+
|
|
65
|
+
* **No remote Python File validation option**
|
|
66
|
+
* **Rationale:**
|
|
67
|
+
* For scanning Python code on weakness you SHOULD use [Python Code Audit](https://github.com/nocomplexity/codeaudit). This great SAST application offers various APIs for creating remote validation on remote Python files. [Python Code Audit](https://github.com/nocomplexity/codeaudit) makes use of this security module.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Use of AI
|
|
71
|
+
|
|
72
|
+
I love new technology. I also advocate for Free and Open Machine Learning/AI. I think FOSS AI/ML is crucial for everyone. See [FOSS AI/ML Guide](https://nocomplexity.com/documents/fossml/abstract.html).
|
|
73
|
+
|
|
74
|
+
AI/Machine learning is an exciting and powerful technology. The continuous use and growth of AI and machine learning technology opens new opportunities. It also enables opportunities for solving complex problems in a more simple way.
|
|
75
|
+
|
|
76
|
+
For Python File Audit we make use of AI/ML capabilities in a secure, safe and most ethical way possible.
|
|
77
|
+
However every code line is reviewed in depth by a human and often improved, since most AI code generators fail when it comes to create secure Python software.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
Truth is: Most AI tools turned out to be of limited value for real trustworthy cybersecurity aspects. Human knowledge work, especially on design and security aspects is currently still vital for developing and maintaining a trustworthy Python security code analyzer!
|
|
81
|
+
|
|
82
|
+
## Why this library
|
|
83
|
+
|
|
84
|
+
Python applications are not **secure by default**, and building secure software is rarely simple. Even when leveraging AI, generated code often remains vulnerable because security is an architectural and design discipline, not just a matter of writing code.
|
|
85
|
+
|
|
86
|
+
Processing malicious files in Python applications can lead to severe security consequences. Files received from external applications must always be validated prior to use. This aligns directly with the core [security-by-design](https://nocomplexity.github.io/securitybydesign/) principle: *never trust, always verify*.
|
|
87
|
+
|
|
88
|
+
By providing a straightforward, general-purpose Python library to validate various file types against common security risks, we can make applications secure by default.
|
|
89
|
+
|
|
90
|
+
Currently, due to the lack of a simple file-validation library, many developers either build their own custom validation layer or omit safety checks entirely.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# XML Validation
|
|
2
|
+
|
|
3
|
+
This section outlines specific implementation details for the `validation_xml` functionality.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
In the table below outlines how functionality implemented in `validate_xml` and its underlying functions (`_validate_xml_file`, `XMLSecurityValidator`, and `HTTPSOnlyRedirectHandler`) are created:
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
| Check | Description | Code Implementation |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| **Max File Size** | Enforces maximum XML file size (bytes) | Checks local `st_size`, HTTP `Content-Length`, and caps standard/gzipped streaming reads at `max_file_size`. |
|
|
12
|
+
| **Max Nesting Depth** | Prevents deeply nested elements causing stack overflow | `XMLSecurityValidator._validate_tree` enforces `depth > self.max_depth` check on stack items. |
|
|
13
|
+
| **Max Elements** | Limits total element count to prevent DoS | Increments `self.element_count` during traversal and raises if it exceeds `self.max_elements`. |
|
|
14
|
+
| **Max Attributes** | Caps attributes per element | Checks `len(element.attrib) > self.max_attributes` inside `_validate_tree`. |
|
|
15
|
+
| **Max Text Length** | Limits text node and attribute value sizes | Checks `element.text`, `element.tail`, and `attribute value` string lengths against `self.max_text_length`. |
|
|
16
|
+
| **Max Name Length** | Limits element and attribute name lengths | Validates both `element.tag` and attribute keys against `self.max_name_length`. |
|
|
17
|
+
| **DOCTYPE Rejection** | Blocks DTD declarations (XXE, entity expansion) | `_reject_doctype` uses regex `_DOCTYPE_RE` (`<!DOCTYPE`) to reject any document with DTD declarations. |
|
|
18
|
+
| **GZip Support** | Handles compressed XML with size limits | Checks for magic header `b"\x1f\x8b"` or `gzip` content-encoding and safely streams via `_read_gzip_stream` using `max_file_size`. |
|
|
19
|
+
| **UTF-8 Validation** | Rejects files with invalid UTF-8 encoding | Decodes with `errors="strict"` and explicitly catches `UnicodeDecodeError`. |
|
|
20
|
+
| **Remote File Restriction** | Strictly restricts remote access to HTTPS only | `_validate_url_scheme` and `HTTPSOnlyRedirectHandler` block non-HTTPS schemes and HTTP downgrades. |
|
|
21
|
+
| **Parser Hardening** | Uses defusedxml-style protections against known XML attacks | Combines custom tree traversal depth/size limits with strict DOCTYPE rejection, preventing XXE, quadratic blowup, and Billion Laughs entity expansion. |
|
|
@@ -22,6 +22,42 @@ Validating before processing mitigates these risks.
|
|
|
22
22
|
- **Flexible input** — local paths, `pathlib.Path` objects, and URLs
|
|
23
23
|
- **Dual usage modes** — direct validation (returns `True`/`False`) or decorator that guards a function argument and raises `CsvValidationError` on failure
|
|
24
24
|
|
|
25
|
+
|
|
26
|
+
## Usage Options
|
|
27
|
+
|
|
28
|
+
### Parameters
|
|
29
|
+
|
|
30
|
+
| Parameter | Description |
|
|
31
|
+
|----------------------------|--------------------------------------------------|
|
|
32
|
+
| `func_or_path` | Path or callable for the CSV file. |
|
|
33
|
+
| `max_file_size` | Max size of the CSV file. |
|
|
34
|
+
| `max_rows` | Max number of rows. |
|
|
35
|
+
| `max_columns` | Max number of columns. |
|
|
36
|
+
| `max_field_size` | Max size of any single field. |
|
|
37
|
+
| `max_total_fields` | Max total number of fields. |
|
|
38
|
+
| `max_row_size` | Max size of any single row. |
|
|
39
|
+
| `max_filename_length` | Max length of the filename. |
|
|
40
|
+
| `reject_formula_injection` | Reject cells that look like formulas. |
|
|
41
|
+
| `reject_control_characters`| Reject control characters in fields. |
|
|
42
|
+
| `encoding` | File encoding (default: utf-8). |
|
|
43
|
+
| `dialect` | CSV dialect (default: excel). |
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Defaults
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024 # 10 MB
|
|
50
|
+
DEFAULT_MAX_ROWS = 100_000
|
|
51
|
+
DEFAULT_MAX_COLUMNS = 1_000
|
|
52
|
+
DEFAULT_MAX_FIELD_SIZE = 1 * 1024 * 1024 # 1 MB
|
|
53
|
+
DEFAULT_MAX_TOTAL_FIELDS = 10_000_000
|
|
54
|
+
DEFAULT_MAX_ROW_SIZE = 5 * 1024 * 1024 # 5 MB
|
|
55
|
+
DEFAULT_MAX_FILENAME_LENGTH = 255
|
|
56
|
+
DEFAULT_REMOTE_TIMEOUT = 30
|
|
57
|
+
DEFAULT_READ_CHUNK_SIZE = 64 * 1024
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
|
|
25
61
|
## How to Use
|
|
26
62
|
|
|
27
63
|
**Direct validation** (returns `True`/`False`):
|
|
@@ -27,7 +27,43 @@ The `validate_gz` function performs comprehensive security checks:
|
|
|
27
27
|
| **TOCTOU Detection** | Detects file size changes during validation (local files) |
|
|
28
28
|
| **Remote File Restriction** | Strictly restricts remote access to HTTPS only |
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## Usage Options
|
|
31
|
+
|
|
32
|
+
### Parameters
|
|
33
|
+
|
|
34
|
+
| Parameter | Description |
|
|
35
|
+
|--------------------------|--------------------------------------------------|
|
|
36
|
+
| `func_or_path` | Path or callable for the gz file. |
|
|
37
|
+
| `max_file_size` | Max size of the compressed file. |
|
|
38
|
+
| `max_uncompressed_ratio` | Max compression ratio. |
|
|
39
|
+
| `max_uncompressed_size` | Max size after decompression. |
|
|
40
|
+
|
|
41
|
+
### Defaults
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
Global default fallbacks
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024 # 10 MB
|
|
48
|
+
DEFAULT_MAX_UNCOMPRESSED_RATIO = 100 # 100:1 ratio
|
|
49
|
+
DEFAULT_MAX_UNCOMPRESSED_SIZE = 100 * 1024 * 1024 # 100 MB
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Decompressed file size into memory (chunks).
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
GZ_READ_CHUNK_SIZE = 1024 * 1024 # 1 MB
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
And note:
|
|
59
|
+
```
|
|
60
|
+
HEAD_TIMEOUT = 10
|
|
61
|
+
DOWNLOAD_TIMEOUT = 30
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Examples
|
|
65
|
+
|
|
66
|
+
Some simple examples how the checks can be used:
|
|
31
67
|
|
|
32
68
|
The function operates in three modes:
|
|
33
69
|
|
|
Binary file
|
|
Binary file
|
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
**Python File Audit**: Build secure Python applications by default. Validate files before you use them.
|
|
10
10
|
|
|
11
|
+
A robust file-validation library designed to protect your Python applications and scripts against untrusted or malicious input.
|
|
11
12
|
|
|
12
|
-
```{image} images/
|
|
13
|
+
```{image} images/fileaudit_logo.png
|
|
13
14
|
:alt: logo
|
|
14
15
|
:width: 200px
|
|
15
16
|
:align: center
|
|
16
|
-
:target: https://
|
|
17
|
+
:target: https://fileaudit.nocomplexity.com
|
|
17
18
|
```
|
|
18
19
|
|
|
19
20
|
::::{grid} 2
|
|
@@ -25,6 +25,39 @@ Be cautious when parsing JSON data from untrusted sources or third parties. From
|
|
|
25
25
|
- **Network timeouts** — remote requests use explicit timeouts (10 s for HEAD size check, 30 s for GET download) to avoid hanging on unresponsive servers
|
|
26
26
|
- **Dual usage modes** — direct validation (returns `True`/`False`) or decorator that guards a function argument and raises `FileValidationError` on failure
|
|
27
27
|
|
|
28
|
+
|
|
29
|
+
## Usage Options
|
|
30
|
+
|
|
31
|
+
### Importing the Function
|
|
32
|
+
|
|
33
|
+
To validate JSON data, import validate_json from the fileaudit package:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
from fileaudit.json_check import validate_json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Parameters
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
The `validate_json` function accepts the following parameters to customize validation behaviour:
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
| Parameter | Type | Default | Description |
|
|
46
|
+
|-----------|------|---------|-------------|
|
|
47
|
+
| `max_depth` | `int` or `None` | `DEFAULT_MAX_DEPTH` | Limits recursive structural depth allowed when parsing the JSON document to prevent stack overflow issues or excessive processing times. |
|
|
48
|
+
| `max_file_size` | `int` or `None` | `DEFAULT_MAX_FILE_SIZE` | Defines the maximum byte length allowed for the file on disk or remote HTTP resource before aborting parsing. |
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Default Limits
|
|
52
|
+
|
|
53
|
+
The function applies sensible defaults to prevent resource exhaustion:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
DEFAULT_MAX_DEPTH = 50 # Maximum nesting levels
|
|
57
|
+
DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024 # 10 MB
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
|
|
28
61
|
## How to Use
|
|
29
62
|
|
|
30
63
|
**Direct validation** (returns `True`/`False`):
|
|
@@ -57,6 +90,19 @@ def process_json(config_path, other_arg):
|
|
|
57
90
|
...
|
|
58
91
|
```
|
|
59
92
|
|
|
93
|
+
```python
|
|
94
|
+
|
|
95
|
+
# Bare decorator (validates the first argument)
|
|
96
|
+
@validate_json
|
|
97
|
+
def load_data(file_path: str):
|
|
98
|
+
pass
|
|
99
|
+
|
|
100
|
+
# Custom constraints applied via factory
|
|
101
|
+
@validate_json(max_depth=50, max_file_size=5000)
|
|
102
|
+
def parse_payload(path: Path):
|
|
103
|
+
pass
|
|
104
|
+
|
|
105
|
+
```
|
|
60
106
|
|
|
61
107
|
:::{note}
|
|
62
108
|
JSON Schema checks are **not covered**! This is application specific and not considered as a general security validation.
|