Software Development with GitHub Copilot
Thalia Barrera
AI Engineering Curriculum Manager, DataCamp

def get_user(username):
query = f"SELECT * FROM users \
WHERE username = '{username}'"
return db.execute(query)
An attacker can inject SQL:
users table[screencast]
[screencast]
Targeted review
Review
#selectionfor SQL injection and XSS vulnerabilities
Codebase-wide scan
@workspacescan for hardcoded credentials or API keys
[screencast]

Defensive code generation
Add input validation to this endpoint. Reject unexpected types and enforce length limits.
Don't just find vulnerabilities — prevent them
.github/copilot-instructions.md
## Security standards
- Use parameterized queries
- Never hardcode credentials or API keys
- Validate and sanitize all user input
- Use bcrypt or argon2 for password hashing
.github/instructions/security.instructions.md
applyTo: "**/*.py"
- Use secrets module instead of random for tokens
- Escape all user input in Jinja2 templates
✅ Security becomes part of how you write code
Software Development with GitHub Copilot