
Research
/Security News
11 Malicious Go Packages Distribute Obfuscated Remote Payloads
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
effector-async-local-storage
Advanced tools
Effector Domain based on Node.js AsyncLocalStorage
import { attach, createEffect, createEvent, createStore } from 'effector';
import { effectorAsyncLocalStorageFactory, effectorAsyncLocalStorageInit } from 'effector-async-local-storage';
import Koa from 'koa';
import Router from 'koa-router';
import Redis from 'ioredis';
const eff = effectorAsyncLocalStorageFactory({
onCreateEffect(sid, effect) {
effect.watch((val) => {
console.log(`Effect "${sid}" call with value: ${val}`);
});
effect.doneData.watch((val) => {
console.log(`Effect "${sid}" done with value: ${val}`);
});
effect.failData.watch((val) => {
console.log(`Effect "${sid}" fail with value: ${val}`);
});
},
onCreateEvent(sid, event) {
event.watch((val) => {
console.log(`Event "${sid}" call with value: ${val}`);
});
},
onCreateStore(sid, store) {
store.watch((state, val) => {
console.log(`Store "${sid}" mutation with value: ${val}`);
console.log(`Store "${sid}" mutation, current state: ${state}`);
});
},
});
const increment = eff('increment', () => createEvent());
const decrement = eff('decrement', () => createEvent());
const reset = eff('reset', () => createEvent());
const pullCounterFx = eff('pullCounterFx', () =>
createEffect<void, number>(async () => {
const count = await redis.get('counter');
return Number(count ?? 0);
})
);
const pushCounterFx = eff('pushCounterFx', () =>
attach({
source: $counter(),
effect: createEffect<number, number>(async (count) => {
await redis.set('counter', count);
return count;
}),
})
);
const $counter = eff(
'$counter',
() =>
createStore(0)
.on(increment(), (state) => state + 1)
.on(decrement(), (state) => state - 1)
.on(pullCounterFx().doneData, (_, value) => value)
.reset(reset())
);
const app = new Koa();
const router = new Router();
const redis = new Redis();
app.use(async (_, next) => {
await effectorAsyncLocalStorageInit(async () => {
await next();
});
});
router.post('/increment', async (ctx) => {
$counter();
await pullCounterFx()();
increment()();
ctx.body = await pushCounterFx()();
});
router.post('/decrement', async (ctx) => {
$counter();
await pullCounterFx()();
decrement()();
ctx.body = await pushCounterFx()();
});
router.post('/reset', async (ctx) => {
$counter();
await pullCounterFx()();
reset()();
ctx.body = await pushCounterFx()();
});
app.use(router.routes());
app.listen(4000);
FAQs
Effector Domain based on AsyncLocalStorage
The npm package effector-async-local-storage receives a total of 3 weekly downloads. As such, effector-async-local-storage popularity was classified as not popular.
We found that effector-async-local-storage 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 uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).