collective / collective/rapido.core
document whitelisting protected imports
- Dominant language
- Python
- Stars
- 2
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
I'll modify the docs but for now it works kind of like this
```
from zope.security.checker import defineChecker, CheckerPublic, NamesChecker
import random
defineChecker(random, NamesChecker([meth for meth in dir(random) if meth[0] != '_']))
```
I suspect there are better ways but this works for now.
For classes this works
```
import persistent.list
import persistent.dict
defineChecker(persistent.list, NamesChecker(['PersistentList']))
defineChecker(persistent.dict, NamesChecker(['PersistentDict']))
dict_checker = NamesChecker(['__call__','__init__','__getitem__', '__len__', '__iter__',
'get', 'has_key', 'copy', '__str__', 'keys',
'values', 'items', 'iterkeys', 'iteritems',
'itervalues', '__contains__'])
persistent.dict.PersistentDict.__Security_checker__ = dict_checker
list_checker = NamesChecker(['__call__','__init__','__getitem__', '__getslice__', '__len__', '__iter__',
'__contains__', 'index', 'count', '__str__',
'__add__', '__radd__','__setitem__' ])
persistent.list.PersistentList.__Security_checker__ = list_checker
```
Contributor guide
No contributing guide indexed for this repository
Research direction
No documentation file or test is named in the issue. Start by locating the project documentation covering protected imports and security checkers, then use the supplied random, PersistentDict, and PersistentList examples to document the supported whitelisting approach; done means the examples and guidance are incorporated clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation, security
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100