PythonInjection & inputDifficulty 2/3
import base64
import pickle
from flask import request, jsonify
@app.get("/api/preferences")
def preferences():
raw = request.cookies.get("prefs", "")
prefs = pickle.loads(base64.b64decode(raw)) # the cookie comes from the browser
return jsonify(theme=prefs.get("theme", "light"))