Skip to content

Instantly share code, notes, and snippets.

Created April 25, 2023 13:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
CodeQL Workshop Sample - DC44131, 2023
from flask import Flask, request, render_template
import psycopg2
app = Flask(__name__)
conn = psycopg2.connect("dbname=workshop user=postgres")
def lookup(data):
cursor = conn.cursor()
query = f"SELECT * FROM metadata WHERE name='{data}' OR data='{data}'"
return cursor.fetchall()
def index():
search = request.args.get("search")
results = lookup(search)
return render_template(
"search.html", results=results
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment