You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .rules/new_models_best_practice.mdc
+148-1Lines changed: 148 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,154 @@ Each example should contain the following files:
33
33
34
34
- Reference the main repository README to help users understand how to install and run the ML backend.
35
35
- Include labeling configuration examples in the example README so users can quickly reproduce training and inference.
36
-
- Provide troubleshooting tips or links to Label Studio documentation such as [Writing your own ML backend](mdc:https:/labelstud.io/guide/ml_create): https://labelstud.io/guide/ml_create.
36
+
- Provide troubleshooting tips or links to Label Studio documentation such as [Writing your own ML backend](https://labelstud.io/guide/ml_create).
37
+
38
+
## 3.1. Security Best Practices
39
+
40
+
When implementing ML backends, follow these security guidelines:
41
+
42
+
- **Model Serialization**: Use secure serialization methods (e.g., PyTorch `state_dict` with `weights_only=True` for PyTorch 2.6+)
43
+
- **Input Validation**: Validate all user inputs, file formats, and data types before processing
44
+
- **Environment Variables**: Never hardcode sensitive information like API keys; use environment variables
45
+
- **File Access**: Restrict file system access to designated directories (`MODEL_DIR`, temp directories)
46
+
- **Dependencies**: Pin dependency versions and regularly update for security patches
0 commit comments