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.
express-cache-controller
Advanced tools
A simple and lightweight module for managing cache control headers from within your application. It also tries to provide a simple set of rules for common use cases such as setting 'max-age=0' when 'no-cache' is present by default.
Configuring noCache easily:
app.use(cacheControl({
noCache: true
}));
Creates a cache-control header of no-cache, max-age=0
To start using cacheControl, just use the middleware in your application:
app.use(cacheControl());
When initialising the middleware you can set default options when you use it in your application:
app.use(cacheControl({
maxAge: 5
}));
Just set the cacheControl property of the response object after the cacheControl() middleware is loaded:
app.use(cacheControl({ maxAge: 60 }));
app.get('/', function (req, res, next){
res.cacheControl = {
maxAge: 30
};
res.send('hai');
});
This is useful in error conditions where you can setup cache headers before and after a request is processed:
app.use(cacheControl({ maxAge: 60} ));
app.get('/', function (req, res, next) {
next(Error('BOOM!'));
});
app.use(function (err, req, res, next) {
res.cacheControl = {
maxAge: 5
};
res.status(500).send('oh no!');
});
Name | Value | Description |
---|---|---|
private | Boolean | Adds 'private' flag, overrides 'public' option |
public | Boolean | Adds 'public' flag |
noStore | Boolean | Adds 'no-store' flag and includes noCache |
noCache | Boolean | Adds 'no-cache' flag, sets maxAge to 0 and removes sMaxAge, staleIfError and staleWhileRevalidate |
noTransform | Boolean | Adds 'no-transform' flag |
mustRevalidate | Boolean | Adds 'must-revalidate' flag and removes staleIfError and staleWhileRevalidate |
staleIfError | Number | Adds 'stale-if-error=%d' flag |
staleWhileRevalidate | Number | Adds 'stale-while-revalidate=%d' flag |
maxAge | Number | Adds 'max-age=%d' flag |
sMaxAge | Number | Adds 's-maxage=%d' flag |
FAQs
Middleware for meddling with Cache-Control headers
The npm package express-cache-controller receives a total of 14,332 weekly downloads. As such, express-cache-controller popularity was classified as popular.
We found that express-cache-controller 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.
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.