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 @@ -87,6 +87,7 @@ data class UserEntity(
@Column(nullable = false)
@property:GenerateInput(type = InputType.HIDDEN, visible = true, ignore = true)
@property:GenerateOverview(renderer = OverviewType.ID, columnName = "ID", order = -1)
@property:ImportFormat
override var id: Int = 0,
Comment on lines +90 to 91

@coderabbitai coderabbitai Bot Jun 7, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Importing generated primary key enables accidental overwrite/collision paths.

id is @GeneratedValue, but this annotation now makes it part of CSV import/export selection. In the current import flow (CsvParserUtil + repo.saveAll), non-zero incoming IDs can map to existing rows and mutate the wrong user or cause PK conflicts. Please gate this (export-only, privileged mode, or strict validation that imported IDs are absent/new and sequence-safe) before persisting.

🤖 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 `@backend/src/main/kotlin/hu/bme/sch/cmsch/model/UserEntity.kt` around lines 90
- 91, The id field in UserEntity is annotated for import/export (ImportFormat)
despite being `@GeneratedValue`, which lets imported non-zero IDs overwrite or
conflict when CsvParserUtil + repo.saveAll persists; remove or mark the id as
export-only (i.e., stop treating it as an importable field) OR add validation in
the import flow (CsvParserUtil or the service that calls repo.saveAll) to
reject/zero-out any incoming id values unless running in a privileged
"preserve-ids" mode and ensure sequence safety before persisting; update
UserEntity's id ImportFormat usage or add a strict check in the import path so
only new/zero IDs are saved to avoid PK collisions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Isti01 this should be fine right? Importing is not enabled on users iirc

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!


@field:JsonView(value = [ Edit::class ])
Expand Down
Loading