codeaudit 1.0.0__tar.gz → 1.1.0__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.
Files changed (145) hide show
  1. codeaudit-1.1.0/CHANGELOG.md +44 -0
  2. {codeaudit-1.0.0 → codeaudit-1.1.0}/PKG-INFO +9 -6
  3. {codeaudit-1.0.0 → codeaudit-1.1.0}/README.md +8 -5
  4. {codeaudit-1.0.0 → codeaudit-1.1.0}/SECURITY.md +0 -1
  5. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/CLIcommands.ipynb +15 -16
  6. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/CONTRIBUTE.md +1 -1
  7. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/_toc.yml +6 -6
  8. codeaudit-1.1.0/docs/codeaudit.rst +12 -0
  9. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/codeauditcommands.md +14 -42
  10. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/features.md +6 -6
  11. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/filescan.md +25 -10
  12. codeaudit-1.1.0/docs/howtoscan.md +113 -0
  13. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/intro.md +14 -5
  14. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/issues.md +22 -2
  15. codeaudit-1.1.0/docs/makeitbetter.md +109 -0
  16. codeaudit-1.1.0/docs/modules.rst +7 -0
  17. codeaudit-1.1.0/docs/pca_overview.png +0 -0
  18. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/sponsors.md +2 -0
  19. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/userguide.md +10 -3
  20. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/__about__.py +1 -1
  21. codeaudit-1.1.0/src/codeaudit/api_interfaces.py +209 -0
  22. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/checkmodules.py +28 -10
  23. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/codeaudit.py +4 -5
  24. codeaudit-1.1.0/src/codeaudit/data/sastchecks.csv +71 -0
  25. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/filehelpfunctions.py +25 -3
  26. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/reporting.py +40 -23
  27. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/totals.py +1 -1
  28. codeaudit-1.1.0/tests/test_modulecheck.py +40 -0
  29. codeaudit-1.0.0/CHANGELOG.md +0 -22
  30. codeaudit-1.0.0/docs/directoryscan.md +0 -75
  31. codeaudit-1.0.0/src/codeaudit/data/sastchecks.csv +0 -71
  32. codeaudit-1.0.0/tests/test_modulecheck.py +0 -21
  33. {codeaudit-1.0.0 → codeaudit-1.1.0}/.gitignore +0 -0
  34. {codeaudit-1.0.0 → codeaudit-1.1.0}/CONTRIBUTE.md +0 -0
  35. {codeaudit-1.0.0 → codeaudit-1.1.0}/LICENSE.txt +0 -0
  36. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/_config.yml +0 -0
  37. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/_static/nocxstyle.css +0 -0
  38. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/about.md +0 -0
  39. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/astlines.md +0 -0
  40. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/astlines2.md +0 -0
  41. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/changelog.md +0 -0
  42. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/assert_check.md +0 -0
  43. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/base64_check.md +0 -0
  44. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/binding_check.md +0 -0
  45. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/builtinfunctions_check.md +0 -0
  46. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/chmod_check.md +0 -0
  47. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/directorycreation_check.md +0 -0
  48. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/dynamicimport_check.md +0 -0
  49. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/exception_check.md +0 -0
  50. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/hash_check.md +0 -0
  51. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/httpserver_check.md +0 -0
  52. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/input_check.md +0 -0
  53. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/loggingconf_check.md +0 -0
  54. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/marshal_check.md +0 -0
  55. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/mktemp_check.md +0 -0
  56. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/multiprocessing_check.md +0 -0
  57. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/pickle_check.md +0 -0
  58. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/random_check.md +0 -0
  59. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/shelve_check.md +0 -0
  60. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/shutil_check.md +0 -0
  61. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/subprocess_check.md +0 -0
  62. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/syscalls_check.md +0 -0
  63. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/systemcalls_check.md +0 -0
  64. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/tarfile_extract_check.md +0 -0
  65. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/xml_check.md +0 -0
  66. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checks/zipfile_check.md +0 -0
  67. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/checksinformation.md +0 -0
  68. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/codeauditchecks.md +0 -0
  69. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/codeauditoverview.md +0 -0
  70. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/complexitycheck.md +0 -0
  71. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/examples/checks_example.html +0 -0
  72. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/examples/directoryscan.html +0 -0
  73. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/examples/filescan.html +0 -0
  74. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/examples/modulescan.html +0 -0
  75. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/examples/overview.html +0 -0
  76. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/filescan.png +0 -0
  77. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/help.md +0 -0
  78. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/images/OO.png +0 -0
  79. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/images/ROI_logo.png +0 -0
  80. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/images/YourLogoHere.png +0 -0
  81. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/images/codeauditlogo.png +0 -0
  82. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/images/nocxbanner.png +0 -0
  83. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/images/overview_linkaudit.png +0 -0
  84. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/license.md +0 -0
  85. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/modulescan.md +0 -0
  86. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/overviewplot.png +0 -0
  87. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/warnings.md +0 -0
  88. {codeaudit-1.0.0 → codeaudit-1.1.0}/docs/whysast.md +0 -0
  89. {codeaudit-1.0.0 → codeaudit-1.1.0}/filescan.png +0 -0
  90. {codeaudit-1.0.0 → codeaudit-1.1.0}/pyproject.toml +0 -0
  91. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/__init__.py +0 -0
  92. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/altairplots.py +0 -0
  93. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/complexitycheck.py +0 -0
  94. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/htmlhelpfunctions.py +0 -0
  95. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/issuevalidations.py +0 -0
  96. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/security_checks.py +0 -0
  97. {codeaudit-1.0.0 → codeaudit-1.1.0}/src/codeaudit/simple.css +0 -0
  98. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/__init__.py +0 -0
  99. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/count_lines_file1.py +0 -0
  100. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_basicpatterns.py +0 -0
  101. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_chmod.py +0 -0
  102. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_constructspart2.py +0 -0
  103. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_correctexceptionuse.py +0 -0
  104. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_count_commentlines.py +0 -0
  105. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_directorycreation.py +0 -0
  106. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_directorycreation2.py +0 -0
  107. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_hashstrenght.py +0 -0
  108. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_obfuscatingbuiltins.py +0 -0
  109. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_oschecks.py +0 -0
  110. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_random.py +0 -0
  111. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_standardlibconstructs.py +0 -0
  112. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/test_totalscheck.py +0 -0
  113. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/allshit.py +0 -0
  114. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/assert.py +0 -0
  115. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/base64.py +0 -0
  116. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/chmod_things.py +0 -0
  117. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/complexitycheck.py +0 -0
  118. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/correctcounts.py +0 -0
  119. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/directorycreation.py +0 -0
  120. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/directorycreation2.py +0 -0
  121. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/exception.py +0 -0
  122. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/file3.py +0 -0
  123. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/file_with_warnings.py +0 -0
  124. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/gzip.py +0 -0
  125. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/hashcheck.py +0 -0
  126. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/httpserver.py +0 -0
  127. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/inputstatement.py +0 -0
  128. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/marshal.py +0 -0
  129. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/modulecheck.py +0 -0
  130. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/multiprocessing.py +0 -0
  131. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/obfuscating.py +0 -0
  132. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/oschecks.py +0 -0
  133. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/pickle.py +0 -0
  134. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/python2_file_willnotwork.py +0 -0
  135. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/random.py +0 -0
  136. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/shelve.py +0 -0
  137. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/shutil.py +0 -0
  138. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/subprocess.py +0 -0
  139. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/syslibrary.py +0 -0
  140. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/tarfilevalidation.py +0 -0
  141. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/tempcheck.py +0 -0
  142. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/validation1.py +0 -0
  143. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/validation2.py +0 -0
  144. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/xml.py +0 -0
  145. {codeaudit-1.0.0 → codeaudit-1.1.0}/tests/validationfiles/zipfile.py +0 -0
