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.
@harnessio/ff-nodejs-server-sdk
Advanced tools
Harness Feature Flags (FF) is a feature management solution that enables users to change the software’s functionality, without deploying new code. FF uses feature flags to hide code or behaviours without having to ship new versions of the software. A feature flag is like a powerful if statement.
For more information, see https://harness.io/products/feature-flags/
To read more, see https://ngdocs.harness.io/category/vjolt35atg-feature-flags
To sign up, https://app.harness.io/auth/#/signup/
npm install @harnessio/ff-nodejs-server-sdk
const { Client } = require('@harnessio/ff-nodejs-server-sdk');
import { Client } from '@harnessio/ff-nodejs-server-sdk';
This is the most simple way to initialize SDK using only a server type key
const client = new Client('your server type SDK key');
Advanced initialization can be done using options
const client = new Client('your server type SDK key', {
enableStream: false,
});
const target = {
identifier: 'harness',
name: 'Harness',
attributes: {}
};
const value = await client.boolVariation('test', target, false);
client.close();
function boolVariation(
identifier: string,
target: Target,
defaultValue: boolean = true,
): Promise<boolean>;
function stringVariation(
identifier: string,
target: Target,
defaultValue: boolean = '',
): Promise<string>;
function numberVariation(
identifier: string,
target: Target,
defaultValue: boolean = 1.0,
): Promise<number>;
function jsonVariation(
identifier: string,
target: Target,
defaultValue: boolean = {},
): Promise<Record<string, unknown>>;
function close(): void;
baseUrl: string; // baseUrl is where the flag configurations are located
eventsUrl: string; // eventsUrl is where we send summarized target events
pollInterval: number; // pollInterval (default 60s)
eventsSyncInterval: number; // Metrics push event (default 60s)
enableStream: boolean; // enable server sent events
enableAnalytics: boolean; // enable analytics
cache: KeyValueStore; // set custom cache (default lru cache)
store: AsyncKeyValueStore; // set custom persistent store (default file store)
logger: Logger; // set logger (default console)
import CfClient from '@harnessio/ff-nodejs-server-sdk';
CfClient.init('your server type SDK key');
const FLAG_KEY = 'test_bool';
const target = {
identifier: 'harness',
name: 'Harness',
attributes: {}
};
const defaultValue = false;
setInterval(async() => {
const value = await CfClient.boolVariation(FLAG_KEY, target, defaultValue);
console.log("Evaluation for flag test and target none: ", value);
}, 10000);
const { Client } = require('@harnessio/ff-nodejs-server-sdk');
console.log('Starting application');
const client = new Client('1c100d25-4c3f-487b-b198-3b3d01df5794');
client
.waitForInitialization()
.then(() => {
setInterval(async () => {
const target = {
identifier: 'harness',
};
const value = await client.boolVariation('test', target, false);
console.log('Evaluation for flag test and target: ', value, target);
}, 10000);
console.log('Application started');
})
.catch((error) => {
console.log('Error', error);
});
You can listen on these events:
Event.READY
- SDK successfully initializedEvent.FAILED
- SDK throws an errorEvent.CHANGED
- any new version of flag or segment triggers this event, if segment is changed then it will find all flags with segment match operatorMethods:
on(Event.READY, () => {
console.log('READY');
});
on(Event.FAILED, () => {
console.log('FAILED');
});
on(Event.CHANGED, (identifier) => {
console.log('Changed', identifier);
});
and if you want to remove the functionReference
listener for Event.READY
:
off(Event.READY, functionReference);
or if you want to remove all listeners on Event.READY
:
off(Event.READY);
or if you call off()
without params it will close the client.
All events are applicable to off() function.
Licensed under the APLv2.
FAQs
Feature flags SDK for NodeJS environments
The npm package @harnessio/ff-nodejs-server-sdk receives a total of 9,892 weekly downloads. As such, @harnessio/ff-nodejs-server-sdk popularity was classified as popular.
We found that @harnessio/ff-nodejs-server-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.