Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
sql-escape-string
Advanced tools
Simple SQL string escape.
const escapeString = require('sql-string-escape')
const sqlString = "Sup'er"
console.log(escapeString(sqlString)) // => Sup''er
npm install sql-escape-string
Original implementation from sqlstring with the added option of supporting or not supporting backslash.
Escapes the given string to protect against SQL injection attacks.
By default it assumes that backslashes are not supported as they are not part of the standard SQL spec. Quoting from the SQLlite web site:
C-style escapes using the backslash character are not supported because they are not standard SQL.
This means three things:
"
are not escaped by default''
instead of \'
'backslash: \\'
.It is recommended to set the backslashSupported
option true
if your SQL
engine supports it. In that case backslash sequences are escaped and single
and double quotes are escaped via a backslash, i.e. '\''
.
Parameters
val
String the original string to be used in a SQL query$0
Object opts
$0.backslashSupported
Boolean? if true
backslashes are supported (optional, default false
)opts
Returns String the original string escaped wrapped in single quotes, i.e. 'mystring'
MIT
FAQs
Simple SQL string escape.
The npm package sql-escape-string receives a total of 27,270 weekly downloads. As such, sql-escape-string popularity was classified as popular.
We found that sql-escape-string 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.