<commit_before>class OneoffsController < ApplicationController
  before_action :load_heritage, only: [:create]
  before_action :load_oneoff, except: [:index, :create]

  def show
    render json: @oneoff
  end

  def create
    @oneoff = @heritage.oneoffs.create!(create_params)
    @oneoff.run!
    render json: @oneoff
  end

  private

  def create_params
    params.permit [
      :env_vars,
      command: []
    ]
  end

  def load_heritage
    @heritage = Heritage.find_by!(name: params[:heritage_id])
  end

  def load_oneoff
    @oneoff = Oneoff.find_by!(id: params[:id])
  end
end<commit_msg>Fix oneoff params whitelisting<commit_after>class OneoffsController < ApplicationController
  before_action :load_heritage, only: [:create]
  before_action :load_oneoff, except: [:index, :create]

  def show
    render json: @oneoff
  end

  def create
    @oneoff = @heritage.oneoffs.create!(create_params)
    @oneoff.run!
    render json: @oneoff
  end

  private

  def create_params
    params.permit [
      command: []
    ].tap do |whitelisted|
      whitelisted[:env_vars] = params[:env_vars]
    end
  end

  def load_heritage
    @heritage = Heritage.find_by!(name: params[:heritage_id])
  end

  def load_oneoff
    @oneoff = Oneoff.find_by!(id: params[:id])
  end
end
{'fraction_non_alphanumeric': 0.10140405616224649, 'fraction_numerical': 0.0, 'mean_word_length': 3.517605633802817, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4135957', 'n_tokens_mistral': 450, 'n_tokens_neox': 436, 'n_words': 101}