Lesson:
Regex Injection
Public previewWant everyone on your software team to learn this? Get completion tracking and compliance reporting with Hacksplaining for Teams. Free 14-day trial.
Train my teamregex-validation.py@app.route('/share/<path:link>')
def share(link):
"""Return the meta-data for a web-link shared by a user."""
# Validate the URL has a protocol using a regular expression.
link = link if re.match("^[a-z]+://.*", link) else f"https://{link}"
# Go grab the meta-data.
return OpenGraph(url=link).to_json()