
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
The azurecache module allows you to use the Windows Azure Cache Service to store session state in Express applications. It also allows direct access to Windows Azure Cache Service from other Node.js applications.
The azurecache module uses Edge.js and as such it currently only works on Windows. It is a great fit for storing session state of Express applications hosted in Windows Azure Web Sites. It is also a good choice for any other type of Node.js application hosted in Windows Azure that requires caching.
First create your Windows Azure Cache Service instance following insturctions at Scott Guthrie's blog. You will end up with an endpoint URL of your cache service (e.g. tjanczuk.cache.windows.net) and an access key (a long Base64 encoded string).
Then install the azurecache and express modules:
npm install azurecache
npm install express
Next author your Express application that uses the azurecache module to store Express session state in the Windows Azure Cache Service:
var express = require('express')
, AzureCacheStore = require('azurecache')(express);
var app = express();
app.use(express.cookieParser());
app.use(express.session({ store: new AzureCacheStore(), secret: 'abc!123' }));
app.get('/inc', function (req, res) {
req.session.counter = (req.session.counter + 1) || 1;
res.send(200, 'Increased sum: ' + req.session.counter);
});
app.get('/get', function (req, res) {
res.send(200, 'Current sum: ' + req.session.counter);
});
app.listen(process.env.PORT || 3000);
Lastly set some environment variables and start your server:
set AZURE_CACHE_IDENTIFIER=<your_azure_cache_endpoint_url>
set AZURE_CACHE_TOKEN=<your_azure_cache_access_key>
node server.js
Every time you visit http://localhost:3000/inc in the browser you will receive an ever increasing counter value. When you visit http://localhost:3000/get you will receive the current counter value. The value of the counter is stored as part of the Express session state in the Windows Azure Cache Service with a default TTL of one day.
You can specify the credentials to the Windows Azure Cache Service either in code or via environment variables:
var azureCacheOptions = {
identifier: '<your_endpoint_url>', // or set the AZURE_CACHE_IDENTIFIER environment variable
token: '<your_access_key>', // or set the AZURE_CACHE_TOKEN environment variable
ttl: 3600 // optional TTL in seconds (default 1 day); or set the AZURE_CACHE_TTL env variable
};
// ...
app.use(express.session({ store: new AzureCacheStore(azureCacheOptions), secret: 'abc!123' }));
You can access Windows Azure Cache Service directly too:
var azurecache = require('azurecache')
var cache = azurecache.create({
identifier: '<your_endpoint_url>', // or set the AZURE_CACHE_IDENTIFIER environment variable
token: '<your_access_key>', // or set the AZURE_CACHE_TOKEN environment variable
ttl: 3600 // optional TTL in seconds (default 1 day); or set the AZURE_CACHE_TTL env variable
});
cache.put('test1', { first: 'Tomasz', last: 'Janczuk' }, function (error) {
if (error) throw error;
cache.get('test1', function (error, data) {
if (error) throw error;
console.log('Data from cache:', data);
});
});
The azurecache module uses Edge.js to access the .NET client of the Windows Azure Cache Service that ships as a NuGet package. The gist of the idea is here.
I do take contributions. Feedback welcome (file an issue). Enjoy!
FAQs
Winows Azure Cache client and Express session store
The npm package azurecache receives a total of 0 weekly downloads. As such, azurecache popularity was classified as not popular.
We found that azurecache 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
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.