# Security Best Practices (Laravel) > Ochrona CSRF, zapobieganie XSS, SQL injection, mass assignment, bezpieczeństwo uwierzytelniania, szyfrowanie, hashing, rate limiting - 22 pytań z rozmów - Senior - [Pytania z rozmów: Laravel](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne.md) ## 1. Czym jest ochrona CSRF w Laravel? **Odpowiedź** Ochrona CSRF (Cross-Site Request Forgery) zapobiega atakom typu cross-site request poprzez walidację unikalnego tokenu dla każdej sesji. Laravel automatycznie generuje ten token i weryfikuje go we wszystkich żądaniach POST, PUT, PATCH, DELETE. Trasy API są wyłączone, ponieważ zwykle używają bezstanowego uwierzytelniania opartego na tokenie. ## 2. Jak Laravel domyślnie zapobiega atakom XSS? **Odpowiedź** Laravel automatycznie escapuje wszystkie zmienne wyświetlane za pomocą składni Blade {{ $variable }}. To escapowanie konwertuje specjalne znaki HTML na encje, zapobiegając wykonaniu złośliwych skryptów. Aby wyświetlić surowy HTML, należy jawnie użyć {!! $variable !!}, co zmusza programistę do świadomego wyboru. ## 3. Jaka jest rola właściwości $fillable w modelu Eloquent? **Odpowiedź** Właściwość $fillable definiuje białą listę atrybutów, które można masowo przypisać przez create() lub update(). Chroni to przed atakami mass assignment, w których złośliwy użytkownik mógłby zmodyfikować wrażliwe pola, takie jak is_admin czy role_id. Alternatywą jest $guarded, definiujące czarną listę chronionych pól. ## Jeszcze 19 dostępnych pytań - Której metody należy użyć do hashowania hasła w Laravel? - Jak Laravel chroni przed SQL injection? Zarejestruj się za darmo: https://sharpskill.dev/pl/login ## Inne tematy rekrutacyjne Laravel - [Podstawy PHP](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/php-basics.md): 25 pytań, Junior - [Podstawy programowania obiektowego w PHP](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/php-oop-essentials.md): 20 pytań, Junior - [Composer & Autoloading](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/composer-autoloading.md): 18 pytań, Junior - [Podstawy Laravel](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/laravel-fundamentals.md): 20 pytań, Junior - [Routing w Laravel](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/laravel-routing.md): 20 pytań, Junior - [Blade Templates](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/blade-templates.md): 18 pytań, Junior - [Request & Response](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/request-response.md): 20 pytań, Junior - [Podstawy Eloquent ORM](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/eloquent-orm-basics.md): 22 pytań, Junior - [Eloquent Relationships](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/eloquent-relationships.md): 25 pytań, Mid-Level - [Migrations & Schema Builder](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/database-migrations.md): 20 pytań, Mid-Level - [Walidacja i formularze](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/validation-forms.md): 22 pytań, Mid-Level - [Uwierzytelnianie](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/authentication.md): 20 pytań, Mid-Level - [Autoryzacja i Policies](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/authorization-policies.md): 18 pytań, Mid-Level - [API Resources & Authentication](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/api-resources-authentication.md): 26 pytań, Mid-Level - [Middleware](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/middleware.md): 18 pytań, Mid-Level - [Service Container & DI](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/service-container-di.md): 20 pytań, Mid-Level - [Queues & Jobs](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/queues-jobs.md): 22 pytań, Mid-Level - [Events & Listeners](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/events-listeners.md): 18 pytań, Mid-Level - [Powiadomienia & Mail](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/notifications-mail.md): 20 pytań, Mid-Level - [File Storage](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/file-storage.md): 18 pytań, Mid-Level - [Testing & PHPUnit](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/testing-phpunit.md): 24 pytań, Mid-Level - [Caching](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/caching.md): 18 pytań, Mid-Level - [Livewire & Inertia](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/livewire-inertia.md): 20 pytań, Mid-Level - [Eloquent Advanced](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/eloquent-advanced.md): 24 pytań, Senior - [Repository Pattern](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/repository-pattern.md): 20 pytań, Senior - [Laravel Packages](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/laravel-packages.md): 20 pytań, Senior - [Performance Optimization](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/performance-optimization.md): 22 pytań, Senior - [Laravel Octane](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/laravel-octane.md): 18 pytań, Senior - [Laravel Distributed Systems](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/laravel-distributed-systems.md): 22 pytań, Senior - [Observability & Monitoring](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/observability-monitoring.md): 20 pytań, Senior - [Deployment & DevOps](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/deployment-devops.md): 20 pytań, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/security-best-practices