Skip to content

Commit

Permalink
feat(sast): Add 10 TS CDK (#6194)
Browse files Browse the repository at this point in the history
* add more 10 ts csk

* add tests to integration file

---------

Co-authored-by: Matan Shati <>
Co-authored-by: Omry Mendelovich <[email protected]>
  • Loading branch information
matansha and omryMen authored Apr 30, 2024
1 parent bc2d489 commit 0068d76
Show file tree
Hide file tree
Showing 40 changed files with 1,490 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { aws_iam as iam } from 'aws-cdk-lib';

const cfnSecurityConfigurationProps1: iam.PolicyProps = {
statements: [{}],
users: [{}]
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { aws_iam as iam } from 'aws-cdk-lib';

const a = new iam.Policy(this, 'userpool-policy', {
statements: [new iam.PolicyStatement({
actions: ['cognito-idp:DescribeUserPool'],
resources: ['Arn'],
})],
users: ['sdsd']
});

const b = new iam.Policy(this, 'userpool-policy', {
statements: [new iam.PolicyStatement({
actions: ['cognito-idp:DescribeUserPool'],
resources: ['Arn'],
})],
});
console.log('dsd')
b.attachToUser({})

const c = new iam.Policy(this, 'userpool-policy', {
statements: [new iam.PolicyStatement({
actions: ['cognito-idp:DescribeUserPool'],
resources: ['Arn'],
})],
});
c.attachToUser({})
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { aws_iam as iam } from 'aws-cdk-lib';

const a = new iam.Policy(this, 'userpool-policy', {
statements: [new iam.PolicyStatement({
actions: ['cognito-idp:DescribeUserPool'],
resources: ['Arn'],
})],
});

const cfnSecurityConfigurationProps1: iam.PolicyProps = {
statements: [new iam.PolicyStatement({
actions: ['cognito-idp:DescribeUserPool'],
resources: ['Arn'],
})],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { aws_kinesis as kinesis } from 'aws-cdk-lib';

const cfnSecurityConfigurationProps1: kinesis.CfnStreamProps = {
streamEncryption: { encryptionType: "None", keyId: "dfdf"},
name: 'name',
};

const cfnSecurityConfigurationProps2: kinesis.CfnStreamProps = {
name: 'name',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { aws_kinesis as kinesis } from 'aws-cdk-lib';

const cfnSecurityConfiguration1 = new kinesis.CfnStream(this, 'MyCfnSecurityConfiguration', {
streamEncryption: { encryptionType: "None", keyId: "dfdf"},
name: 'name',
});

const cfnSecurityConfiguration2 = new kinesis.CfnStream(this, 'MyCfnSecurityConfiguration', {
name: 'name',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { aws_kinesis as kinesis } from 'aws-cdk-lib';

const cfnSecurityConfigurationProps1: kinesis.CfnStreamProps = {
streamEncryption: { encryptionType: "KMS", keyId: "dfdf"},
name: 'name',
};
16 changes: 16 additions & 0 deletions cdk_integration_tests/src/typescript/LambdaDLQConfigured/fail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_sam as sam } from 'aws-cdk-lib';

const cfnSecurityConfigurationProps1: lambda.FunctionProps = {
name: 'name',
role: "",
};

const cfnSecurityConfigurationProps1: lambda.CfnFunctionProps = {
name: 'name',
role: "",
};

const cfnSecurityConfigurationProps2: sam.CfnFunctionProps = {
name: 'name',
};
17 changes: 17 additions & 0 deletions cdk_integration_tests/src/typescript/LambdaDLQConfigured/fail2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_sam as sam } from 'aws-cdk-lib';

const cfnSecurityConfiguration1 = new lambda.Function(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
});

const cfnSecurityConfiguration2 = new lambda.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
});

const cfnSecurityConfiguration3 = new sam.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
});
21 changes: 21 additions & 0 deletions cdk_integration_tests/src/typescript/LambdaDLQConfigured/pass.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {aws_lambda as lambda} from 'aws-cdk-lib';
import {aws_sam as sam} from 'aws-cdk-lib';

const cfnSecurityConfiguration1 = new lambda.Function(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
deadLetterQueue: {},
deadLetterQueueEnabled: true,
});

const cfnSecurityConfiguration2 = new lambda.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
deadLetterConfig: {},
});

const cfnSecurityConfiguration2 = new sam.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
deadLetterQueue: {},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {aws_lambda as lambda} from 'aws-cdk-lib';
import {aws_sam as sam} from 'aws-cdk-lib';

