Skip to content

Commit

Permalink
Create sqlInjectionTest.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Dec 4, 2024
1 parent 354df92 commit cf91491
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/tests/securityTests/sqlInjectionTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// tests/securityTests/sqlInjectionTest.js

const axios = require('axios');

async function testSqlInjection() {
const maliciousInput = "' OR '1'='1"; // Example of SQL injection payload
try {
const response = await axios.get(`http://localhost:3000/api/users?username=${maliciousInput}`);
console.log('SQL Injection Test Response:', response.data);
} catch (error) {
console.error('SQL Injection Test Failed:', error.message);
}
}

testSqlInjection();

0 comments on commit cf91491

Please sign in to comment.