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.
Convert all links inside a string to HTML anchor tags. It supports.
rel="noreferrer noopener"
as a security measure.www
.The code is hand-written in ES5 and is supposed to work with all major browsers. It makes use of var
over let or const
and for
over forEach
.
But you will need a commonjs module loader to make use of it.
npm i --save anchorify
const anchorify = require('anchorify')
assert.equal(
anchorify('Visit google.com'),
'Visit <a href="http://google.com"> google.com </a>'
)
// Set custom target
assert.equal(
anchorify('Visit google.com', { target: '_blank' }),
'Visit <a href="http://google.com" target="_blank" ref="noreferrer noopener"> google.com </a>'
)
// Do not touch existing anchor tags
assert.equal(
anchorify('Visit <a href="http://google.com"> google.com </a>', { target: '_blank' }),
'Visit <a href="http://google.com"> google.com </a>'
)
// Detect email
assert.equal(
anchorify('You can reach me at foo@bar.com'),
'You can reach me at <a href="mailto:foo@bar.com"> foo@bar.com </a>'
)
// Let browser decide the protocol
assert.equal(
anchorify('Open //google.com'),
'Open <a href="//google.com"> google.com </a>'
)
FAQs
Convert urls to anchor tags inside a string
The npm package anchorify receives a total of 3,771 weekly downloads. As such, anchorify popularity was classified as popular.
We found that anchorify demonstrated a not healthy version release cadence and project activity because the last version was released 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.