Secure coding practices for Python applications. SQL Injection Prevention 1# ❌ Vulnerable 2user_input = request.GET['username'] 3query = f"SELECT * FROM users WHERE username = '{user_input}'" 4cursor.execute(query) 5 6# ✅ Secure: Parameterized queries 7user_input = …
Read MoreTools for checking vulnerabilities in Python code. Safety - Dependency Scanner 1# Install 2pip install safety 3 4# Check dependencies 5safety check 6 7# Check requirements file 8safety check -r requirements.txt 9 10# JSON output 11safety check --json Bandit - Static Security Analysis 1# Install 2pip install bandit 3 4# …
Read MoreComprehensive checklist for code reviewers to ensure thorough and constructive reviews. Functionality 1□ Code does what it's supposed to do 2□ Requirements are met 3□ Edge cases are handled 4□ Error handling is appropriate 5□ No obvious bugs 6□ Logic is sound Code Quality 1□ Code is readable and maintainable 2□ …
Read MoreCommon code smells in Rust and how to fix them. Unwrap/Expect Abuse 1// ❌ Bad 2let value = some_option.unwrap(); 3let result = some_result.expect("failed"); 4 5// ✅ Good 6let value = some_option.ok_or(Error::MissingValue)?; 7let result = some_result?; Clone Instead of Borrow 1// ❌ Bad 2fn process(data: …
Read MoreSecure coding practices for Rust applications. SQL Injection Prevention 1// ❌ Vulnerable 2let username = req.param("username"); 3let query = format!("SELECT * FROM users WHERE username = '{}'", username); 4conn.query(&query); 5 6// ✅ Secure (using sqlx) 7let username = …
Read MoreTools for checking vulnerabilities in Rust code. Cargo Audit 1# Install 2cargo install cargo-audit 3 4# Check vulnerabilities 5cargo audit 6 7# Fix vulnerabilities 8cargo audit fix 9 10# JSON output 11cargo audit --json Cargo Deny 1# Install 2cargo install cargo-deny 3 4# Initialize config 5cargo deny init 6 7# Check …
Read MoreCommon code smells in TypeScript and how to fix them. Using any 1// ❌ Bad 2function process(data: any) { 3 return data.value; 4} 5 6// ✅ Good 7interface Data { 8 value: string; 9} 10function process(data: Data) { 11 return data.value; 12} Not Using Optional Chaining 1// ❌ Bad 2const city = user && user.address …
Read MoreSecure coding practices for TypeScript applications. XSS Prevention 1// ❌ Vulnerable 2function displayMessage(message: string) { 3 document.getElementById('output')!.innerHTML = message; 4} 5 6// ✅ Secure 7function displayMessage(message: string) { 8 const element = document.getElementById('output')!; 9 …
Read MoreTools for checking vulnerabilities in TypeScript/JavaScript code. npm audit 1# Check vulnerabilities 2npm audit 3 4# Fix automatically 5npm audit fix 6 7# Force fix (may break) 8npm audit fix --force 9 10# JSON output 11npm audit --json Snyk 1# Install 2npm install -g snyk 3 4# Authenticate 5snyk auth 6 7# Test project …
Read More