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.
This library is collecting metadata about your test executions, and enables you to send it to a datastore of your liking.
The library is designed in a hexagonal architecture in mind - separating data collection and reporting. There are two main parts to the code - metadata collection and reporting. the collection engine stores the metadata in pytest's stash (for session and for test) and uses pytest built-in hooks in order to populate the data and trigger the reporting. The reporting part is allowing reporters to register, then delegates the actual work to the registered reporters, enabling easy customization.
In order to include pytest-stats capabilities in your code, all you need to do is to install the package pip install pytest-stats
.
However, this will only provide you with a text report provided by the built-in DefaultTextReporter.
In order to store the data in your own DB you'll need to:
ResultsReporter
class)pytest_stats_register_reporters
.@pytest.hookimpl()
def pytest_stats_register_reporters(reporters:'ReportersRegistry'):
reporters.register(MyReporter())
Most data is collected by hooking the following pytest-provided hooks:
pytest_sessionstart
pytest_sessionfinish
pytest_runtest_protocol
pytest_runtest_makereport
pytest_exception_interact
pytest_stats_register_reporters
: used to register a new reporter. More than one reporter can be registered at the same hook. pytest_configure
pytest_stats_env_data
: Enables adding custom environment information to the session data. pytest_sessionstart
get_test_session_data(session: 'Session') -> TestSessionData
- can be used to fetch the session data in an arbitrary locationget_test_item_data(item: 'Item') -> TestItemData
- can be used to fetch the current test data in arbitrary location. For instance, one can call get_test_item_data(item=request.node).foo="bar"
FAQs
Collects tests metadata for future analysis, easy to extend for any data store
We found that pytest-stats 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.