
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
cloudformation-sql-run
Advanced tools
An aws-cdk construct for calling SQL during CloudFormation stack update.
The SqlRun
resource provides 2 callbacks: up
, down
.
The up
callback runs a forward migration. The down
command should do the opposite of up
.
The following example will issue a POST request when a Some API
resource creates:
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as rds from "aws-cdk-lib/aws-rds";
import {
DatabaseInstanceEngine,
PostgresEngineVersion
} from "aws-cdk-lib/aws-rds";
import * as secretmanager from 'aws-cdk-lib/aws-secretsmanager';
import * as cdk from "aws-cdk-lib";
import { RemovalPolicy } from "aws-cdk-lib";
import { SqlRun, SqlRunConnection, SqlSecret } from "cloudformation-sql-run";
import { Construct } from "constructs";
export class ExamplesStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const password = new secretmanager.Secret(this, 'Some Password')
const vpc = new ec2.Vpc(this, 'vpc', {
natGateways: 1
})
const db = new rds.DatabaseInstance(this, 'db', {
databaseName: 'sqlrunexample',
engine: DatabaseInstanceEngine.postgres({
version: PostgresEngineVersion.VER_10
}),
vpc: vpc,
removalPolicy: RemovalPolicy.DESTROY
})
const createDatabaseUser = new SqlRun(this, 'Create Database User', {
vpc: vpc,
connection: SqlRunConnection.fromDatabaseInstance(db),
up: {
run: [{
sql: `CREATE TABLE items(name varchar)`
}, {
sql: `INSERT INTO items(name) VALUE (:secret)`,
parameters: {
secret: SqlSecret.fromSecretsManager(password)
}
}],
},
down: {
run: [{
sql: `DROP TABLE items`
}]
}
});
}
}
You can access results of the last sql statement as follows:
const createDatabaseUser = new SqlRun(this, 'Create Database User', {
up: { run: [{ sql: `select count(*) as admin_count, company_id from users where is_admin = true group by company_id` }] }
});
new CfnOutput(this, 'Row at index 0', {
description: "First result",
value: sampleQuery.getResultField("[0].admin_count")
})
new CfnOutput(this, 'Row at index 1', {
description: "Second result",
value: sampleQuery.getResultField("[1].company_id")
})
FAQs
Cloudformation resource to call any http API
The npm package cloudformation-sql-run receives a total of 211 weekly downloads. As such, cloudformation-sql-run popularity was classified as not popular.
We found that cloudformation-sql-run 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 flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.