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.
@devcycle/nodejs-server-sdk
Advanced tools
The DevCycle NodeJS Server SDK used for feature management.
The NodeJS Server SDK for DevCycle.
This SDK uses local bucketing to perform all user segmentation and bucketing locally in the SDK, providing immediate responses to variable and feature requests for a user. The SDK will download the latest version of your DevCycle environments configuration from a CDN on initialization, and will periodically poll the CDN for configuration changes.
Our library can be found on npm and installed by the following:
npm install @devcycle/nodejs-server-sdk
To use the DVC Server SDK in your project, import the @devcycle/nodejs-server-sdk
package and
call initialize
with your DVC environment server key. You may optionally await
for the client
to be initialized.
JS Example:
const DVC = require('@devcycle/nodejs-server-sdk')
const dvcClient = await DVC.initialize('<DVC_ENVIRONMENT_SERVER_KEY>').onClientInitialized()
Typescript Example:
import { initialize } from '@devcycle/nodejs-server-sdk'
const dvcClient = await initialize('<DVC_ENVIRONMENT_SERVER_KEY>').onClientInitialized()
The SDK exposes various initialization options which can be set on the initialization()
method:
const dvcClient = await DVC.initialize('<DVC_ENVIRONMENT_SERVER_KEY>', {
configPollingIntervalMS: 60 * 1000
}).onClientInitialized()
DVC Option | Description |
---|---|
configPollingIntervalMS | Controls the polling interval in milliseconds to fetch new environment config changes, defaults to 10 seconds, minimum value is 1 second. |
configPollingTimeoutMS | Controls the request timeout to fetch new environment config changes, defaults to 5 seconds, must be less than the configPollingIntervalMS value, minimum value is 1 second. |
flushEventsMS | Controls the interval between flushing events to the DevCycle servers, defaults to 30 seconds. |
disableEventLogging | Disables logging of any events or user data to DevCycle. |
The full user data must be passed into every method. The only required field is the user_id
.
The rest are optional and are used by the system for user segmentation into variables and features.
const user = {
user_id: 'user1@devcycle.com',
name: 'user 1 name',
customData: {
customKey: 'customValue'
}
}
const variable = dvcClient.variable(user, 'test-feature', false)
To get values from your Variables, dvcClient.variable()
is used to fetch variable values using the user data,
variable key
, coupled with a default value for the variable. The default variable will be used in cases where
the user is not segmented into a feature using that variable, or the project configuration is unavailable
to be fetched from DevCycle's CDN.
The default value can be of type string, boolean, number, or object.
const variable = dvcClient.variable(user, 'YOUR_VARIABLE_KEY', false)
if (variable.value) {
// Feature Flag on
}
To grab all the segmented variables for a user:
const variables = dvcClient.allVariables(user)
You can fetch all segmented features for a user:
const features = dvcClient.allFeatures(user)
FAQs
The DevCycle NodeJS Server SDK used for feature management.
The npm package @devcycle/nodejs-server-sdk receives a total of 13,548 weekly downloads. As such, @devcycle/nodejs-server-sdk popularity was classified as popular.
We found that @devcycle/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.