Skip to content

Instantly share code, notes, and snippets.

@ryan-lane
Created February 4, 2016 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryan-lane/5ed3f4b83e5f13a70d17 to your computer and use it in GitHub Desktop.
Save ryan-lane/5ed3f4b83e5f13a70d17 to your computer and use it in GitHub Desktop.
Example of secrets in source code.
# Shady looking variables, with high entropy values
ACCESS_TOKEN = 'lWxxtmzKD78tmCP8tIcQ'
ACCESS_TOKEN_SECRET = 'l6q3ztS5pMz5i62WvovPyrAAjRfczKIHtmv'
# Innocent looking variable, but shady looking dict key with a high
# entropy value.
INNOCENT_DICT = {'secret1': 'O80NhqsbKahKnqioQdv7'}
def check_password(password):
# Comparison with a high entropy string
if password == 'FMwoP5Bg0FZiIkLRgoaj':
return True
# List with high entropy strings
elif password in ['ZzjpTWRe9SnidDb7d2MR', 'pmHFdYrNYvOVQWqYjDgL']:
return True
return False
# Function definition with a shady looking kwarg and a high
# entropy value.
def call_api(api_key='o7fopdjCQ8uoXbpaVEax'):
# function call with an argument with high entropy.
expiration = api.call(api_key,'Mqgk65osbzRYESUD47hd')
# function call with a high entropy string, but a safe
# looking caller and a safe looking variable target
expiration = expiration.strftime('%Y%m%dT%H%M%SZ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment