Skip to content

Commit 0935302

Browse files
refactor: Restructure configurable security policy PR
- Move example to examples/20_security_policy/ directory structure - Rename files to match requested naming convention: - configurable_security_policy.py (main example) - custom_policy.j2 (example custom policy template) - Update example code to work with new file structure - Remove extra files to keep PR focused on essential changes - Maintain test compatibility with custom_security_policy.j2 Co-authored-by: openhands <openhands@all-hands.dev>
1 parent 4fe47dc commit 0935302

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

examples/20_configurable_security_policy.py renamed to examples/20_security_policy/configurable_security_policy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
4. Test with relaxed or stricter security policies
1616
1717
Usage:
18-
python examples/20_configurable_security_policy.py
18+
python examples/20_security_policy/configurable_security_policy.py
1919
"""
2020

2121
from pathlib import Path
@@ -30,11 +30,11 @@ def setup_example_security_policy():
3030
"""Set up the example custom security policy template."""
3131
# Get the path to the SDK prompts directory
3232
current_dir = Path(__file__).parent
33-
sdk_dir = current_dir.parent / "openhands" / "sdk" / "agent" / "prompts"
33+
sdk_dir = current_dir.parent.parent / "openhands" / "sdk" / "agent" / "prompts"
3434

3535
# Read the example custom security policy
36-
example_policy_path = current_dir / "example_custom_security_policy.j2"
37-
target_policy_path = sdk_dir / "example_custom_security_policy.j2"
36+
example_policy_path = current_dir / "custom_policy.j2"
37+
target_policy_path = sdk_dir / "custom_policy.j2"
3838

3939
# Copy the example policy to the prompts directory if it doesn't exist
4040
if not target_policy_path.exists():
@@ -44,7 +44,7 @@ def setup_example_security_policy():
4444
f.write(content)
4545
print(f"Created example security policy at: {target_policy_path}")
4646

47-
return "example_custom_security_policy.j2"
47+
return "custom_policy.j2"
4848

4949

5050
def main():
File renamed without changes.
File renamed without changes.
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# 🔒 Custom Security Policy
22

3+
This is a custom security policy template created for testing purposes.
4+
35
## Custom Security Rules
46

7+
- Custom Guidelines
58
- This is a custom security policy template
6-
- Used for testing configurable security policy functionality
7-
- Contains different content than the default policy
9+
- Custom security rules apply here
810

911
## Custom Guidelines
1012

11-
- Follow custom security guidelines
12-
- Test that custom templates are properly loaded
13+
- Follow custom security practices
14+
- Implement custom security measures
15+
- Adhere to custom security protocols

0 commit comments

Comments
 (0)