
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@cmsgov/request-version
Advanced tools
CMS QPP specific express middleware to get version from Accept header and put it on the request object
This package provides ExpressJS middleware that parses incoming HTTP headers to determine the version of the API to be consumed and sets a apiVersion property on the req object.
The library will parse the version from the Accept header, expecting the following format: Accept: application/vnd.cms.gov.v1+json
node v6.9.1 or higher
const requestVersion = require('@cmsgov/request-version');
app.use(requestVersion.setVersion());
const options = {
defaultVersion: 1,
supportedVersions: [1, 2]
};
You can pass in a defaultVersion value on options to set the default version if no Accept header is included in the request:
app.use(requestVersion.setVersion({ defaultVersion: 1 }));
If you pass in a supportedVersions array on options the requested version does not exist in the array, then the defualt version will be set.
If you define a middleware after requestVersion then you can verify that the version is indeed set:
app.use((req, res, next) => {
console.log(req.apiVersion)
next()
});
npm install @cmsgov/request-version
npm test
Project linting:
npm run lint
npm run test:coverage
Branon Barrett branon.barrett@semanticbits.com
FAQs
CMS QPP specific express middleware to get version from Accept header and put it on the request object
The npm package @cmsgov/request-version receives a total of 4 weekly downloads. As such, @cmsgov/request-version popularity was classified as not popular.
We found that @cmsgov/request-version 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
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.