Skip to content

Conversation

@eyaprak
Copy link
Owner

@eyaprak eyaprak commented Jan 20, 2026

Summary

  • Add database utility functions

Test plan

  • Test database queries

@github-actions github-actions bot added the reviewing:claude-ai Being reviewed by Claude AI label Jan 20, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🤖 Claude Code Review

This PR adds database utility functions but contains multiple serious security vulnerabilities and data safety issues. The code includes SQL injection vulnerabilities, XSS risks, exposed credentials, and unsafe data deletion functions that could compromise the application's security and data integrity.

📁 Files reviewed (2 files, 36 changes)
  • 🆕 src/lib/bad-code.ts (+36/-0)
  • 🆕 testxxx22.png (+0/-0)

Issues Found

  • 🚨 Critical: 4

Changes requested - Please fix the critical issues before merging.


Powered by Claude AI


// CRITICAL: SQL Injection vulnerability - user input directly in query
export async function getUserByName(name: string) {
const result = await prisma.$queryRawUnsafe(
Copy link
Contributor

Choose a reason for hiding this comment

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

🚨 CRITICAL

SQL injection vulnerability: User input is directly interpolated into the SQL query without sanitization. An attacker could inject malicious SQL by providing input like '; DROP TABLE users; --. Use parameterized queries or Prisma's type-safe query methods instead.

}

// CRITICAL: XSS vulnerability - rendering unsanitized HTML
export function renderUserComment(comment: string): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚨 CRITICAL

XSS vulnerability: User comment content is directly inserted into HTML without sanitization. Malicious users could inject JavaScript code like <script>alert('XSS')</script>. Sanitize the comment content or use a templating system that escapes HTML by default.

return `<div class="comment">${comment}</div>`;
}

// CRITICAL: Hardcoded credentials exposed in code
Copy link
Contributor

Choose a reason for hiding this comment

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

🚨 CRITICAL

Exposed credentials: Database password and API secret key are hardcoded in the source code. These will be visible to anyone with access to the repository. Move these to environment variables and never commit secrets to version control.

}

// CRITICAL: Deleting all data without confirmation
export async function clearAllUsers() {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚨 CRITICAL

Data loss risk: This function deletes all user data without any confirmation mechanism or access controls. This could result in catastrophic data loss if called accidentally or by unauthorized users. Add proper authorization checks and confirmation mechanisms.

@github-actions github-actions bot added claude:changes-requested Claude AI requested changes and removed reviewing:claude-ai Being reviewed by Claude AI labels Jan 20, 2026
@eyaprak
Copy link
Owner Author

eyaprak commented Jan 20, 2026

Test PR with bad code - closing

@eyaprak eyaprak closed this Jan 20, 2026
@eyaprak eyaprak deleted the test/bad-code branch January 20, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude:changes-requested Claude AI requested changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants