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.
toolman.org/terminal/decor
Package decor provides facilities for decorating a string of characters with display attributes for the current (or specified) terminal type. This is done using a notation inspired by (but slightly different from) Zsh prompt formatting. Supported attributes are bold, italic, and/or underlined characters as well as 256-color support for foreground and background colors.
At its basis, this package is about decorating short blurbs of text to display in a terminal. As a simple example, consider the following program:
package main
import (
"fmt"
"os"
"toolman.org/terminal/decor"
)
func main() {
d, err := decor.New()
if err != nil {
panic(err)
}
input := "[@B@F{44}@Iuser@i@F{Orchid1}@@@F{Green3}host@f@b]"
output, err := d.Format(input)
if err != nil {
panic(err)
}
fmt.Printf("\nTERM....: %q\n\n", os.Getenv("TERM"))
fmt.Printf("Input...: %q\n\n", input)
fmt.Printf("Quoted..: %q\n\n", output)
fmt.Printf("RAW.....: %s\n\n", output)
}
When executed, this emits output similar to the following:
This shows I'm using a terminal of type rxvt-256color
, the input I'd like to format,
a quoted representation of the formatted output for this terminal and then the output
as rendered by the terminal itself.
Below is a quick-n-dirty chart that walks through each of the attribute markings used above:
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.