@@ -0,0 +1,44 @@
1
+ # Change Log
2
+
3
+ ## Version 1.1:What's New
4
+
5
+ We've released a new version with several key improvements focused on making your security workflow smoother and providing more detailed security information.
6
+
7
+ * Streamlined Scanning:
8
+
9
+ The separate `directoryscan` command has been removed. You can now use the versatile `filescan` command to scan both individual files and entire directories. This simplifies the command-line interface and makes the process more intuitive.
10
+
11
+ * Enhanced Reporting:
12
+
13
+ We've made minor corrections to the documentation and static HTML reports to improve clarity. Additionally, warning messages are now more descriptive, helping you quickly understand potential issues.
14
+
15
+ * Improved Vulnerability Data:
16
+
17
+ You'll now get more detailed information about module vulnerabilities. The tool now includes CVSS scores, a standard metric for rating vulnerability severity, giving you a clearer picture of the risks.
18
+
19
+ * Behind-the-Scenes Fixes:
20
+
21
+ We've made a more robust and reliable adjustment to how the tool retrieves file names. This ensures consistency and accuracy during scans. We've also added beta-level API functions, opening up new possibilities for integration.
22
+
23
+
24
+
25
+ ## Version 1.0
26
+
27
+ This release represents a stabilisation of Python Code Audit!
28
+ Main changes in relation to the pre-1.0 versions are:
29
+ * More validations added: Python Code Audit now counts 70 security validations!
30
+ * Documentation updates
31
+ * Improved validation for `builtins`, like `compile`, `exec`,, `eval` that can be obfuscated in code.
32
+ * Various UI/UX updates. CLI text improved and HTML report text made consistent.
33
+ * Added test to validate correct working for now and in the future. Also validated working with other SAST tools to make sure core functionality is rock solid or better! Spoiler Python Code Audit is better than most used OSS and commercial SAST tools available today!
34
+
35
+
36
+ ## Beta Versions (Before 1.0)
37
+
38
+ All published beta version are stable and verified!
39
+ During the public beta phase input of users and experts is retrieved.
40
+ This resulted is mainly:
41
+ * More validation
42
+ * Better documentation and
43
+ * UI/UX improvements to make sure Python Code Audit is dead simple to use for non-programmers to validate a Python package.
44
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codeaudit
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Simplified static security checks for Python
5
5
  Project-URL: Documentation, https://github.com/nocomplexity/codeaudit#readme
