Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Basically, it comes down to the following statement:
{% lazy 'apps.core.partial_views._machine_card' poll_status.machine_id %}
{% include 'core/partials/_machine_card_loading.html' with name=poll_status.name machine_id=poll_status.machine_id %}
{% endlazy %}
The content inside the lazy tag is rendered right away in a turbo-frame with a src tag that points to an auto generated URL where the view given lazy controller is called (with the parameters given in the controller). So this can be a slow loading view as its lazy loaded. This is based on turbo-frames, i.e. the lazy loading is client initiated. With something like turbo-streams (and the django implementation), it would be possible to push the update from the server which would be even cooler (especially a single channel could be used for multiple elements). So, the page will be rendered as follows:
<turbo-frame id="1c87a216-6ad5-4320-861e-261caf3e5dd7" src="/lazy/?token=eyJpZCI6ICIxYzg3YTIxNi02YWQ1LTQzMjAtODYxZS0yNjFjYWYzZTVkZDciLCAidmlldyI6ICJhcHBzLmNvcmUucGFydGlhbF92aWV3cy5fbWFjaGluZV9jYXJkIiwgImFyZ3MiOiBbMV0sICJrd2FyZ3MiOiB7fX0=">
<div class="card bg-primary text-white mb-4">
<div class="card-body">
<b>Machine 1</b>
</div>
<div class="card-footer" style="height: 7rem;">
<div class="d-flex justify-content-center">
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
<div class="card-footer d-flex align-items-center justify-content-between">
<a class="small text-white stretched-link"
href="/machine/1/" target="_top">View Details</a>
<div class="small text-white"><i class="fas fa-angle-right"></i></div>
</div>
</div>
</turbo-frame>
And a call to /lazy/?token=...
will return the response of calling the view function
apps.core.partial_views._machine_card
with given positional argument poll_status.machine_id
also wrapped inside
a <turbo-frame>
tag with the same id
so that it will automatically swapped by turboframe.
A complete example can be found under example/django_example
.
Go to this directory and proceed.
Optionally, create a custom virtualenv
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
If you want to use the current snapshot of turbo-lazy
install it via
pip install ../../
Then start everything via
python manage.py migrate
python manage.py runserver
and go to
http://localhost:8000/
0.2.2
django-tag-parser>=3.2
was missing in setup.py
0.2.1
0.2.0
{% include_view %}
was added to integrate complete views into templates (in module partials
)0.1.2
0.1.1
0.1.0
FAQs
Turbo-Frame based Lazy Loading
We found that turbo-lazy 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.