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.
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
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
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.