Implement policy system with comprehensive testing and configuration
Some checks failed
Go / build (push) Has been cancelled
Some checks failed
Go / build (push) Has been cancelled
- Introduced a new policy system for event processing, allowing fine-grained control over event storage and retrieval based on various criteria. - Added support for policy configuration via JSON files, including whitelists, blacklists, and custom scripts. - Implemented a test suite for the policy system, ensuring 100% test coverage of core functionality and edge cases. - Created benchmark tests to evaluate policy performance under various conditions. - Updated event handling to integrate policy checks for both read and write access. - Enhanced documentation with examples and usage instructions for the policy system. - Bumped version to v0.16.0.
This commit is contained in:
41
docs/example-policy.json
Normal file
41
docs/example-policy.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"kind": {
|
||||
"whitelist": [1, 3, 5, 7, 9735],
|
||||
"blacklist": []
|
||||
},
|
||||
"rules": {
|
||||
"1": {
|
||||
"description": "Text notes - allow all authenticated users",
|
||||
"write_allow": [],
|
||||
"write_deny": [],
|
||||
"read_allow": [],
|
||||
"read_deny": [],
|
||||
"size_limit": 32000,
|
||||
"content_limit": 10000
|
||||
},
|
||||
"3": {
|
||||
"description": "Contacts - only allow specific users",
|
||||
"write_allow": ["npub1example1", "npub1example2"],
|
||||
"write_deny": [],
|
||||
"read_allow": [],
|
||||
"read_deny": [],
|
||||
"script": "policy.sh"
|
||||
},
|
||||
"5": {
|
||||
"description": "Deletion events - require authentication",
|
||||
"write_allow": [],
|
||||
"write_deny": [],
|
||||
"read_allow": [],
|
||||
"read_deny": [],
|
||||
"privileged": true
|
||||
},
|
||||
"9735": {
|
||||
"description": "Zap receipts - allow all",
|
||||
"write_allow": [],
|
||||
"write_deny": [],
|
||||
"read_allow": [],
|
||||
"read_deny": [],
|
||||
"size_limit": 10000
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user