Your question is OWASP Weakness Recognition. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
Checkmarx builds static analysis tools, so its own interview loop asks candidates to do exactly what the product does: spot real vulnerabilities in a code sample and map them to OWASP Top 10 categories. Here is the snippet, an excerpt from an internal Flask service that handles scan-completion webhooks and serves rule pack files.
import hmac
from flask import Flask, request, jsonify
app = Flask(__name__)
SCANNER_API_KEY = "cx-live-8f2a9d7e4b1c6f3a0d5e9b7c2f4a1d8e"
RULES_DIR = "/opt/checkmarx/rule-packs"
@app.route("/webhook/scan-complete", methods=["POST"])
def scan_complete():
signature = request.headers.get("X-Signature", "")
expected = hmac.new(SCANNER_API_KEY.encode(), request.get_data(), "sha256").hexdigest()
if signature == expected:
return jsonify({"status": "accepted"})
return jsonify({"status": "rejected"}), 401
@app.route("/rules/<pack_name>", methods=["GET"])
def get_rule_pack(pack_name):
path = RULES_DIR + "/" + pack_name
with open(path) as f:
contents = f.read()
return jsonify({"pack": pack_name, "rules": contents})
Identify and explain the security weaknesses in this code, and for each one, name the OWASP Top 10 category it falls under.