chore: improve response security
This commit is contained in:
@@ -147,7 +147,7 @@ def get_strategy(
|
|||||||
strategy: str, config=Depends(get_config), rpc: RPC | None = Depends(get_rpc_optional)
|
strategy: str, config=Depends(get_config), rpc: RPC | None = Depends(get_rpc_optional)
|
||||||
):
|
):
|
||||||
if ":" in strategy:
|
if ":" in strategy:
|
||||||
raise HTTPException(status_code=500, detail="base64 encoded strategies are not allowed.")
|
raise HTTPException(status_code=422, detail="base64 encoded strategies are not allowed.")
|
||||||
|
|
||||||
if not rpc or config["runmode"] == RunMode.WEBSERVER:
|
if not rpc or config["runmode"] == RunMode.WEBSERVER:
|
||||||
# webserver mode
|
# webserver mode
|
||||||
@@ -162,7 +162,11 @@ def get_strategy(
|
|||||||
except OperationalException:
|
except OperationalException:
|
||||||
raise HTTPException(status_code=404, detail="Strategy not found")
|
raise HTTPException(status_code=404, detail="Strategy not found")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=502, detail=str(e))
|
logger.exception("Unexpected error while loading strategy '%s'.", strategy)
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=502,
|
||||||
|
detail="Unexpected error while loading strategy.",
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
# trade mode
|
# trade mode
|
||||||
strategy_obj = rpc._freqtrade.strategy
|
strategy_obj = rpc._freqtrade.strategy
|
||||||
|
|||||||
Reference in New Issue
Block a user