ArmyCyberInstitute / cmgr

CTF Challenge Manager
Apache License 2.0
18 stars 9 forks source link

`flask` container template is broken because of function deprecation #54

Open codders opened 1 year ago

codders commented 1 year ago

The flask container template relies on @app.before_first_request, which is deprecated since version 2.3.0 of Flask. Launching the container, or any challenge that depends on it, results in a crash loop:

Traceback (most recent call last):
  File "/usr/local/bin/flask", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 1064, in main
    cli.main()
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 912, in run_command
    raise e from None
  File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 898, in run_command
    app = info.load_app()
  File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 313, in load_app
    app = locate_app(import_name, None, raise_if_not_found=False)
  File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 219, in locate_app
    __import__(module_name)
  File "/app/app.py", line 28, in <module>
    @app.before_first_request
AttributeError: 'Flask' object has no attribute 'before_first_request'
codders commented 1 year ago

Opened #55 to fix this