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.
@condor-labs/elasticsearch
Advanced tools
This module provide and usefull helper to use Elasticsearch library
This module provide and usefull helper to use Elasticsearch library.
See official documentation here.
The minimum supported version of Node.js is v8.
The library is compatible with all Elasticsearch versions since 5.x
To use the library you just need to follow the following steps Install the library with npm
npm install @condor-labs/elasticsearch
Import the library:
const elasticsearch = require('@condor-labs/elasticsearch')(settings);
settings
object propertiesProperty | Default | Description |
---|---|---|
protocol (String) | http | Specify http protocol |
host (String) | 127.0.0.1 | The host name of the ES instance you are connecting to. |
port (Number) | 9200 | The port number to connect to. |
user (String) | The username for authentication. | |
password (String) | The password for authentication. |
constants.js
module.exports = {
settings: {
protocol: 'http',
user: '',
password: '',
host: 'localhost',
port: 9200
},
indexBody: {
index: 'game-of-thrones',
type: 'characters',
body: {
character: 'Ned Stark',
quote: 'Winter is coming.'
}
},
searchBody: {
size: 100,
from: 0,
body: {
query: {
match: {
character: 'Stark'
}
}
}
}
};
index.js
const {
settings,
indexBody,
searchBody
} = require('./constants');
try {
const es = require('@condor-labs/elasticsearch')(settings);
(async () => {
// get client
let client = es.getClient();
//----------------
// Let's start by indexing some data
//----------------
let resp = await client.index(indexBody)
// validate response
console.log(resp && resp.statusCode === 201 ? "Saving document is OK!" : "Saving document didn't work :(");
console.log('---------------------------------------');
//----------------
// search data just added:
//----------------
// promise API
resp = await client.search(searchBody);
console.log(resp && resp.body && resp.body.hits && resp.body.hits.total > 0 ? `${resp.body.hits.total} Docs found via Promise!!!` : `NO Docs found via promises :( `);
console.log('---------------------------------------');
resp = await client.search(
searchBody,
(err, resp) => {
if (err) {
console.error(err)
}
console.log(resp && resp.body && resp.body.hits && resp.body.hits.total > 0 ? `${resp.body.hits.total} Docs found via CB!!!` : `NO Docs found via CB :( `);
console.log('---------------------------------------');
// close app
process.exit(1);
}
);
})();
} catch (error) {
console.error(error)
}
You will need to update the package.json
file placed in the root folder.
identify the property version
and increase the right number in plus one.
npm login
[Enter username]
[Enter password]
[Enter email]
If all is ok the console will show you something like this : Logged in as USERNAME on https://registry.npmjs.org/.
npm publish --access public
Ref: https://docs.npmjs.com/getting-started/publishing-npm-packages
Note: you will need to have a NPM account, if you don't have one create one here: https://www.npmjs.com/signup
The original author and current lead maintainer of this module is the @condor-labs development team.
More about Condorlabs Here.
FAQs
This module provide and usefull helper to use Elasticsearch library
The npm package @condor-labs/elasticsearch receives a total of 55 weekly downloads. As such, @condor-labs/elasticsearch popularity was classified as not popular.
We found that @condor-labs/elasticsearch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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.