Security: Implement RestrictedPython for safer custom code execution
@aaronsteers is already working on this.
Since Jan 21, 2025.
Assessment
This issue has not been assessed yet.
Description
Background
Currently, the custom code compiler uses raw exec() to execute user-provided Python code, which could potentially be unsafe as it has unrestricted access to Python builtins and the global namespace.
Proposed Solution
Implement RestrictedPython to provide a safer execution environment for custom code. This will:
- Restrict access to potentially dangerous builtins
- Run code in an isolated namespace
- Prevent access to sensitive operations
References
- Original PR discussion: https://github.com/airbytehq/airbyte-python-cdk/pull/174#discussion_r1917458832
Implementation Notes
- Add RestrictedPython as a dependency
- Replace current
exec()implementation with RestrictedPython's secure execution - Add tests to verify security restrictions are working as expected
Security Considerations
This enhancement will improve the security posture of the custom code execution feature by preventing potentially malicious code from accessing sensitive operations or resources.
- Dominant language
- Python
- Stars
- 26
- Forks
- 53
- Avg merge
- 7d 2h
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from airbytehq/airbyte-python-cdk
-
airbyte-cdk connector test: --no-creds crashes when combined with --pytest-arg (tuple has no extend) Opencommunity
Difficulty 1/5 Under an hour Newbie friendliness 88/100
airbytehq/airbyte-python-cdk#1153 ·
-
community
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
airbytehq/airbyte-python-cdk#1147 ·
-
community
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
airbytehq/airbyte-python-cdk#1137 ·
-
community
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
airbytehq/airbyte-python-cdk#1127 · 1 comment ·
-
community
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
airbytehq/airbyte-python-cdk#1118 · 2 comments ·
All issues in airbytehq/airbyte-python-cdk
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stephrobert/dsoxlab#238 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
sublimehq/package_control#1780 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
nwg-piotr/nwg-displays#145 ·