-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Lambda Code Signer Support (#2407)
* Code Sign Integration (#217) * Release v1.0.0 (#2111) * feat: Use aws-sam-cli docker images (#2066) * Add Source for Docker Build Images (#2078) * chore: Bump AWS SAM CLI Version (#2079) * Version bump (#2080) * chore: Bump AWS SAM CLI Version * Change SAM CLI Version Number There is a conflict betweeen PyPi documentation which asks for the previous style https://packaging.python.org/guides/distributing-packages-using-setuptools/#pre-release-versioning and PEP 440 which proposes the style included in this change https://www.python.org/dev/peps/pep-0440/#pre-releases - our MSI build scripts failed on the pattern we were using before, this changes the pattern. * refactor: Build init.go with -s and -w flags to removed debug info (#2083) * refactor: Bake Rapid into image on the fly (#2100) * refactor: Bake Rapid into image on the fly * force chmod on init binary in container for windows * bake go debug bootstrap Co-authored-by: Jacob Fuss <[email protected]> * chore: Bump version to RC2 (#2104) * Remove liblzma and libxslt from AL2 build images (#2109) Discovered a regression where on Ruby 2.7, the `nokogiri` dependency would build without errors, but would not run on local testing or on AWS Lambda itself. On further investigation, it appears that `nokogiri` can compile with or without `liblzma` present, but if it is present in the build enviornment (pre-change) and it is not present on the invoke environment (true in AL2 runtimes), you will experience runtime failures attempting to require `nokogiri`. I have been able to verify that with these changes, `nokogiri` builds correctly for Ruby 2.7 and runs both locally and on AWS Lambda. * Build output dots (#2112) * Use Low-Level Docker Client Allows us to stream dots as a progress heartbeat. Pending unit tests and black formatting. * Get make pr Passing Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> * chore: Bump aws-lambda-builders and SAM CLI to 1.0.0 (#2116) * fix: Update Python3.8 debug entrypoint (#2119) * chore: readme update with screenshot (#2117) * chore: readme update with screenshot * chore: remove beta in the title Co-authored-by: Alex Wood <[email protected]> * feature: Lambda Code Sign integration for SAM CLI * feature: Lambda Code Sign integration for SAM CLI (actual signing impl and unit tests) * Add details to print_deploy_args Add documentation for missing classes and methods * Update couple of prompts * Wording changes requested by UX & Docs Team Co-authored-by: Alex Wood <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> * - Update code signer param to align with tags and parameter-override params. - Added additional unit tests * chore: merge public develop with code signer changes * feat: Code Signer integration tests * add zip only if package needs to be signed * chore: bump SAM CLI version, update sam-translator dependency and tests with 1.31.0 Co-authored-by: Alex Wood <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]>
- Loading branch information
1 parent
ff150ed
commit 5619b76
Showing
39 changed files
with
1,312 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
SAM CLI version | ||
""" | ||
|
||
__version__ = "1.11.0" | ||
__version__ = "1.12.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
""" | ||
Utilities for code signing process | ||
""" | ||
|
||
import logging | ||
from click import prompt, STRING | ||
|
||
from samcli.lib.providers.sam_function_provider import SamFunctionProvider | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
||
def prompt_profile_name(profile_name, start_bold, end_bold): | ||
return prompt(f"\t{start_bold}Signing Profile Name{end_bold}", type=STRING, default=profile_name) | ||
|
||
|
||
def prompt_profile_owner(profile_owner, start_bold, end_bold): | ||
# click requires to have non None value for passing | ||
if not profile_owner: | ||
profile_owner = "" | ||
|
||
profile_owner = prompt( | ||
f"\t{start_bold}Signing Profile Owner Account ID (optional){end_bold}", | ||
type=STRING, | ||
default=profile_owner, | ||
show_default=len(profile_owner) > 0, | ||
) | ||
|
||
return profile_owner | ||
|
||
|
||
def extract_profile_name_and_owner_from_existing(function_or_layer_name, signing_profiles): | ||
profile_name = None | ||
profile_owner = None | ||
# extract any code sign config that is passed via command line | ||
if function_or_layer_name in signing_profiles: | ||
profile_name = signing_profiles[function_or_layer_name]["profile_name"] | ||
profile_owner = signing_profiles[function_or_layer_name]["profile_owner"] | ||
|
||
return profile_name, profile_owner | ||
|
||
|
||
def signer_config_per_function(parameter_overrides, template_dict): | ||
functions_with_code_sign = set() | ||
layers_with_code_sign = {} | ||
|
||
sam_functions = SamFunctionProvider(template_dict=template_dict, parameter_overrides=parameter_overrides) | ||
|
||
for sam_function in sam_functions.get_all(): | ||
if sam_function.codesign_config_arn: | ||
function_name = sam_function.name | ||
LOG.debug("Found the following function with a code signing config %s", function_name) | ||
functions_with_code_sign.add(function_name) | ||
|
||
if sam_function.layers: | ||
for layer in sam_function.layers: | ||
layer_name = layer.name | ||
LOG.debug("Found following layers inside the function %s", layer_name) | ||
if layer_name in layers_with_code_sign: | ||
layers_with_code_sign[layer_name].add(function_name) | ||
else: | ||
functions_that_is_referring_to_function = set() | ||
functions_that_is_referring_to_function.add(function_name) | ||
layers_with_code_sign[layer_name] = functions_that_is_referring_to_function | ||
|
||
return functions_with_code_sign, layers_with_code_sign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.