aws / aws/aws-cli

Incorrect aws lambda update-function-code --image-uri parameters will result in enormous amounts of text printed to console/logs

Open
#8,406 2 comments 0 reactions 0 assignees View on GitHub
bug lambda p2
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### Describe the bug

When running `aws lambda update-function-code`, it's somewhat easy to mix up parameters, and accidentally invoking `--image-uri` when `--zip-file` was intended, for example with:
```bash
awscli lambda update-function-code --function-name ExampleFunction --image-uri fileb://bootstrap.zip --publish
```
This will result in an error message that will dump the entire contents of bootstrap.zip, hex-decoded, into standard output or logs. This could be a statically compiled go application, or potentially a 50MB zip file, which will be hex-decoded into potentially hundreds of megabytes, all dumped into the console or into server logs and occupying enormous amounts of space after a few erroneous invocations.

This misconfigured command was run in a CI/CD pipeline and could have consumed an enormous amount of space in logs.

### Expected Behavior

a truncated error message, or rejecting a fileb:// uri for an --image-uri

### Current Behavior

aws-cli will dump the entire hex-decoded binary contents of bootstrap.zip to standard out

### Reproduction Steps

run `aws lambda update-function-code --function-name ExampleFunction --image-uri fileb://bootstrap.zip`
where bootstrap.zip is any sort of zip file.

### Possible Solution

detect an incorrect fileb:// parameter to --image-uri, or otherwise truncate the error string to a maximum length. Give a descriptive error that the incorrect format of an image-uri was provided, without printing the entire multi-megabyte hex-decoded version of the erroneously provided file.

### Additional Information/Context

_No response_

### CLI version used

2.13.35

### Environment details (OS name and version, etc.)

Codebuild, running the aws/codebuild/amazonlinux2-x86_64-standard:5.0 image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.