const cfnSecurityConfigurationProps1: lambda.FunctionProps = {
name: 'name',
role: "",
environment: {
"bla": "bla",
}
};

const cfnSecurityConfigurationProps2: lambda.CfnFunctionProps = {
name: 'name',
role: "",
environment: {
variables: {
"bla": "bla",
}
}
};

const cfnSecurityConfigurationProps3: sam.CfnFunctionProps = {
name: 'name',
environment: {
variables: {
bla: "bla",
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_sam as sam } from 'aws-cdk-lib';

const cfnSecurityConfiguration1 = new lambda.Function(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
environment: {
"bla": "bla",
}
});

const cfnSecurityConfiguration2 = new lambda.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
environment: {
variables: {
"bla": "bla",
}
}
});

const cfnSecurityConfiguration3 = new sam.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
environment: {
variables: {
bla: "bla",
}
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import {aws_lambda as lambda} from 'aws-cdk-lib';
import {aws_sam as sam} from 'aws-cdk-lib';

const cfnSecurityConfiguration1 = new lambda.Function(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
environment: {
"bla": "bla",
},
environmentEncryption: {}
});

const cfnSecurityConfiguration2 = new lambda.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
environment: {
variables: {
"bla": "bla",
}
},
kmsKeyArn: "arn"
});

const cfnSecurityConfiguration3 = new sam.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
environment: {
variables: {
bla: "bla",
}
},
kmsKeyArn: "arn"
});

const cfnSecurityConfigurationProps1: lambda.FunctionProps = {
name: 'name',
role: "",
environment: {
"bla": "bla",
},
environmentEncryption: {}
};

const cfnSecurityConfigurationProps2: lambda.CfnFunctionProps = {
name: 'name',
role: "",
environment: {
variables: {
"bla": "bla",
}
},
kmsKeyArn: "arn"
};

const cfnSecurityConfigurationProps3: sam.CfnFunctionProps = {
name: 'name',
environment: {
variables: {
bla: "bla",
}
},
kmsKeyArn: "arn"
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {aws_lambda as lambda} from 'aws-cdk-lib';
import {aws_sam as sam} from 'aws-cdk-lib';

const cfnSecurityConfigurationProps1: lambda.FunctionProps = {
name: 'name',
role: "",
environment: {
"bla": "bla",
}
};

const cfnSecurityConfigurationProps2: lambda.CfnFunctionProps = {
name: 'name',
role: "",
environment: {
variables: {
"bla": "bla",
}
}
};

const cfnSecurityConfigurationProps3: sam.CfnFunctionProps = {
name: 'name',
environment: {
variables: {
bla: "bla",
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_sam as sam } from 'aws-cdk-lib';

const cfnSecurityConfiguration1 = new lambda.Function(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
environment: {
"bla": "bla",
},
});

const cfnSecurityConfiguration2 = new lambda.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
environment: {
variables: {
"bla": "bla",
}
}
});

const cfnSecurityConfiguration3 = new sam.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
environment: {
variables: {
bla: "bla",
}
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {aws_lambda as lambda} from 'aws-cdk-lib';
import {aws_sam as sam} from 'aws-cdk-lib';

const cfnSecurityConfiguration1 = new lambda.Function(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
});

const cfnSecurityConfiguration2 = new lambda.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
});

const cfnSecurityConfiguration3 = new sam.CfnFunction(this, 'MyCfnSecurityConfiguration', {
role: "",
name: 'name',
});

const cfnSecurityConfigurationProps1: lambda.FunctionProps = {
name: 'name',
role: "",
};

const cfnSecurityConfigurationProps2: lambda.CfnFunctionProps = {
name: 'name',
role: "",
};

const cfnSecurityConfigurationProps3: sam.CfnFunctionProps = {
name: 'name',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {aws_lambda as lambda} from 'aws-cdk-lib';
import {aws_sam as sam} from 'aws-cdk-lib';

const cfnSecurityConfigurationProps1: lambda.FunctionProps = {
name: 'name',
role: "",
environment: {
"bla": "bla",
}
};

const cfnSecurityConfigurationProps2: lambda.CfnFunctionProps = {
name: 'name',
role: "",
environment: {
variables: {
"bla": "bla",
}
}
};

const cfnSecurityConfigurationProps3: sam.CfnFunctionProps = {
name: 'name',
environment: {
variables: {
bla: "bla",
}
}
};
Loading

0 comments on commit 0068d76

Please sign in to comment.