Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
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
54 changes: 54 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,54 @@
import { IResource, Resource } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnCodeSigningConfig } from './lambda.generated';
import { SigningProfile } from '@aws-cdk/aws-signer';

export enum UntrustedArtifactOnDeployment {
ENFORCE = 'enforce',
WARN = 'warn',
}

export interface ICodeSigningConfig extends IResource {
/**
* The ARN of Code Signing Config
* @attribute CodeSigningConfigArn
*/
readonly codeSigningConfigArn: string;

/**
* The id of Code Signing Config
* @attribute CodeSigningConfigId
*/
readonly codeSigningConfigId: string;
}

export interface CodeSigningConfigProps {
signingProfile: SigningProfile,
untrustedArtifactOnDeployment?: UntrustedArtifactOnDeployment,
description?: string
}

export class CodeSigningConfig extends Resource implements ICodeSigningConfig{
readonly codeSigningConfigArn: string;
readonly codeSigningConfigId: string;

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

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

const resource: CfnCodeSigningConfig = new CfnCodeSigningConfig(this, 'Resource', {
allowedPublishers: {
signingProfileVersionArns: props.signingProfile.signingProfileVersionArn,
},
codeSigningPolicies: {
untrustedArtifactOnDeployment: props.untrustedArtifactOnDeployment
},
description: props.description
});
this.codeSigningConfigArn = resource.attrCodeSigningConfigArn;
this.codeSigningConfigId = resource.attrCodeSigningConfigId;
}
}
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
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"@aws-cdk/aws-logs": "0.0.0",
"@aws-cdk/aws-s3": "0.0.0",
"@aws-cdk/aws-s3-assets": "0.0.0",
"@aws-cdk/aws-signer": "0.0.0",
"@aws-cdk/aws-sqs": "0.0.0",
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
Expand All @@ -119,6 +120,7 @@
"@aws-cdk/aws-logs": "0.0.0",
"@aws-cdk/aws-s3": "0.0.0",
"@aws-cdk/aws-s3-assets": "0.0.0",
"@aws-cdk/aws-signer": "0.0.0",
"@aws-cdk/aws-sqs": "0.0.0",
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
Expand Down
8 changes: 8 additions & 0 deletions packages/@aws-cdk/aws-signer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
>
> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib
![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)

> The APIs of higher level constructs in this module are experimental and under active development.
> They are subject to non-backward compatible changes or removal in any future version. These are
> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be
> announced in the release notes. This means that while you may use them, you may need to update
> your source code when upgrading to a newer version of this package.
---

<!--END STABILITY BANNER-->
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-signer/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// AWS::Signer CloudFormation Resources:
export * from './signer.generated';
export * from './signer-profile';
78 changes: 78 additions & 0 deletions packages/@aws-cdk/aws-signer/lib/signer-profile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Construct, IResource, Resource } from '@aws-cdk/core';
import { CfnSigningProfile } from './signer.generated';

export interface ISigningProfile extends IResource {
/**
* The ARN of the signing profile.
* @attribute
*/
readonly signingProfileArn: string;

/**
* The name of signing profile.
* @attribute
*/
readonly signingProfileName: string;

/**
* The version of signing profile.
* @attribute
*/
readonly signingProfileVersion: string;

/**
* The ARN of signing profile version.
* @attribute
*/
readonly signingProfileVersionArn: string;
}

export enum SignatureValidityPeriodTypes {
DAYS = 'DAYS',
MONTHS = 'MONTHS',
YEARS = 'YEARS',
}

class SignatureValidityPeriodProperty {
readonly type: SignatureValidityPeriodTypes;
readonly value: number;

constructor(type: SignatureValidityPeriodTypes, value: number) {
this.type = type;
this.value = value;
}
}

export interface SigningProfileProps {
/*
* The ID of a platform that is available for use by a signing profile.
*/
readonly platformId: string;

/*
* The validity period override for any signature generated using
* this signing profile. If unspecified, the default is 135 months.
*/
readonly signatureValidityPeriod?: SignatureValidityPeriodProperty;
}

export class SigningProfile extends Resource implements ISigningProfile {
public readonly signingProfileArn: string;
public readonly signingProfileName: string;
public readonly signingProfileVersion: string;
public readonly signingProfileVersionArn: string;

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

const resource = new CfnSigningProfile( this, 'Resource', {
platformId: props.platformId,
signatureValidityPeriod: props.signatureValidityPeriod,
} );

this.signingProfileArn = resource.attrArn;
this.signingProfileName = resource.attrProfileName;
this.signingProfileVersion = resource.attrProfileVersion;
this.signingProfileVersionArn = resource.attrProfileVersionArn;
}
}
8 changes: 5 additions & 3 deletions packages/@aws-cdk/aws-signer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,18 @@
"pkglint": "0.0.0"
},
"dependencies": {
"@aws-cdk/core": "0.0.0"
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0"
},
"peerDependencies": {
"@aws-cdk/core": "0.0.0"
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0"
},
"engines": {
"node": ">= 10.13.0 <13 || >=13.7.0"
},
"stability": "experimental",
"maturity": "cfn-only",
"maturity": "experimental",
"awscdkio": {
"announce": false
}
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-signer/test/signer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ import {} from '../lib';
test('No tests are specified for this package', () => {
expect(true).toBe(true);
});

// TODO: Implement tests