luckyframework / luckyframework/avram

Save operation does not protect against assigning an index to the wrong table

Open
#374 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I have a save operation:
SaveTopic.create!(name: "my-topic", forum_id: make_forum.id, created_by_id: make_user.id)

If I happen to confuse what I am assigning to forum_id to be make_user.id instead of make_forum.id, I am not warned, because the type of id is Int64 in both cases.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the SaveTopic.create! save operation and how forum_id and created_by_id are handled. Determine the intended way to detect an ID assigned from the wrong table, then define completion as rejecting or clearly warning about the mismatched assignment with coverage for the example shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal, postgresql
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.