Skip to content

test: add file with intentional issues#2

Open
tusharshah21 wants to merge 1 commit intomainfrom
test/optimized-prompt
Open

test: add file with intentional issues#2
tusharshah21 wants to merge 1 commit intomainfrom
test/optimized-prompt

Conversation

@tusharshah21
Copy link
Owner

@tusharshah21 tusharshah21 commented Dec 24, 2025

this is a test created for checking the power of the LLM with more better prompt nothing else


function calculateDiscount(price, discount) {
var total = price - discount;
return total / discount;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[BUG] Division by zero risk if discount is zero. Add check to prevent division by zero.

}

function getUserData(userId) {
const query = "SELECT * FROM users WHERE id = " + userId;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SECURITY] SQL injection risk by directly concatenating user input into query. Use parameterized queries or ORM to prevent injection.


function processItems(items) {
for (let i = 0; i < items.length; i++) {
for (let j = 0; j < items.length; j++) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[PERF] O(n²) complexity due to nested loops for duplicate check. Use a Set or Map to track seen IDs for O(n) complexity.

}
}

const API_KEY = "sk-1234567890abcdef";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SECURITY] Hardcoded API key. Remove from source code and use environment variables or secure vaults.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant