Skip to content

Commit

Permalink
chore(lambda-python): remove Pillow dependency (aws#18722)
Browse files Browse the repository at this point in the history
`Pillow` is an image processing library that we don't need at all,
but our tests use.

It has a high priority CVE reported against it.

Since we don't actually need it, away it goes.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
rix0rrr authored and TikiTDO committed Feb 21, 2022
1 parent c77b3ee commit a22b111
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 128 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import requests
from PIL import Image

def handler(event, context):
response = requests.get('https://a0.awsstatic.com/main/images/logos/aws_smile-header-desktop-en-white_59x35.png', stream=True)
img = Image.open(response.raw)

print(response.status_code)
print(img.size)

return response.status_code
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ idna==2.10
urllib3==1.26.7
# Requests used by this lambda
requests==2.26.0
# Pillow 6.x so that python 2.7 and 3.x can both use this fixture
Pillow==8.4.0
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ verify_ssl = true

[packages]
requests = "==2.26.0"
Pillow = "==8.4.0"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import requests
from PIL import Image

def handler(event, context):
response = requests.get('https://a0.awsstatic.com/main/images/logos/aws_smile-header-desktop-en-white_59x35.png', stream=True)
img = Image.open(response.raw)

print(response.status_code)
print(img.size)

return response.status_code
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import requests
from PIL import Image

def handler(event, context):
response = requests.get('https://a0.awsstatic.com/main/images/logos/aws_smile-header-desktop-en-white_59x35.png', stream=True)
img = Image.open(response.raw)

print(response.status_code)
print(img.size)

return response.status_code

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ authors = ["Your Name <you@example.com>"]
[tool.poetry.dependencies]
python = "^3.6"
requests = "2.26.0"
Pillow = "8.4.0"

[tool.poetry.dev-dependencies]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import requests
from PIL import Image
import shared

def handler(event, context):
response = requests.get(shared.get_url(), stream=True)
img = Image.open(response.raw)

print(response.status_code)
print(img.size)

return response.status_code
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ chardet==3.0.4
idna==2.10
urllib3==1.26.7
# Requests used by this lambda
requests==2.26.0
Pillow==8.4.0
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import requests
from PIL import Image

def handler(event, context):
response = requests.get('https://a0.awsstatic.com/main/images/logos/aws_smile-header-desktop-en-white_59x35.png', stream=True)
img = Image.open(response.raw)

print(response.status_code)
print(img.size)

return response.status_code
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ idna==2.10
urllib3==1.26.7
# Requests used by this lambda
requests==2.26.0
# Pillow 6.x so that python 2.7 and 3.x can both use this fixture
Pillow==8.4.0

0 comments on commit a22b111

Please sign in to comment.