6
6
  Project-URL: Issues, https://github.com/nocomplexity/codeaudit/issues
@@ -37,11 +37,14 @@ Python Code Audit - A modern Python source code analyzer based on distrust.
37
37
 
38
38
  Python Code Audit is a tool to find **security issues** in Python code. This static application security testing (SAST) tool has **great** features to simplify the necessary security tasks and make it fun and easy.
39
39
 
40
+ This tool is designed for anyone who uses or creates Python programs and wants to understand and mitigate potential security risks.
41
+
40
42
  This tool is created for:
41
- * Users of Python programs who want to known the security risks of the used Python code.
42
- * Anyone who loves to create Python programs and want to deliver Python code without vulnerabilities. So this tool is not only professional programs, but also occasional Python programmers. Creating secure software is very difficult. This program with the extensive documentation is your friendly security colleague!
43
- * Anyone who wants a simple way to get fast insight in possible security risks with Python packages or Python files.
43
+ * Python Users who want to assess the security risks in the Python code they use.
44
+ * Python Developers: Anyone, from professionals to hobbyists, who wants to deliver secure Python code.
45
+ * Security-Conscious Users: People seeking a simple, fast way to gain insight into potential security vulnerabilities within Python packages or files.
44
46
 
47
+ Creating secure software can be challenging. This tool, with its comprehensive [documentation](https://nocomplexity.com/documents/codeaudit/intro.html), acts as your helpful security colleague, making it easier to identify and address vulnerabilities.
45
48
 
46
49
  ## Features
47
50
 
@@ -71,7 +74,7 @@ pip install codeaudit
71
74
 
72
75
  or use:
73
76
 
74
- ```bash
77
+ ```console
75
78
  pip install -U codeaudit
76
79
  ```
77
80
 
@@ -116,7 +119,7 @@ Check https://simplifysecurity.nocomplexity.com/
116
119
 
117
120
  ## Example
118
121
 
119
- By running the `codeaudit filescan` command, detailed security information is determined for a Python file based on more than **60 validations** implemented.
122
+ By running the `codeaudit filescan` command, detailed security information is determined for a Python file based on more than **70 validations** implemented.
120
123
 
121
124
  The `codeaudit filescan` command shows all **potential** security issues that are detected in the source file in a HTML-report.
122
125
 
@@ -11,11 +11,14 @@ Python Code Audit - A modern Python source code analyzer based on distrust.
11
11
 
12
12
  Python Code Audit is a tool to find **security issues** in Python code. This static application security testing (SAST) tool has **great** features to simplify the necessary security tasks and make it fun and easy.
13
13
 
14
+ This tool is designed for anyone who uses or creates Python programs and wants to understand and mitigate potential security risks.
15
+
14
16
  This tool is created for:
15
- * Users of Python programs who want to known the security risks of the used Python code.
16
- * Anyone who loves to create Python programs and want to deliver Python code without vulnerabilities. So this tool is not only professional programs, but also occasional Python programmers. Creating secure software is very difficult. This program with the extensive documentation is your friendly security colleague!
17
- * Anyone who wants a simple way to get fast insight in possible security risks with Python packages or Python files.
17
+ * Python Users who want to assess the security risks in the Python code they use.
18
+ * Python Developers: Anyone, from professionals to hobbyists, who wants to deliver secure Python code.
19
+ * Security-Conscious Users: People seeking a simple, fast way to gain insight into potential security vulnerabilities within Python packages or files.
18
20
 
21
+ Creating secure software can be challenging. This tool, with its comprehensive [documentation](https://nocomplexity.com/documents/codeaudit/intro.html), acts as your helpful security colleague, making it easier to identify and address vulnerabilities.
19
22
 
20
23
  ## Features
21
24
 
@@ -45,7 +48,7 @@ pip install codeaudit
45
48
 
46
49
  or use:
47
50
 
48
- ```bash
51
+ ```console
49
52
  pip install -U codeaudit
50
53
  ```
51
54
 
@@ -90,7 +93,7 @@ Check https://simplifysecurity.nocomplexity.com/
90
93
 
91
94
  ## Example
92
95
 
93
- By running the `codeaudit filescan` command, detailed security information is determined for a Python file based on more than **60 validations** implemented.
96
+ By running the `codeaudit filescan` command, detailed security information is determined for a Python file based on more than **70 validations** implemented.
94
97
 
95
98
  The `codeaudit filescan` command shows all **potential** security issues that are detected in the source file in a HTML-report.
96
99
 
@@ -15,7 +15,6 @@ To report a security issue, please use the GitHub Security Advisory ["Report a V
15
15
 
16
16
  I will send a response indicating the next steps in handling your report. After the initial reply to your report, I will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
17
17
 
18
- For context on Electron's security notification process, please see the Notifications section of the Security WG's Membership and Notifications Governance document.
19
18
 
20
19
  ## Learning More About Security
21
20
 
@@ -13,7 +13,7 @@
13
13
  },
14
14
  {
15
15
  "cell_type": "code",
16
- "execution_count": 1,
16
+ "execution_count": 9,
17
17
  "id": "923aba22-7103-4431-8545-ee5596efa371",
18
18
  "metadata": {},
19
19
  "outputs": [],
@@ -23,7 +23,7 @@
23
23
  },
24
24
  {
25
25
  "cell_type": "code",
26
- "execution_count": 2,
26
+ "execution_count": 10,
27
27
  "id": "057c9730-7b09-49a8-82f1-bc681d880c96",
28
28
  "metadata": {},
29
29
  "outputs": [],
@@ -33,7 +33,7 @@
33
33
  },
34
34
  {
35
35
  "cell_type": "code",
36
- "execution_count": 3,
36
+ "execution_count": 11,
37
37
  "id": "67576531-b66f-42a3-b6e4-460423ca28e0",
38
38
  "metadata": {},
39
39
  "outputs": [],
@@ -44,7 +44,7 @@
44
44
  },
45
45
  {
46
46
  "cell_type": "code",
47
- "execution_count": 4,
47
+ "execution_count": 12,
48
48
  "id": "2717fe66-9e66-4fcc-ae82-0d1ba26892c4",
49
49
  "metadata": {},
50
50
  "outputs": [],
@@ -54,19 +54,19 @@
54
54
  },
55
55
  {
56
56
  "cell_type": "code",
57
- "execution_count": 5,
57
+ "execution_count": 13,
58
58
  "id": "3f286724-0a8f-45b2-80fe-d6d061fe440a",
59
59
  "metadata": {},
60
60
  "outputs": [],
61
61
  "source": [
62
62
  "output += '% THIS FILE IS GENERATED! - Use CLIcommands.ipynb to make it better!\\n'\n",
63
- "output += '# Overview of Codeaudit commands\\n'\n",
64
- "output += f'Codeaudit commands for: {version_id}'"
63
+ "output += '# Commands Overview\\n'\n",
64
+ "output += f'Python Code Audit commands for: {version_id}'"
65
65
  ]
66
66
  },
67
67
  {
68
68
  "cell_type": "code",
69
- "execution_count": 6,
69
+ "execution_count": 14,
70
70
  "id": "693c3354-530b-4a40-a561-ed722d9bb1fa",
71
71
  "metadata": {},
72
72
  "outputs": [],
@@ -77,7 +77,7 @@
77
77
  },
78
78
  {
79
79
  "cell_type": "code",
80
- "execution_count": 7,
80
+ "execution_count": 15,
81
81
  "id": "5fa9a420-bd9a-4641-99c9-de0bcf448dbc",
82
82
  "metadata": {},
83
83
  "outputs": [],
@@ -90,19 +90,18 @@
90
90
  },
91
91
  {
92
92
  "cell_type": "code",
93
- "execution_count": 8,
93
+ "execution_count": 16,
94
94
  "id": "bf6afe56-e0f7-4fa2-a3a5-968bad11bf9c",
95
95
  "metadata": {},
96
96
  "outputs": [],
97
97
  "source": [
98
98
  "commands = { \"overview\": 'overview_report', \n",
99
99
  " \"modulescan\": 'report_module_information',\n",
100
- " \"filescan\" : 'file_scan_report',\n",
101
- " \"directoryscan\" : 'directory_scan_report',\n",
100
+ " \"filescan\" : 'scan_report', \n",
102
101
  " \"checks\" : 'report_implemented_tests',\n",
103
102
  " \"version\" : 'display_version'} \n",
104
103
  "for key, value in commands.items(): \n",
105
- " output += f'## codeaudit {key}\\n' # newlines matter when creating markdown\n",
104
+ " output += f'## Code Audit {key}\\n' # newlines matter when creating markdown\n",
106
105
  " output += '```text\\n' # raw display \n",
107
106
  " func_name = value\n",
108
107
  " output += getattr(codeaudit, func_name).__doc__\n",
@@ -114,7 +113,7 @@
114
113
  },
115
114
  {
116
115
  "cell_type": "code",
117
- "execution_count": 9,
116
+ "execution_count": 17,
118
117
  "id": "0335783c-7676-4099-94c5-c98cc8f2f205",
119
118
  "metadata": {
120
119
  "editable": true,
@@ -135,7 +134,7 @@
135
134
  },
136
135
  {
137
136
  "cell_type": "code",
138
- "execution_count": 10,
137
+ "execution_count": 18,
139
138
  "id": "4667d7ec-3727-4e2d-97b5-6f597c697ec7",
140
139
  "metadata": {},
141
140
  "outputs": [],
@@ -160,7 +159,7 @@
160
159
  "name": "python",
161
160
  "nbconvert_exporter": "python",
162
161
  "pygments_lexer": "ipython3",
163
- "version": "3.13.1"
162
+ "version": "3.13.5"
164
163
  }
165
164
  },
166
165
  "nbformat": 4,
@@ -23,7 +23,7 @@ This simple tool is designed to be simple to use and maintain.
23
23
 
24
24
  **Pull Requests are welcome!**
25
25
 
26
- When you contribute to Codeaudit, your contributions are made under the same license as the file you are working on.
26
+ When you contribute to Python Code Audit, your contributions are made under the same license as the file you are working on.
27
27
 
28
28
 
29
29
  We adopt the [Collective Code Construction Contract(C4)](https://rfc.zeromq.org/spec/42/) to streamline collaboration. C4 is meant to provide a reusable optimal collaboration model for open source software projects.
@@ -7,11 +7,11 @@ parts:
7
7
  - file: features
8
8
  - file: userguide
9
9
  sections:
10
- - file: codeauditoverview
11
- - file: directoryscan
10
+ - file: codeauditoverview
12
11
  - file: filescan
13
12
  - file: modulescan
14
13
  - file: codeauditchecks
14
+ - file: howtoscan
15
15
  - file: whysast
16
16
  - file: issues
17
17
 
@@ -51,17 +51,17 @@ parts:
51
51
  chapters:
52
52
  #- file: astlines
53
53
  # - file: astlines2
54
+ - file: makeitbetter
54
55
  - file: complexitycheck
55
56
  - file: warnings
56
- - file: codeauditcommands
57
+ - file: codeauditcommands
57
58
  - file: changelog
58
59
 
59
60
 
60
-
61
61
  # - caption: API Documentation
62
62
  # chapters:
63
- # - file: modules
64
-
63
+ # - file: codeaudit
64
+
65
65
 
66
66
  - caption: About
67
67
  chapters:
@@ -0,0 +1,12 @@
1
+ codeaudit package
2
+ =================
3
+
4
+
5
+ codeaudit.api\_interfaces module
6
+ --------------------------------
7
+
8
+ .. automodule:: codeaudit.api_interfaces
9
+ :members:
10
+ :undoc-members:
11
+ :show-inheritance:
12
+
@@ -1,6 +1,6 @@
1
1
  % THIS FILE IS GENERATED! - Use CLIcommands.ipynb to make it better!
2
- # Overview of Codeaudit commands
3
- Codeaudit commands for: version: 0.10.0
2
+ # Commands Overview
3
+ Python Code Audit commands for: version: 1.1.0
4
4
  ```
5
5
  ----------------------------------------------------
6
6
  _ __ _
@@ -17,9 +17,8 @@ Depending on the command, a directory or file name must be specified. The output
17
17
 
18
18
  Commands:
19
19
  overview Reports Complexity and statistics per Python file from a directory.
20
- directoryscan Reports potential security issues for all Python files found in a directory.
21
- filescan Reports potential security issues for a single Python file.
22
- modulescan Reports module information per file.
20
+ filescan Scans Python files or directories(packages) for vulnerabilities and reports potential issues.
21
+ modulescan Reports module vulnerability information.
23
22
  checks Creates an HTML report of all implemented security checks.
24
23
  version Prints the module version. Or use codeaudit [-v] [--v] [-version] or [--version].
25
24
 
@@ -27,7 +26,7 @@ Use the Codeaudit documentation to check the security of Python programs and mak
27
26
  Check https://simplifysecurity.nocomplexity.com/
28
27
 
29
28
  ```
30
- ## codeaudit overview
29
+ ## Code Audit overview
31
30
  ```text
32
31
  Reports Complexity and statistics per Python file from a directory.
33
32
 
@@ -45,9 +44,9 @@ or repr(object).
45
44
  encoding defaults to 'utf-8'.
46
45
  errors defaults to 'strict'.
47
46
  ```
48
- ## codeaudit modulescan
47
+ ## Code Audit modulescan
49
48
  ```text
50
- Reports module information per file.str(object='') -> str
49
+ Reports module vulnerability information.str(object='') -> str
51
50
  str(bytes_or_buffer[, encoding[, errors]]) -> str
52
51
 
53
52
  Create a new string object from the given object. If encoding or
@@ -58,41 +57,14 @@ or repr(object).
58
57
  encoding defaults to 'utf-8'.
59
58
  errors defaults to 'strict'.
60
59
  ```
61
- ## codeaudit filescan
60
+ ## Code Audit filescan
62
61
  ```text
63
- Reports potential security issues for a single Python file.
64
-
65
- This function performs security validations on the specified file,
62
+ Scans Python files or directories(packages) for vulnerabilities and reports potential issues.
63
+
64
+ This function performs security validations on the specified file or directory,
66
65
  formats the results into an HTML report, and writes the output to an HTML file.
67
66
 
68
- You can specify the name and directory for the generated HTML report.
69
-
70
- Parameters:
71
- file_to_scan (str) : The full path to the Python source file to be scanned.
72
- filename (str, optional): The name of the HTML file to save the report to.
73
- Defaults to `DEFAULT_OUTPUT_FILE`.
74
-
75
- Returns:
76
- None - A HTML report is written as output
77
- str(object='') -> str
78
- str(bytes_or_buffer[, encoding[, errors]]) -> str
79
-
80
- Create a new string object from the given object. If encoding or
81
- errors is specified, then the object must expose a data buffer
82
- that will be decoded using the given encoding and error handler.
83
- Otherwise, returns the result of object.__str__() (if defined)
84
- or repr(object).
85
- encoding defaults to 'utf-8'.
86
- errors defaults to 'strict'.
87
- ```
88
- ## codeaudit directoryscan
89
- ```text
90
- Reports potential security issues for all Python files found in a directory.
91
-
92
- This function performs security validations on all files found in a specified directory.
93
- The result is written to a HTML report.
94
-
95
- You can specify the name and directory for the generated HTML report.
67
+ You can specify the name of the outputfile and directory for the generated HTML report. Make sure you chose the extension `.html` since the output file is a static html file.
96
68
 
97
69
  Parameters:
98
70
  file_to_scan (str) : The full path to the Python source file to be scanned.
@@ -112,7 +84,7 @@ or repr(object).
112
84
  encoding defaults to 'utf-8'.
113
85
  errors defaults to 'strict'.
114
86
  ```
115
- ## codeaudit checks
87
+ ## Code Audit checks
116
88
  ```text
117
89
 
118
90
  Creates an HTML report of all implemented security checks.
@@ -143,7 +115,7 @@ or repr(object).
143
115
  encoding defaults to 'utf-8'.
144
116
  errors defaults to 'strict'.
145
117
  ```
146
- ## codeaudit version
118
+ ## Code Audit version
147
119
  ```text
148
120
  Prints the module version. Or use codeaudit [-v] [--v] [-version] or [--version].str(object='') -> str
149
121
  str(bytes_or_buffer[, encoding[, errors]]) -> str
@@ -1,9 +1,9 @@
1
1
  # Features
2
2
 
3
- Codeaudit is a modern Python source code analyzer based on distrust.
3
+ Python Code Audit is a modern Python source code analyzer based on distrust.
4
4
 
5
5
 
6
- :::{admonition} This Python Code Audit tool has the following features:
6
+ :::{admonition} Python Code Audit tool has the following features:
7
7
  :class: tip
8
8
 
9
9
 
@@ -15,7 +15,7 @@ Codeaudit is a modern Python source code analyzer based on distrust.
15
15
 
16
16
  +++
17
17
 
18
- * **Module Usage & External Vulnerabilities**: Detects used modules and reports existing vulnerabilities in used modules.
18
+ * **Module Usage & External Vulnerabilities**: Detects used modules and reports known vulnerabilities in used modules.
19
19
 
20
20
 
21
21
  +++
@@ -31,9 +31,9 @@ Codeaudit is a modern Python source code analyzer based on distrust.
31
31
 
32
32
 
33
33
 
34
- Codeaudit has the has the following capabilities:
34
+ Python Code Audit has the has the following capabilities:
35
35
 
36
- * Detect and reports complexity and statistics per Python file or from a directory.
36
+ * Detect and reports complexity and statistics per Python file or from a directory. So you scan a complete Python package before running.
37
37
 
38
38
  Collected statistics are:
39
39
  * Number_Of_Files
@@ -46,7 +46,7 @@ Collected statistics are:
46
46
 
47
47
  * All statistics are gathered per Python file. A summary is given for the inspected directory.
48
48
 
49
- * Detect and reports which module are used within a Python file.
49
+ * Detect and reports which module are used within a Python file.
50
50
 
51
51
  * Reports valuable known security information on used modules.
52
52
 
@@ -1,9 +1,10 @@
1
1
  # Command `codeaudit filescan`
2
2
 
3
- The Codeaudit filescan command creates a report with valuable security information for potential security issues in the Python file.
3
+ The Codeaudit filescan command creates a report with valuable security information for potential security issues in a Python file or Python package (directory with Python files).
4
+
4
5
  See section [validations](checksinformation) for all security checks implemented!
5
6
 
6
- The filescan module works per file.
7
+ The filescan module works on single files or on packages (directory with Python files).
7
8
 
8
9
  To use the `codescan filescan` feature type in the console:
9
10
 
@@ -11,17 +12,31 @@ To use the `codescan filescan` feature type in the console:
11
12
  codeaudit filescan <INPUTFILE> [OUTPUTFILE]
12
13
  ```
13
14
 
14
- The `<INPUTFILE>` is mandatory. Codeaudit will create a detailed security scan report for the given Python file.
15
+ The `<INPUTFILE>` is mandatory. Codeaudit will create a detailed security scan report for the given Python file or directory.
15
16
 
16
17
  If you do not specify [OUTPUTFILE], a HTML output file, a HTML report file is created in the current directory and will be named codeaudit-report.html.
17
18
 
18
19
  When running codeaudit filescan detailed information is determined for a Python file based on more than 60 validations implemented.
19
20
 
20
- The filescan report shows all **potential** security issues that are detected in the source file.
21
+ The filescan report shows all **potential** security issues that are detected in the source file(s).
22
+
21
23
  Per line a the in construct that can cause a security risks is shown, along with the relevant code lines where the issue is detected.
22
24
 
23
25
  ![Example view of filescan report](filescan.png)
24
26
 
27
+
28
+ :::{note}
29
+ The `codeaudit filescan` command does **NOT** include all directories. This is done on purpose!
30
+
31
+ The following directories are skipped by default:
32
+ * `/docs`
33
+ * `/docker`
34
+ * `/dist`
35
+ * `/tests`
36
+ * all directories that start with `.` (dot) or `_` (underscore)
37
+ :::
38
+
39
+
25
40
  ## Example
26
41
 
27
42
  ```
@@ -37,23 +52,23 @@ Example report of a [codeaudit filescan report](examples/filescan.html) that is
37
52
 
38
53
  ```
39
54
  NAME
40
- codeaudit filescan - Reports potential security issues for a single Python file.
55
+ codeaudit filescan - Scans Python files or directories(packages) for vulnerabilities and reports potential issues.
41
56
 
42
57
  SYNOPSIS
43
- codeaudit filescan FILE_TO_SCAN <flags>
58
+ codeaudit filescan INPUT_PATH <flags>
44
59
 
45
60
  DESCRIPTION
46
- This function performs security validations on the specified file,
61
+ This function performs security validations on the specified file or directory,
47
62
  formats the results into an HTML report, and writes the output to an HTML file.
48
63
 
49
- You can specify the name and directory for the generated HTML report.
64
+ You can specify the name of the outputfile and directory for the generated HTML report. Make sure you chose the extension `.html` since the output file is a static html file.
50
65
 
51
66
  POSITIONAL ARGUMENTS
52
- FILE_TO_SCAN
53
- The full path to the Python source file to be scanned.
67
+ INPUT_PATH
54
68
 
55
69
  FLAGS
56
70
  -f, --filename=FILENAME
57
71
  Default: 'codeaudit-report.html'
58
72
  The name of the HTML file to save the report to. Defaults to `DEFAULT_OUTPUT_FILE`.
73
+
59
74
  ```
@@ -0,0 +1,113 @@
1
+ # How to do a SAST test?
2
+
3
+ Running a Static Application Security Test (SAST) on Python code is essential for ensuring security. It’s also a straightforward [shift-left practice](https://nocomplexity.com/documents/simplifysecurity/intro.html#) that takes only a fraction of your time yet can help you avoid serious security incidents.
4
+
5
+
6
+
7
+ Follow these steps to perform a **static application security test (SAST)** on Python projects using **Python Code Audit**.
8
+
9
+
10
+
11
+ ## 1. Install Python Code Audit
12
+
13
+ [Python Code Audit](https://pypi.org/project/codeaudit/) is an open-source, zero-configuration tool that validates whether your Python code introduces potential security vulnerabilities.
14
+
15
+ Install (or update) it with:
16
+
17
+ ```bash
18
+ pip install -U codeaudit
19
+ ```
20
+
21
+ :::{tip}
22
+ Even if you already have it installed, it’s recommended to run the command again to ensure you’re using the latest checks and features.
23
+ :::
24
+
25
+
26
+
27
+ ## 2. Clone the Repository you want to scan
28
+
29
+ To clone a repository:
30
+
31
+ 1. Go to the repository page (e.g., on GitHub).
32
+ 2. Click the green **Code** button.
33
+ 3. Copy the HTTPS URL.
34
+ 4. Run:
35
+
36
+ ```bash
37
+ git clone <repository_url>
38
+ ```
39
+
40
+ **Example:** Clone the [Pydantic library](https://github.com/pydantic/pydantic):
41
+
42
+ ```bash
43
+ git clone https://github.com/pydantic/pydantic.git
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 3. Generate an Overview Report
49
+
50
+ Navigate into the cloned repository, then run:
51
+
52
+ ```bash
53
+ codeaudit overview
54
+ ```
55
+
56
+ This command provides:
57
+ - Total number of files
58
+ - Total lines of code
59
+ - Imported modules
60
+ - Complexity per file
61
+ - Overall complexity score
62
+
63
+ :::{tip}
64
+ 📖 More detailed explanations of these metrics can be found in the [Python Code Audit documentation](https://nocomplexity.com/documents/codeaudit/intro.html).
65
+ :::
66
+
67
+
68
+
69
+ ---
70
+
71
+ ## 4. Run a Full Directory Scan
72
+
73
+ To scan every file in the repository, use:
74
+
75
+ ```bash
76
+ codeaudit filescanscan <DIRECTORY> [OUTPUTFILE]
77
+ ```
78
+
79
+ - `DIRECTORY`: Path to the repository folder (e.g., `pydantic`).
80
+ - `OUTPUTFILE` *(optional)*: Name of the HTML report file. If omitted, a default report is created.
81
+
82
+ **Example:** Scan the cloned Pydantic package:
83
+
84
+ ```bash
85
+ codeaudit filescan pydantic
86
+ ```
87
+
88
+ ---
89
+
90
+ ## 5. Review the Security Report
91
+
92
+ The scan generates a static **HTML report** in the directory where you ran the command.
93
+
94
+ Example output path:
95
+
96
+ ```
97
+ file:///home/usainbolt/testdir/codeaudit-report.html
98
+ ```
99
+
100
+ - On **Linux**, you can usually click the link directly in the terminal.
101
+ - On **Windows**, you may need to manually copy and paste the file path into your browser.
102
+
103
+ ---
104
+
105
+ ✅ You now have a detailed static application security test (SAST) report highlighting potential security issues in your Python code.
106
+
107
+
108
+ :::{hint}
109
+ If you need assistance with solving or want short and clear advice on possible security risks for your context:
110
+
111
+ Get expert security advice from one of our [sponsors](sponsors)!
112
+
113
+ :::