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.
@grundstein/commons
Advanced tools
@grundstein/commons. shared library functionality, server middleware, lib and init functions.
this is the commonly shared codebase for all grundstein servers.
npm i --save-exact @grundstein/commons
Below are all imports possible from this library.
TODO: Add usage examples.
import commons, { fs, is, lib, log, middleware } from '@grundstein/commons'
import lib from '@grundstein/commons/lib.mjs'
import middleware from '@grundstein/commons/middleware.mjs'
commons.log.info('commons are usable now.')
exports @magic/fs, a promisified version of fs with some added functionality.
exports @magic/is, a comprehensive runtime type checking library.
serverside logging functionality, basically a fancy wrapper around console.log that outputs a json object. those logs get collected by systemd and can be viewed and managed using journalctl.
various utility functions
Looks for a directory with https certificates, and starts a nodejs https or http server depending on the existence of said certificates.
import { lib, log } from '@grundstein/commons'
const listener = lib.createServer({
// this directory has to be readable by the executing user (in prod, this is "grundstein")
certDir: '/absolute/dir/to/certs',
host: '1.2.3.4',
port: '3000',
startTime: log.hrtime(),
})
used by lib.createServer to get the https context set up.
tests if req.url is empty, includes ://, or does not start with '/', calls req.socket.destroy if malicious request is detected.
adds req.startTime field.
used to check etag values against a cache of files to use 304 headers for cached content. cache is either built on-demand or using the pre-built etags.csv file that @grundstein/prepare-static-files generates.
returns the ip address of a request. by default, this function will replace the last block of the ip address by xxx.
get a formatted date and time string
returns 'br', 'gzip', 'deflate', 'buffer' in that order, depending on contents of req.headers['accept-encoding']
returns the time elapsed between two hrtime values, as a string, normalized to seconds, milliseconds or nanoseconds, and ending with the unit.
reads config.proxyFile using fs, splits it at newlines and returns the resulting array
checks if file is truthy and has a file.buffer key.
collects data from request, response and headers, then returns a one-line json string that can be console.log(ged).
prepares the headers and body of a response, then sends it to the client and logs it.
sets Content-Type and Content-Encoding headers, checks if compressed file exists and accept-encoding accepts it, then sends the correct content with correct headers using lib.respond
sends a file as a stream.
first release
update dependencies
make sure that lib/createSecureContext does not try to find keys in the root keystore, only in subdirectories
update dependencies
update dependencies
update dependencies
update dependencies
update dependencies
...
FAQs
@grundstein/commons. shared library functionality, server middleware, lib and init functions.
We found that @grundstein/commons demonstrated a not healthy version release cadence and project activity because the last version was released 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.
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.