Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,12 @@ object DatasetResource {
name: String,
normalizedEmail: String
): Integer = {
// Match on the lower-cased email so a contributor entered as "A@b.com"
// resolves to the account stored as "a@b.com".
val existing = ctx
.select(USER.UID)
.from(USER)
.where(DSL.lower(USER.EMAIL).eq(normalizedEmail))
.where(DSL.condition(s"lower(\"user\".\"email\") = '$normalizedEmail'"))
Comment on lines +212 to +217

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 12 'EmailUtil|def normalize|def isValid' --glob '*.scala' --glob '*.java' .

rg -n -C 12 \
  'resolveContributorUid|contributorEmail|DSL\.condition|DSL\.lower\(USER\.EMAIL\)' \
  --glob '*.scala' .

rg -n -C 8 \
  'resolveContributorUid|case-insensitively|shared@test\.com' \
  file-service/src/test/scala/org/apache/texera/service/resource/DatasetResourceSpec.scala

Repository: sshiv012/texera

Length of output: 50371


Injection (CWE-89): Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

Reachability: External

Use a bound jOOQ value instead of SQL interpolation.

EmailUtil.isValid does not escape SQL metacharacters. Bind normalizedEmail with DSL.lower(USER.EMAIL).eq(normalizedEmail) and add a regression test for an existing account matched case-insensitively.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@file-service/src/main/scala/org/apache/texera/service/resource/DatasetResource.scala`
around lines 212 - 217, Update the existing-account lookup in DatasetResource
around existing to replace interpolated SQL with the bound jOOQ predicate
DSL.lower(USER.EMAIL).eq(normalizedEmail). Add a regression test verifying an
existing account is matched case-insensitively.

.fetchOne(USER.UID)
if (existing != null) {
existing
Expand Down