Skip to content
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

Secret key exposed on oTreeHub with single-line triple-quoted string #107

Open
peterjc opened this issue Sep 24, 2021 · 2 comments
Open

Comments

@peterjc
Copy link

peterjc commented Sep 24, 2021

There doesn't seem to be a search option, so the page number may change...

  1. Goto https://www.otreehub.com/projects/?page=6 (page number will change)
  2. Find the "test-carl" entry:

test-carl

Links

  • Demo
  • Browse source code
  • Download

Description
""" SECRET_KEY = "#n38c)phqy1^2qhv8pk18i_3v9b%#n+*y__@611$a+s#$&a4ao" # if an app is included in SESSION_CONFIGS, you don"t need to list it here INSTALLED_APPS = ["otree"] #DATABASE_URL = "postgres://postgres@localhost/django_db" #REDIS_URL = "redis://localhost:6379"

Apps

  • effort Separate players based on real effort task and gender into groups competing against each other
  • Veronika ""\n

Last updated
2020-11-03

  1. Notice the secret key is shown as if it was part of DEMO_PAGE_INTRO_HTML setting.
  2. Click the tool title link, or go to https://www.otreehub.com/projects/test-carl/
  3. Again the SECRET_KEY is visible and following lines too
  4. Click "browse source code"
  5. Click "settings.py"
  6. The file currently ends as follows:
...
#OTREE_AUTH_LEVEL = "STUDY"
ADMIN_USERNAME = "admin"
# for security, best to set admin password in an environment variable
ADMIN_PASSWORD = environ.get("OTREE_ADMIN_PASSWORD")

DEMO_PAGE_INTRO_HTML = """ """

SECRET_KEY = "#n38c)phqy1^2qhv8pk18i_3v9b%#n+*y__@611$a+s#$&a4ao"

# if an app is included in SESSION_CONFIGS, you don"t need to list it here
INSTALLED_APPS = ["otree"]

#DATABASE_URL = "postgres://postgres@localhost/django_db"
#REDIS_URL = "redis://localhost:6379"

"""environ["DATABASE_URL"] = "postgres://postgres@localhost/django_db"
environ["REDIS_URL"] = "redis://localhost:6379"
environ["OTREE_ADMIN_PASSWORD"] = "odraSe5ku"
environ["OTREE_AUTH_LEVEL"] = "STUDY" 
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/effort/data")]
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = "/static/" """

if environ.get('OTREE_PRODUCTION') not in {None, '', '0'}:
    DEBUG = False
else:
    DEBUG = True

environ["OTREE_AUTH_LEVEL"] = "STUDY"
environ["OTREE_ADMIN_PASSWORD"] = "odraSe5ku"
PRODUCTION = 1
  1. Notice the line DEMO_PAGE_INTRO_HTML = """ """ sets the description to a single space.
  2. Notice the text shown continues to the start of a multi-line string (being used as a comment).
  3. I suspect that oTree Hub is somehow parsing settings.py to try to pull out the value, and this corner case of a triple-quoted string on a single-line breaks it - and it continues taking text until the next triple-quote.
@peterjc
Copy link
Author

peterjc commented Sep 24, 2021

(This isn't a serious security issue because by design the SECRET_KEY is visible anyway by downloading or browsing the source code)

@oTree-org
Copy link
Owner

oTree-org commented Sep 24, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants