
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
@skjnldsv/sanitize-svg
Advanced tools
a small SVG sanitizer to prevent XSS attacks
npm install @skjnldsv/sanitize-svg
Bad actors can put script tags in SVG files.
These script tags are not run when the svg is inside an <img>
,
but if the SVG file is opened directly ("Open image in...") they will run under the image's domain,
which means that bad actor could steal domain-specific context (cookies, local storage, etc.)
Anytime someone tries to upload a svg. Optionally on the client, but definitely on the server.
The output file will be null
import { sanitizeSVG } from '@skjnldsv/sanitize-svg'
// String svg
const svg = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1"><path ...'
const cleanImage = await sanitizeSVG(attachedImage)
if (!cleanImage) {
alert('Howdy, hacker')
}
// File input onSubmit handler
const onSubmit = async (e) => {
const attachedImage = e.currentTarget.files[0]
const cleanImage = await sanitizeSVG(attachedImage)
if (!cleanImage) {
alert('Howdy, hacker')
}
}
MIT
FAQs
a small script to remove script tags from SVGs
The npm package @skjnldsv/sanitize-svg receives a total of 752 weekly downloads. As such, @skjnldsv/sanitize-svg popularity was classified as not popular.
We found that @skjnldsv/sanitize-svg 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.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.