~cytrogen/gstack

ref: 997f7b1da6a19879fa5bc79c4fe5f71900b8c19f gstack/test/fixtures/review-eval-vuln.rb -rw-r--r-- 406 bytes
997f7b1d — Garry Tan fix: review log architecture — close gaps, add attribution (v0.11.21.0) (#512) 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