airbytehq / airbytehq/airbyte-python-cdk

Security: Implement RestrictedPython for safer custom code execution

未關閉
#235 0 則留言 2 個 reaction 已指派 1 人 已被 @aaronsteers 認領 在 GitHub 檢視
主要語言
Python
星號
26
分支
53
平均合併
2 天 6 小時
30 天內合併 PR
10

描述

## 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](https://restrictedpython.readthedocs.io/) to provide a safer execution environment for custom code. This will:

1. Restrict access to potentially dangerous builtins
2. Run code in an isolated namespace
3. 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.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。