airbytehq / airbytehq/airbyte-python-cdk

Security: Implement RestrictedPython for safer custom code execution

Đang mở
#235 0 bình luận 2 reaction 1 người được giao Được @aaronsteers nhận Xem trên GitHub
Ngôn ngữ chính
Python
Star
26
Fork
53
Merge trung bình
2 ngày 6 giờ
Pull request đã merge (30 ngày)
10

Mô tả

## 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.