
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
free your data !
siv is a simple library that makes it very easy for a restful-API to expose an entirely safe but very powerful subset of SQL's functionality through querystrings.
siv will also contain library-agnostic client-side utilities that allow you to build nice filter/query menus that produce querystrings that the API can consume.
this is in early alpha. work in progress. in rough shape. api is unstable. going to change a lot. use at your own risk...
let's say we have a querystring:
> var querystring = [
'limit=10',
'offset=20',
'order=name',
'asc=true',
'where[is_active]=true',
'where[email][ends]=gmail.com',
'where[email][notcontains]=fake',
'where[id][notin][]=100',
'where[id][notin][]=200',
'where[id][lt]=1000',
].join('&');
qs will parse that querystring into a nested object:
> var qs = require('qs');
> var query = qs.parse(querystring);
> query
{
limit: '10',
offset: '20',
order: 'name',
asc: 'true',
where: {
is_active: 'true',
email: {
ends: 'gmail.com',
notcontains: 'fake',
},
id: {
notin: ['100', '200'],
lt: '1000',
},
},
}
now we can use siv to apply the query to a mesa (or mohair mohair) query object:
> var mesa = require('mesa');
> var siv = require('siv');
> var sieved = mesa.table('user');
> sieved = siv.limit(sieved, query);
> sieved = siv.offset(sieved, query);
> sieved = siv.order(sieved, query, {allow: ['name']});
> sieved = siv.boolean(sieved, query, 'is_active');
> sieved = siv.string(sieved, query, 'email');
> sieved = siv.integer(sieved, query, 'id');
> sieved.sql();
returns the sql query:
SELECT * FROM "user"
WHERE ("is_active" = ?)
AND email ILIKE '%' || ?
AND email NOT ILIKE '%' || ? || '%'
AND ("id" NOT IN (?, ?))
AND ("id" < ?)
ORDER BY name ASC
LIMIT ?
OFFSET ?
> sieved.params();
[true, 'gmail.com', 'fake', 100, 200, 1000, 10, 20]
more documentation (especially on error handling) is missing. for now see the tests instead.
before and after for endless scrollingthat can be transfered through a query string via qs parse on the server side build on the client side
client side representation is not 100% server side spec !!!
in other words
siv manipulates mesa queries based on the output of qs.
100% sql injection safe.
can be combined at will. all sensible combinations should work. make an issue if you feel that something should work but doesnt work.
the column operations could build up a criterion instead of building up a query
flexible spec
no assumptions over client side library.
still need to secure your api
today means the entirety of today which means it should only look at the date part
works with both mohair and mesa
also make it possible to generate menu text from the spec
extendable
virtual columns could be made through a options.virtual that maps names to expressions you can also use a select to define a virtual column that can be sorted by
all inputs are assumed to be strings
TLDR: bugfixes, issues and discussion are always welcome. ask me before implementing new features.
i will happily merge pull requests that fix bugs with reasonable code.
i will only merge pull requests that modify/add functionality if the changes align with my goals for this package, are well written, documented and tested.
communicate: write an issue to start a discussion before writing code that may or may not get merged.
FAQs
free your data
We found that siv 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 critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.