Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
state-machine-semaphore
Advanced tools
Create distributed semaphores using AWS Step Functions and Amazon DynamoDB to control concurrent invocations of contentious work.
An aws-cdk construct that enables you to use AWS Step Functions to control concurrency in your distributed system. You can use this construct to distributed state machine semaphores to control concurrent invocations of contentious work.
This construct is based off of Justin Callison's example code. Make sure to check out Justin's blogpost to learn about how the system works.
import { Function } from 'aws-cdk-lib/aws-lambda';
import { Duration, Stack, StackProps } from 'aws-cdk-lib';
import { StateMachine, Succeed, Wait, WaitTime } from 'aws-cdk-lib/aws-stepfunctions';
import { LambdaInvoke } from 'aws-cdk-lib/aws-stepfunctions-tasks';
import { Construct } from 'constructs';
import { Semaphore } from '@dontirun/state-machine-semaphore';
export class CdkTestStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const contestedJob = new LambdaInvoke(this, 'ContestedJobPart1', {
lambdaFunction: Function.fromFunctionName(this, 'JobFunctionPart1', 'cool-function'),
}).next(new Wait(this, 'Wait', { time: WaitTime.duration(Duration.seconds(7)) }))
.next(new Wait(this, 'AnotherWait', { time: WaitTime.duration(Duration.seconds(7)) }))
.next(new Wait(this, 'YetAnotherWait', { time: WaitTime.duration(Duration.seconds(7)) }));
const afterContestedJob = new Succeed(this, 'Succeed');
const stateMachineFragment = new Semaphore(stack, 'Semaphore', { lockName: 'life', limit: 42, job: contestedJob, nextState: afterContestedJob });
new StateMachine(this, 'StateMachine', {
definition: stateMachineFragment,
});
}
}
import { Function } from 'aws-cdk-lib/aws-lambda';
import { Duration, Stack, StackProps } from 'aws-cdk-lib';
import { StateMachine, Succeed, Wait, WaitTime } from 'aws-cdk-lib/aws-stepfunctions';
import { LambdaInvoke } from 'aws-cdk-lib/aws-stepfunctions-tasks';
import { Construct } from 'constructs';
import { Semaphore } from '@dontirun/state-machine-semaphore';
export class CdkTestStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const contestedJob = new LambdaInvoke(this, 'ContestedJobPart1', {
lambdaFunction: Function.fromFunctionName(this, 'JobFunctionPart1', 'cool-function'),
})
const notContestedJob = new LambdaInvoke(this, 'NotContestedJob', {
lambdaFunction: Function.fromFunctionName(this, 'NotContestedJobFunction', 'cooler-function'),
})
const contestedJob2 = new LambdaInvoke(this, 'ContestedJobPart2', {
lambdaFunction: Function.fromFunctionName(this, 'JobFunctionPart2', 'coolest-function'),
})
const afterContestedJob2 = new Succeed(this, 'Succeed');
const definition = new Semaphore(stack, 'Semaphore', { lockName: 'life', limit: 42, job: contestedJob, nextState: notContestedJob })
.next(new Semaphore(stack, 'Semaphore2', { lockName: 'liberty', limit: 7, job: contestedJob2, nextState: afterContestedJob2 }));
new StateMachine(this, 'StateMachine', {
definition: definition,
});
}
}
See API.md.
This project is licensed under the Apache-2.0 License.
FAQs
Create distributed semaphores using AWS Step Functions and Amazon DynamoDB to control concurrent invocations of contentious work.
We found that state-machine-semaphore demonstrated a healthy version release cadence and project activity because the last version was released less than 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.