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.
.. image:: https://img.shields.io/pypi/v/bjorn.svg :target: https://pypi.python.org/pypi/bjorn
.. image:: https://github.com/juanmcristobal/bjorn/actions/workflows/test.yml/badge.svg?branch=master :target: (https://github.com/juanmcristobal/bjorn/actions/workflows/test.yml
.. image:: https://coveralls.io/repos/github/juanmcristobal/bjorn/badge.svg?branch=master :target: https://coveralls.io/github/juanmcristobal/bjorn?branch=master
.. image:: https://readthedocs.org/projects/bjorn/badge/?version=latest :target: https://bjorn.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status
The Bjorn module loads a configuration file for your python script.
To install bjorn, run this command in your terminal:
.. code-block:: console
$ pip install bjorn
A settings file is just a Python module with module-level variables. Settings example:
.. code-block:: python
import os
LOGGING_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {"format": "%(asctime)s [%(levelname)s] %(name)s: %(message)s"},
},
"handlers": {
"default": {
"level": "INFO",
"formatter": "standard",
"class": "logging.StreamHandler",
},
"file_handler": {
"level": "INFO",
"filename": "/tmp/mylogfile.log",
"class": "logging.FileHandler",
"formatter": "standard",
},
},
"loggers": {
"job": {
"handlers": ["default"],
"level": os.environ.get("LOGGER_LEVEL", "INFO"),
"propagate": True,
},
},
}
VALUE_TO_TEST = "A"
Because a settings file is a Python module, the following apply:
It doesn’t allow for Python syntax errors.
It can assign settings dynamically using normal Python syntax. For example:
.. code-block:: python
MY_SETTING = [str(i) for i in range(30)]
JOB_SETTINGS When you use Bjorn, you have to tell it which settings you’re using. Do this by using an environment variable, JOB_SETTINGS.
The value of JOB_SETTINGS should be in Python path syntax, e.g. mysite.settings. Note that the settings module should be on the Python import search path.
Create a settings.py file in the root of the project. Then you can call it from your script using the following way.
.. code-block:: python
from bjorn.config import settings
if __name__ == '__main__':
print(settings.VALUE_TO_TEST)
FAQs
It loads different configurations depending on the environment variable.
We found that bjorn 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.