Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lambda): code signing config #12656

Merged
merged 51 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
88b28d8
feat(lambda-code-signing): create draft code
Jan 22, 2021
747a414
create base of Signer Profile
Jan 27, 2021
b2b3263
modify lambda code signing config
Jan 27, 2021
b1b3f40
modify @Attribute => @attribute
Feb 2, 2021
4c88f71
modify README using pkglint
Feb 3, 2021
a943ba8
modify ci errors
Feb 3, 2021
665df39
add module export to aws-signer/lib/index
Feb 3, 2021
0aee381
add construct to dependancy
Feb 4, 2021
f10b46f
make signingProfiles to list
Feb 4, 2021
278c0ef
fix: build errors
Feb 5, 2021
5a799db
add test
Feb 6, 2021
54217e0
fix aws-lambda build errors
Feb 6, 2021
dbbbd21
add test of lambda code-signing-config
Feb 6, 2021
befb9dd
modify signingProfile.fromSignginProfileAttributes
Feb 6, 2021
d090353
Update packages/@aws-cdk/aws-lambda/lib/code-signing-config.ts
Feb 8, 2021
acaf8c2
Update packages/@aws-cdk/aws-lambda/lib/code-signing-config.ts
Feb 8, 2021
30c6479
Update packages/@aws-cdk/aws-lambda/lib/code-signing-config.ts
Feb 8, 2021
02d57b3
Update packages/@aws-cdk/aws-lambda/lib/code-signing-config.ts
Feb 8, 2021
7c2117e
Update packages/@aws-cdk/aws-signer/lib/signing-profile.ts
Feb 8, 2021
d254142
So physical name is not configurable, deleted codeSigningConfigName f…
Feb 8, 2021
45df283
Merge branch 'aws-lambda-code-signing' of https://github.com/hedrall/…
Feb 8, 2021
21c7383
add readme of signing profile
Feb 9, 2021
342c5fc
add readme of lambda code signing cconfig
Feb 9, 2021
ce82641
modify test of signing profile
Feb 9, 2021
b43dc02
add test of lambda with code signing config
Feb 9, 2021
b7fc4d2
t pMerge branch 'master' of https://github.com/hedrall/aws-cdk into a…
Feb 14, 2021
225c05a
Update packages/@aws-cdk/aws-lambda/README.md
Feb 16, 2021
1c3ce91
Update packages/@aws-cdk/aws-lambda/lib/code-signing-config.ts
Feb 16, 2021
7b6202a
Update packages/@aws-cdk/aws-lambda/lib/code-signing-config.ts
Feb 16, 2021
4fe3cbe
Update packages/@aws-cdk/aws-lambda/test/code-signing-config.test.ts
Feb 16, 2021
55e69a7
change platformId to platform enum like class
hedrall Feb 16, 2021
11aaf43
Merge branch 'master' of git://github.com/aws/aws-cdk into aws-lambda…
hedrall Feb 16, 2021
53240ee
delete code not need
hedrall Feb 22, 2021
d22f21c
Merge branch 'master' of git://github.com/aws/aws-cdk into aws-lambda…
hedrall Feb 22, 2021
b033424
Update packages/@aws-cdk/aws-lambda/lib/code-signing-config.ts
Feb 23, 2021
7351a7e
Update packages/@aws-cdk/aws-lambda/test/code-signing-config.test.ts
Feb 23, 2021
817225d
Update packages/@aws-cdk/aws-lambda/test/code-signing-config.test.ts
Feb 23, 2021
2bf5cdc
Update packages/@aws-cdk/aws-lambda/test/code-signing-config.test.ts
Feb 23, 2021
6a90c8e
Update packages/@aws-cdk/aws-lambda/test/function.test.ts
Feb 23, 2021
afc9cdc
Update packages/@aws-cdk/aws-signer/README.md
Feb 23, 2021
fa08a95
Update packages/@aws-cdk/aws-signer/lib/signing-profile.ts
Feb 23, 2021
f646726
Update packages/@aws-cdk/aws-signer/lib/signing-profile.ts
Feb 23, 2021
fa40904
Update packages/@aws-cdk/aws-lambda/README.md
Feb 23, 2021
7573c5e
Fixed name inconsistencies of signer profile due to changes
hedrall Feb 23, 2021
a2b0e3f
Fixed name inconsistencies of code signing config due to changes
hedrall Feb 23, 2021
e7be9b8
Fixed remaining name mismatches.
hedrall Feb 23, 2021
dbac380
change name of propertiy signatureValidityPeriod to signatureValidity
hedrall Feb 23, 2021
07247d2
apply suggested readme change of signing profile
hedrall Feb 23, 2021
5fff48c
fix the linter violation
Feb 25, 2021
3427ea1
Apply suggestions from code review
Feb 25, 2021
8dbf3ca
Merge branch 'master' into aws-lambda-code-signing
mergify[bot] Feb 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions packages/@aws-cdk/aws-lambda/lib/code-signing-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Resource } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnCodeSigningConfig } from './lambda.generated';

nija-at marked this conversation as resolved.
Show resolved Hide resolved
export enum UntrustedArtifactOnDeployment {
ENFORCE = 'enforce',
WARN = 'warn',
}

export interface CodeSigningConfigOptions {
nija-at marked this conversation as resolved.
Show resolved Hide resolved
signingProfileVersionArn: string[],
nija-at marked this conversation as resolved.
Show resolved Hide resolved
untrustedArtifactOnDeployment?: UntrustedArtifactOnDeployment,
description?: string
}

export class CodeSigningConfig extends Resource {
public readonly codeSigningConfigArn: string;

constructor(scope: Construct, id: string, props: CodeSigningConfigOptions) {
super(scope, id);

if (props.signingProfileVersionArn.length > 20) {
throw new Error('Signing profile version arn is up to 20');
}

const resource: CfnCodeSigningConfig = new CfnCodeSigningConfig(this, 'Resource', {
allowedPublishers: {
signingProfileVersionArns: props.signingProfileVersionArn,
},
codeSigningPolicies: {
untrustedArtifactOnDeployment: props.untrustedArtifactOnDeployment
},
description: props.description
});
this.codeSigningConfigArn = resource.ref;
}
}
6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-lambda/lib/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { CfnFunction } from './lambda.generated';
import { ILayerVersion } from './layers';
import { LogRetentionRetryOptions } from './log-retention';
import { Runtime } from './runtime';
import { CodeSigningConfig } from 'aws-lambda/lib/code-signing-config';

/**
* X-Ray Tracing Modes (https://docs.aws.amazon.com/lambda/latest/dg/API_TracingConfig.html)
Expand Down Expand Up @@ -290,6 +291,8 @@ export interface FunctionOptions extends EventInvokeConfigOptions {
* @default - AWS Lambda creates and uses an AWS managed customer master key (CMK).
*/
readonly environmentEncryption?: kms.IKey;

readonly codeSigningConfig?: CodeSigningConfig;
}

export interface FunctionProps extends FunctionOptions {
Expand Down Expand Up @@ -526,6 +529,8 @@ export class Function extends FunctionBase {

private _logGroup?: logs.ILogGroup;

private readonly codeSigningConfig?: CodeSigningConfig;

/**
* Environment variables for this function
*/
Expand Down Expand Up @@ -641,6 +646,7 @@ export class Function extends FunctionBase {
}),
kmsKeyArn: props.environmentEncryption?.keyArn,
fileSystemConfigs,
codeSigningConfigArn: props.codeSigningConfig.codeSigningConfigArn
});

resource.node.addDependency(this.role);
Expand Down