-
Notifications
You must be signed in to change notification settings - Fork 56
add minimum key size checks and warnings #81
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
Changes from 5 commits
2a9c7c3
7a3872d
a5d008b
01e65d1
a9c9eed
ac9d0b3
7b0ae7d
d1bb974
68502f2
8e7897c
eabde32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You | ||
# may not use this file except in compliance with the License. A copy of | ||
# the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "license" file accompanying this file. This file is | ||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF | ||
# ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
"""Stub to allow relative imports of examples from tests.""" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
""" | ||
Helper utilities for use while testing examples. | ||
""" | ||
import os | ||
import sys | ||
|
||
os.environ["AWS_ENCRYPTION_SDK_EXAMPLES_TESTING"] = "yes" | ||
sys.path.extend([os.sep.join([os.path.dirname(__file__), "..", "..", "test", "integration"])]) | ||
|
||
from integration_test_utils import cmk_arn, ddb_table_name # noqa pylint: disable=unused-import |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,11 +15,14 @@ | |
|
||
import copy | ||
import itertools | ||
import logging | ||
import os | ||
from collections import defaultdict | ||
from decimal import Decimal | ||
|
||
import boto3 | ||
import pytest | ||
import six | ||
from boto3.dynamodb.types import Binary | ||
from moto import mock_dynamodb2 | ||
|
||
|
@@ -36,6 +39,7 @@ | |
from dynamodb_encryption_sdk.structures import AttributeActions | ||
from dynamodb_encryption_sdk.transform import ddb_to_dict, dict_to_ddb | ||
|
||
RUNNING_IN_TRAVIS = "TRAVIS" in os.environ | ||
_DELEGATED_KEY_CACHE = defaultdict(lambda: defaultdict(dict)) | ||
TEST_TABLE_NAME = "my_table" | ||
TEST_INDEX = { | ||
|
@@ -44,7 +48,7 @@ | |
} | ||
SECONARY_INDEX = { | ||
"secondary_index_1": {"type": "B", "value": Binary(b"\x00\x01\x02")}, | ||
"secondary_index_1": {"type": "S", "value": "another_value"}, | ||
"secondary_index_2": {"type": "S", "value": "another_value"}, | ||
} | ||
TEST_KEY = {name: value["value"] for name, value in TEST_INDEX.items()} | ||
TEST_BATCH_INDEXES = [ | ||
|
@@ -641,3 +645,13 @@ def client_cycle_batch_items_check_paginators( | |
e_scan_result = e_client.scan(TableName=table_name, ConsistentRead=True) | ||
assert not raw_scan_result["Items"] | ||
assert not e_scan_result["Items"] | ||
|
||
|
||
@pytest.fixture | ||
def capturing_logger(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can't we use Capture Log here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like they don't document it, but yes, we can use that. The undocumented bit is that you can actually get the logged data[1]. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought I remembered this being somewhere else...turns out this is part of pytest now. |
||
output_stream = six.StringIO() | ||
handler = logging.StreamHandler(stream=output_stream) | ||
logger = logging.getLogger() | ||
logger.setLevel(logging.DEBUG) | ||
logger.addHandler(handler) | ||
return output_stream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not going to block on this, but nested list comprehensions can make this code hard to parse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karlw00t That's not a list comprehension, it's just two boolean checks
It just compressed this:
to this: