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.
git.sr.ht/~mariusor/assets/examples/004-minified-fs
This is an example that's more elaborate and closer to real world use cases corresponding to a web application.
We have a ./static
folder which contains all multiple types of files,
CSS styles, JavaScript files, an SVG document and some other plain text or binary resources.
For the stylesheets, JavaScript files and the SVG document we want to minify them before using them as a assets in our binary.
Because //go:embed
doesn't support adding functionality into the embed pipeline, we are forced
to create our own generator, which creates a fs.FS
compatible object, that we map our assets group
on top of.
To use this example:
# the minify warnings can be ignored, the undeclared mount variable is what the script eventually generates
go generate main.go
minify: checking package: main.go:12:32: undeclared name: mount
minify: proceeding anyway...
go run main.go
2022/08/05 14:11:06 [GET] /main.js 3.006738ms
Load one file:
# since the example files are very simple, the only hint that they have
# been minified is the fact that there's no new line between the
# two function calls.
curl http://localhost:6699/main.js
console.log("Hello!!!");console.error("Minification!!");
FAQs
Unknown package
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.