patched-codes / patchwork

Automate code reviews, patching and documentation with self-hosted LLM workflows.
https://patched.codes
GNU Affero General Public License v3.0
1.14k stars 74 forks source link

PatchWork AutoFix #1006

Closed patched-admin closed 3 weeks ago

patched-admin commented 3 weeks ago

This pull request from patched fixes 3 issues.


* File changed: [patchwork/common/utils/step_typing.py](https://github.com/patched-codes/patchwork/pull/1006/files#diff-4490efb269fda5b75b1edc5f5fa275d34675bca1ffbb22e06829384e562205ff)
Add whitelisted module import to prevent arbitrary code execution The code now includes a whitelist of allowed modules to be imported, preventing arbitrary or malicious code from being loaded through `importlib.import_module()`.
* File changed: [patchwork/app.py](https://github.com/patched-codes/patchwork/pull/1006/files#diff-839e90b808d34e4cf447eff0896161788ccfc6e1f2970be2e551b64ba413a503)
Fix untrusted user input in importlib.import_module with module path whitelist Implemented a whitelist check to ensure only pre-approved module paths are used in the importlib.import_module function call.
* File changed: [patchwork/common/utils/dependency.py](https://github.com/patched-codes/patchwork/pull/1006/files#diff-6ad070db06c1de59a1e0b0b199944f057089f121f94abdf817a0845e3c5d81f6)
Implement whitelist for safely importing modules Introduced a whitelist to ensure only predefined modules can be imported using `import_with_dependency_group`.