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.
👔 Fully typed minimal platform-agnostic logger
npm
npm i tie-logger
Yarn
yarn add tie-logger
pnpm
pnpm add tie-logger
/** @file: logger.js */
import { Logger, logLevels, filter } from "tie-logger";
export const logger = new Logger(
"app", // Root logger name
logLevels(), // Define log levels. By default are: verbose, debug, info, warn, error, fatal
// You can use custom levels by using
// logLevels("info", "warn", "error")
{
// Custom data
appVersion: "3.1"
moduleName: "root",
moduleVersion: "1.0.0"
}
);
export const child = logger.child(
// Child logger name
"auth",
// Child logger data
{ moduleName: "auth", moduleVersion: "0.3.1" }
);
const criticalLogs = [];
const unsubscribe = logger.subscribe(
// Subscribe to all logs, they go to console
(log) => console.log(...log.message.parts),
// All logs, that level is greater or equal than "warn" will be added to critical logs
// Severity is determined by index of level in levels array
// Current array is: verbose, debug, info, warn, error, fatal
// [less] <<< ^^^^ >> [greater]
filter(">=", "warn", (log) => criticalLogs.push(log))
)
process.on("SIGINT", () => {
unsubscribe();
})
/** @file: index.js */
import { child, logger } from "./logger.js";
const PORT = parseInt(process.env.PORT) || 3000;
logger.subscribe(log => console.log(log));
child.log.debug`Application initialized. Port: ${{ port: PORT }}. Environment: ${{process.env}}`;
// Level: ^^^^^
// Here goes app
({
// One of defined levels
level: "debug",
message: {
template:
"Application initialized. Port: {port}. Environment: {SHELL,COLORTERM,PWD}",
plain:
'Application initialized. Port: 3000. Environment: {"SHELL":"/bin/bash","COLORTERM":"truecolor","PWD":"/home/alexxgrib/Projects/tie-logger"}',
parts: [
"Application initialized. Port:",
{ port: 3000 },
". Environment: ",
{
SHELL: "/bin/bash",
COLORTERM: "truecolor",
PWD: "/home/alexxgrib/Projects/tie-logger"
}
]
},
// merge of
// - logger data
// - logger parents data
// - data passed in log message
data: {
appVersion: "3.1",
moduleName: "auth",
moduleVersion: "0.3.1",
port: 3000,
SHELL: "/bin/bash",
COLORTERM: "truecolor",
PWD: "/home/alexxgrib/Projects/tie-logger"
},
context: {
// name of the logger
name: "auth",
// list of logger inheritance
path: ["app", "auth"]
},
// logger object
origin: child
});
FAQs
👔 Fully typed minimal platform-agnostic logger
We found that tie-logger 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
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.