Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
django-api-permission
Advanced tools
A Django api permission manager that helps you custom api url in regular expression and control access.
A Django api permission manager that helps you custom api url in regular expression and control access.
pip install django-api-permission
INSTALLED_APPS = [
...
'api_permission',
...
]
MIDDLEWARE = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
...
'api_permission.middleware.APIPermCheckMiddleware',
]
./manage.py migrate api_permission
set API_PERMISSION_CONF
in your settings.py as a dict.
API_PERMISSION_CONF = {
'API_PREFIX': ['api/topic/'], # default is /
'PERMISSION_DENIED_CODE': 1, # default is 1
'AUTHORIZATION_HEADER': 'HTTP_AUTHORIZATION', # default is HTTP_AUTHORIZATION
'ADMIN_SITE_PATH': '/admin/', # default is /admin/
'TOKEN_EXPIRE': 15, # unit is days, default is None, which won't check token expire.
}
You can custom API_PREFIX
as a str like '/'
or list like ['api/account', 'api/topic']
.
** When you set TOKEN_EXPIRE
, you need add below in your REST_FRAMEWORK
settings. **
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
...
'api_permission.authentication.ExpireTokenAuthentication',
),
}
FAQs
A Django api permission manager that helps you custom api url in regular expression and control access.
We found that django-api-permission demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.