mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-05 17:53:12 +02:00
poc: sql injection in large resources read model
This commit is contained in:
parent
72de574012
commit
173edfb1c0
@ -92,3 +92,19 @@ test('can calculate resource size', async () => {
|
|||||||
expect(project.size).toBe(feature1.size + feature2.size);
|
expect(project.size).toBe(feature1.size + feature2.size);
|
||||||
expect(feature1.size).toBeGreaterThan(feature2.size);
|
expect(feature1.size).toBeGreaterThan(feature2.size);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should demonstrate SQL injection vulnerability', async () => {
|
||||||
|
const maliciousLimit = '1; DROP TABLE feature_strategies; --';
|
||||||
|
let errorOccurred = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await largestResourcesReadModel.getLargestProjectEnvironments(
|
||||||
|
maliciousLimit,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
errorOccurred = true;
|
||||||
|
console.log('SQL injection attempt caught:', error.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(errorOccurred).toBe(true);
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user