Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Basic auth utilities for Django.
Tested under...
Python
Django
::
pip install django-basicauth
.. code-block:: python
from basicauth.decorators import basic_auth_required
@basic_auth_required
def myview(request):
...
or by a middleware.
.. code-block:: python
MIDDLEWARE = (
'basicauth.middleware.BasicAuthMiddleware',
...
)
To apply basic auth for specific requests,
Use target_test
argument.
In the below code, anonymous users will be required Basic Auth
Authenticated users can pass it without Basic ...
header.
.. code-block:: python
from basicauth.decorators import basic_auth_required
@basic_auth_required(
target_test=lambda request: not request.user.is_authenticated
)
def myview(request):
...
target_test
accepts typing.Callable[[HttpRequest], bool]
,
and if the callable returns True
, Basic Auth will be required.
To apply @basic_auth_required
decorator to Class Based Views,
use django.utils.decorators.method_decorator
.
.. code-block:: python
from django.utils.decorators import method_decorator
from basicauth.decorators import basic_auth_required
@method_decorator(basic_auth_required, name='dispatch')
class YourView(TemplateView):
template_name = "my-template.html"
BASICAUTH_USERS
(required): Dictionary including keys as username and values as passwords.BASICAUTH_REALM
: realm string, default is "Secure resource".BASICAUTH_DISABLE
: Disable all of barriers by this library.target_test
argument for the decorator.BASICAUTH_DISABLE
settingbasicauthutils.validate_request
FAQs
Basic auth utilities for Django.
We found that django-basicauth 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.