Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
hapi-piggy
Advanced tools
Readme
A PostgreSQL plugin for HAPI, with a convenient key/val store abstraction layer.
const defaultOptions = {
connectionName: 'default',
url: 'postgresql://localhost',
connection: {
ssl: true,
max: 10,
min: 4,
idleTimeoutMillis: 30000
}
};
hapi-piggy
will use the native pg bindings if you have them installed as a peer.
This module exposes several server methods intended to make working with PostgreSQL a little easier for certain general use cases. It provides a key/val store-like abstraction layer, with a simplistic indexing model, and JSONB payloads.
/* Register server, config module... */
const uuid = require('uuid/v4');
const { createConnection, createStore, get, upsert } = server.methods.piggy;
createConnection()
.then(client => {
return createStore({
client,
table: 'example',
indexes: ['lastName']
});
})
.then(({ client }) => {
return upsert({
client,
table: 'example',
key: { lastName: 'Foo' },
val: { firstName: 'Cool', lastName: 'Foo', car: 'Lambo' },
options: { merge: true },
generateKeyFn: () => uuid()
});
})
.then(({ client }) => {
return get({
client,
table: 'example',
key: { lastName: 'Foo' }
});
})
.then(({ client, key, val }) => {
client.close();
console.log(key, value);
// 'uuid...', {firstName: 'Cool', lastName: 'Foo', car: 'Lambo'}
});
You can easily set up a table that pushes notifications to a worker with the createWatchedTable
or createStore
with the watch
boolean true
and watchTable
methods.
Watching a store looks like this:
const { createConnection, createStore, watchTable, set } = server.methods.piggy;
const watcher = function({ parsed }) {
// do something with parsed payload
// {key: 'foo'}
};
createConnection()
.then(client => {
return createStore({
client,
table: 'example',
watch: true
});
})
.then(({ client }) => {
return watchTable({
client,
table: 'example',
watcher
});
})
.then(({ client }) => {
return set({
client,
table: 'example',
key: 'foo',
val: 'bar'
});
})
.then(({ client }) => {
client.close();
});
There are many, take a look at index.js.
FAQs
A PostgreSQL plugin for HAPI, with a convenient key/val store abstraction layer.
We found that hapi-piggy 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
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.