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 is a wrapper for openpyxl_ which makes creating XLSX documents with the purpose of exporting data less boring::
from xlsxdocument import XLSXDocument
def xlsx_export(request):
some_data = Bla.objects.all()
xlsx = XLSXDocument()
xlsx.table_from_queryset(Bla.objects.all())
return xlsx.to_response('bla.xlsx')
Adding in additional cells at the end is also possible::
xlsx = XLSXDocument()
xlsx.table_from_queryset(
Bla.objects.all(),
additional=[(
'Full URL',
lambda instance: 'http://example.com%s' % (
instance.get_absolute_url(),
),
)],
)
You can also easily add the facility to export rows to Django's administration interface::
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from xlsxdocument import export_selected
from app import models
class AttendanceAdmin(admin.ModelAdmin):
list_filter = ('event',)
actions = (export_selected,)
admin.site.register(models.Event)
admin.site.register(models.Attendance, AttendanceAdmin)
If you require additional columns with export_selected
use this
snippet instead::
from xlsxdocument import create_export_selected
class AttendanceAdmin(...):
actions = [
create_export_selected(
additional=[
# ... see above
]
)
]
.. _openpyxl: https://openpyxl.readthedocs.io/
FAQs
Easily create XLSX documents with Django
We found that xlsxdocument demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.