~cytrogen/gstack

ref: cc9e6f8f35b4fb6d6dcdc3bc776c70efc75e9aa3 gstack/test/fixtures/review-eval-vuln.rb -rw-r--r-- 406 bytes
cc9e6f8f — Garry Tan feat: /retro global — cross-project AI coding retrospective (v0.10.2.0) (#316) a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class UserController < ApplicationController
  def show
    # SQL injection — interpolating user input directly into query
    @user = User.where("id = #{params[:id]}").first
    render json: @user
  end

  def promote
    # Bypasses ActiveRecord validations — update_column skips callbacks + validation
    @user = User.find(params[:id])
    @user.update_column(:role, 'admin')
    head :ok
  end
end