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.
github.com/mwat56/cssfs
Cascading Style Sheets (CSS) needed a long time to become browser independently usable. In this long time the capabilities seem to have grown almost beyond recognition. One thing, however, that didn't change over the last 25 years is the fact that in the end a style sheet is just a plain old text file. Sure, there is some sort of grammar and a certain vocabulary; but it all boils down to lines/paragraphs, preferably nicely formatted to make it easy to read and edit.
Easy, that is, for humans. For the machines (browser) almost all of the tabs, spaces, and linebreaks used to format a style sheet are just white space eating memory, white noise to be removed – or at least actively ignored – during reading and interpreting the file.
Additionally, that white space – during transfer – uses bandwidth and hence time and energy. So, getting rid of all those unneeded characters in the style sheet before transmitting it to the end-user (browser) saves both time and money for all parties involved. And that's the whole purpose of this little package: To remove the unneeded characters from a style sheet.
You can use Go
to install this package for you:
go get -u github.com/mwat56/cssfs
or you can just include it directly in your own server's code base
import "github.com/mwat56/cssfs"
This package exports a single function FileServer()
.
So, while you're used to call
myCSSDirectory := "./css"
myCSSHandler := http.FileServer(http.Dir(myCSSDirectory)))
to create a fileserver for your static CSS files now, to use this implementation, you'd just do:
myCSSHandler := cssfs.FileServer(myCSSDirectory)
That's all.
Internally, whenever a CSS file is requested this package's fileserver checks whether there's already a minified version available and, if so, serves it. Otherwise it creates the minified version from the original CSS file to be used for this and all following calls.
This package expects wellformed CSS files.
If you find problems – i.e. incorrectly minified CSS – please let me know (e.g. file an issue
).
Copyright © 2020, 2022 M.Watermann, 10247 Berlin, Germany
All rights reserved
EMail : <support@mwat.de>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You should have received a copy of the GNU General Public License along with this program. If not, see the GNU General Public License for details.
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.