Theory
Imagine an app that searches authors by name:
query = f'SELECT ?b WHERE {{ ?b :author "{user_input}" }}'
If user_input is Alice" } UNION { ?b ?p ?o the query escapes its string and dumps the whole dataset. SPARQL UPDATE makes this even worse: an attacker can INSERT DATA or DROP GRAPH.
Rule: never splice untrusted text into a SPARQL string. Bind it as a typed term.