<commit_before><?php

namespace App\Http\Requests;

use Illuminate\Http\Request as NormalRequest;
use App\Http\Requests\Request;

class UpsertUserRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize(NormalRequest $request)
    {
        $user = $request->input();

        if (!empty($user) && $user['id'] == \Auth::user()->id) {
            return true;
        }

        // Only administrators are allowed to upsert users
        return !empty(\Auth::user()) && \Auth::user()->hasRole('administrator');
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //
        ];
    }
}<commit_msg>Safety note<commit_after><?php

namespace App\Http\Requests;

use Illuminate\Http\Request as NormalRequest;
use App\Http\Requests\Request;

class UpsertUserRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize(NormalRequest $request)
    {
        $user = $request->input();

        // You're allowed to upsert your own profile
        // Note: this includes roles which is bad
        if (!empty($user) && $user['id'] == \Auth::user()->id) {
            return true;
        }

        // Only administrators are allowed to upsert users
        return !empty(\Auth::user()) && \Auth::user()->hasRole('administrator');
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //
        ];
    }
}
{'fraction_non_alphanumeric': 0.12707498568975387, 'fraction_numerical': 0.0, 'mean_word_length': 2.0452961672473866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2219287', 'n_tokens_mistral': 486, 'n_tokens_neox': 482, 'n_words': 139}