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.
Generate card-based links for hyperlinks on the page
Using npm:
npm install cardlink --save
Using CDN:
<script src="https://cdn.jsdelivr.net/npm/cardlink"></script>
<!-- Only use parseer -->
<script src="https://cdn.jsdelivr.net/npm/cardlink/dist/parse.js"></script>
<script>
/**
* Get info
* @param {String} html String type html
* @param {String} link Website address
* @returns {{ title: string; link: string; icon: string }} Website info
*/
cardLinkParse(html, link)
<script>
Modules
import cardLink from 'cardlink' // or const cardLink = require('cardlink')
// Only use parseer
import cardLinkParse from 'cardlink/parse' // or const cardLinkParse = require('cardlink/parse')
Browser
<script>
cardLink(document.querySelectorAll('article a[target=_blank]'))
</script>
<script>
// Set the cardlink property for the specified a tag, and finally call cardLink()
document.querySelectorAll('article a[target=_blank]').forEach((el) => {
el.setAttribute('cardlink', '')
})
// OR
document.querySelector('a#example').setAttribute('cardlink', '')
// By default, card links are generated for all `a[cardlink]` on the page
cardLink()
</script>
Since this is a front-end request for HTML, some sites may have cross-domain (CORS) issues, so cardLink
allows you to use a proxy server to request HTML from the target site
<script>
// Note: cardLink sends requests to the proxy server only when cross-domain requests occur (thus reducing the pressure on the proxy server)
// Preset the proxy server before executing cardLink
cardLink.server = 'https://api.allorigins.win/raw?url='
cardLink(document.querySelectorAll('article a[target=_blank]'))
</script>
Type: NodeList
default: document.querySelectorAll('a[cardlink]')
By default, card links are generated for all a[cardlink]
on the page
FAQs
为页面上的超链接生成卡片式链接 | Generate card-based links for hyperlinks on the page
The npm package cardlink receives a total of 11 weekly downloads. As such, cardlink popularity was classified as not popular.
We found that cardlink 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.