Use UTF-8 compliant test passwords and deployment secrets.

pull/1344/head
Kieran Prasch 2019-09-19 17:26:05 -07:00
parent 6b43e4a218
commit 9469a1f720
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
2 changed files with 9 additions and 4 deletions

View File

@ -48,7 +48,7 @@ from nucypher.config.constants import DEFAULT_CONFIG_ROOT
@click.option('--contract-name', help="Deploy a single contract by name", type=click.STRING)
@click.option('--gas', help="Operate with a specified gas per-transaction limit", type=click.IntRange(min=1))
@click.option('--deployer-address', help="Deployer's checksum address", type=EIP55_CHECKSUM_ADDRESS)
@click.option('--retarget', '-d', help="Retarget a contract;s proxy.", is_flag=True)
@click.option('--retarget', '-d', help="Retarget a contract's proxy.", is_flag=True)
@click.option('--target-address', help="Recipient's checksum address for token or ownership transference.", type=EIP55_CHECKSUM_ADDRESS)
@click.option('--registry-infile', help="Input path for contract registry file", type=EXISTING_READABLE_FILE)
@click.option('--value', help="Amount of tokens to transfer in the smallest denomination", type=click.INT)

View File

@ -19,6 +19,7 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
import contextlib
import os
import socket
import string
import tempfile
import time
from datetime import datetime
@ -96,7 +97,9 @@ NUMBER_OF_ALLOCATIONS_IN_TESTS = 100 # TODO: Move to constants
# Insecure Secrets
#
INSECURE_DEVELOPMENT_PASSWORD = ''.join(SystemRandom().choice(ascii_uppercase + digits) for _ in range(16))
__valid_password_chars = string.ascii_uppercase + string.ascii_lowercase + string.digits
INSECURE_DEVELOPMENT_PASSWORD = ''.join(SystemRandom().choice(__valid_password_chars) for _ in range(16))
STAKING_ESCROW_DEPLOYMENT_SECRET = INSECURE_DEVELOPMENT_PASSWORD + str(os.urandom(16))
@ -106,6 +109,10 @@ USER_ESCROW_PROXY_DEPLOYMENT_SECRET = INSECURE_DEVELOPMENT_PASSWORD + str(os.ura
ADJUDICATOR_DEPLOYMENT_SECRET = INSECURE_DEVELOPMENT_PASSWORD + str(os.urandom(16))
INSECURE_DEPLOYMENT_SECRET_PLAINTEXT = bytes(''.join(SystemRandom().choice(__valid_password_chars) for _ in range(16)), encoding='utf-8')
INSECURE_DEPLOYMENT_SECRET_HASH = keccak_digest(INSECURE_DEPLOYMENT_SECRET_PLAINTEXT)
#
# Temporary Directories and Files
@ -155,5 +162,3 @@ TEST_GAS_LIMIT = 8_000_000 # gas
PYEVM_GAS_LIMIT = TEST_GAS_LIMIT # TODO: move elsewhere (used to set pyevm gas limit in tests)?
INSECURE_DEPLOYMENT_SECRET_PLAINTEXT = os.urandom(32)
INSECURE_DEPLOYMENT_SECRET_HASH = keccak_digest(INSECURE_DEPLOYMENT_SECRET_PLAINTEXT)