@the-bearded-bear/claude-craft 3.1.2 → 3.3.1-next.f4f0d1e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dev/i18n/de/Angular/CLAUDE.md.template +49 -0
- package/Dev/i18n/de/Angular/agents/angular-reviewer.md +213 -0
- package/Dev/i18n/de/Angular/checklists/new-feature.md +125 -0
- package/Dev/i18n/de/Angular/checklists/pre-commit.md +77 -0
- package/Dev/i18n/de/Angular/commands/check-architecture.md +261 -0
- package/Dev/i18n/de/Angular/commands/check-code-quality.md +238 -0
- package/Dev/i18n/de/Angular/commands/check-compliance.md +199 -0
- package/Dev/i18n/de/Angular/commands/check-security.md +263 -0
- package/Dev/i18n/de/Angular/commands/check-testing.md +292 -0
- package/Dev/i18n/de/Angular/commands/generate-component.md +220 -0
- package/Dev/i18n/de/Angular/rules/00-project-context.md.template +78 -0
- package/Dev/i18n/de/Angular/rules/02-architecture-angular.md +477 -0
- package/Dev/i18n/de/Angular/rules/03-coding-standards.md +640 -0
- package/Dev/i18n/de/Angular/rules/06-tooling.md +516 -0
- package/Dev/i18n/de/Angular/rules/07-testing-angular.md +739 -0
- package/Dev/i18n/de/Angular/rules/08-quality-tools.md +501 -0
- package/Dev/i18n/de/Angular/rules/11-security-angular.md +497 -0
- package/Dev/i18n/de/Angular/templates/component.template.ts +115 -0
- package/Dev/i18n/de/Angular/templates/service.template.ts +203 -0
- package/Dev/i18n/de/CSharp/CLAUDE.md.template +65 -0
- package/Dev/i18n/de/CSharp/agents/csharp-reviewer.md +166 -0
- package/Dev/i18n/de/CSharp/checklists/new-feature.md +178 -0
- package/Dev/i18n/de/CSharp/checklists/pre-commit.md +126 -0
- package/Dev/i18n/de/CSharp/commands/check-architecture.md +294 -0
- package/Dev/i18n/de/CSharp/commands/check-code-quality.md +355 -0
- package/Dev/i18n/de/CSharp/commands/check-compliance.md +178 -0
- package/Dev/i18n/de/CSharp/commands/check-security.md +369 -0
- package/Dev/i18n/de/CSharp/commands/check-testing.md +295 -0
- package/Dev/i18n/de/CSharp/commands/generate-feature.md +481 -0
- package/Dev/i18n/de/CSharp/rules/00-project-context.md.template +100 -0
- package/Dev/i18n/de/CSharp/rules/02-architecture-csharp.md +536 -0
- package/Dev/i18n/de/CSharp/rules/03-coding-standards.md +494 -0
- package/Dev/i18n/de/CSharp/rules/06-tooling.md +493 -0
- package/Dev/i18n/de/CSharp/rules/07-testing-csharp.md +566 -0
- package/Dev/i18n/de/CSharp/rules/08-quality-tools.md +497 -0
- package/Dev/i18n/de/CSharp/rules/11-security-csharp.md +568 -0
- package/Dev/i18n/de/CSharp/rules/12-aspire-cloud-native.md +514 -0
- package/Dev/i18n/de/CSharp/templates/command-handler.template.cs +100 -0
- package/Dev/i18n/de/CSharp/templates/entity.template.cs +159 -0
- package/Dev/i18n/de/Common/commands/add-technology.md +195 -0
- package/Dev/i18n/de/Laravel/CLAUDE.md.template +104 -0
- package/Dev/i18n/de/Laravel/agents/laravel-reviewer.md +200 -0
- package/Dev/i18n/de/Laravel/checklists/new-feature.md +277 -0
- package/Dev/i18n/de/Laravel/checklists/pre-commit.md +156 -0
- package/Dev/i18n/de/Laravel/commands/check-architecture.md +306 -0
- package/Dev/i18n/de/Laravel/commands/check-code-quality.md +302 -0
- package/Dev/i18n/de/Laravel/commands/check-compliance.md +141 -0
- package/Dev/i18n/de/Laravel/commands/check-security.md +372 -0
- package/Dev/i18n/de/Laravel/commands/check-testing.md +397 -0
- package/Dev/i18n/de/Laravel/commands/generate-controller.md +388 -0
- package/Dev/i18n/de/Laravel/rules/00-project-context.md.template +140 -0
- package/Dev/i18n/de/Laravel/rules/02-architecture-laravel.md +644 -0
- package/Dev/i18n/de/Laravel/rules/03-coding-standards.md +573 -0
- package/Dev/i18n/de/Laravel/rules/06-tooling.md +580 -0
- package/Dev/i18n/de/Laravel/rules/07-testing-laravel.md +525 -0
- package/Dev/i18n/de/Laravel/rules/08-quality-tools.md +591 -0
- package/Dev/i18n/de/Laravel/rules/11-security-laravel.md +787 -0
- package/Dev/i18n/de/Laravel/templates/action.template.php +79 -0
- package/Dev/i18n/de/Laravel/templates/controller.template.php +99 -0
- package/Dev/i18n/de/Laravel/templates/model.template.php +206 -0
- package/Dev/i18n/de/Laravel/templates/test.template.php +263 -0
- package/Dev/i18n/de/PHP/CLAUDE.md.template +460 -0
- package/Dev/i18n/de/PHP/agents/php-reviewer.md +345 -0
- package/Dev/i18n/de/PHP/checklists/new-feature.md +132 -0
- package/Dev/i18n/de/PHP/checklists/pre-commit.md +231 -0
- package/Dev/i18n/de/PHP/commands/check-architecture.md +557 -0
- package/Dev/i18n/de/PHP/commands/check-code-quality.md +448 -0
- package/Dev/i18n/de/PHP/commands/check-compliance.md +477 -0
- package/Dev/i18n/de/PHP/commands/check-security.md +420 -0
- package/Dev/i18n/de/PHP/commands/check-testing.md +486 -0
- package/Dev/i18n/de/PHP/rules/00-project-context.md.template +266 -0
- package/Dev/i18n/de/PHP/rules/02-architecture-php.md +696 -0
- package/Dev/i18n/de/PHP/rules/03-coding-standards.md +641 -0
- package/Dev/i18n/de/PHP/rules/06-tooling.md +543 -0
- package/Dev/i18n/de/PHP/rules/07-testing-php.md +636 -0
- package/Dev/i18n/de/PHP/rules/08-quality-tools.md +533 -0
- package/Dev/i18n/de/PHP/rules/11-security-php.md +759 -0
- package/Dev/i18n/de/PHP/templates/entity.md +435 -0
- package/Dev/i18n/de/PHP/templates/use-case.md +512 -0
- package/Dev/i18n/de/PHP/templates/value-object.md +555 -0
- package/Dev/i18n/de/VueJS/CLAUDE.md.template +102 -0
- package/Dev/i18n/de/VueJS/agents/vuejs-reviewer.md +206 -0
- package/Dev/i18n/de/VueJS/checklists/new-feature.md +131 -0
- package/Dev/i18n/de/VueJS/checklists/pre-commit.md +68 -0
- package/Dev/i18n/de/VueJS/commands/check-architecture.md +137 -0
- package/Dev/i18n/de/VueJS/commands/check-code-quality.md +152 -0
- package/Dev/i18n/de/VueJS/commands/check-compliance.md +124 -0
- package/Dev/i18n/de/VueJS/commands/check-security.md +186 -0
- package/Dev/i18n/de/VueJS/commands/check-testing.md +185 -0
- package/Dev/i18n/de/VueJS/commands/generate-component.md +233 -0
- package/Dev/i18n/de/VueJS/rules/00-project-context.md.template +125 -0
- package/Dev/i18n/de/VueJS/rules/02-architecture-vuejs.md +375 -0
- package/Dev/i18n/de/VueJS/rules/03-coding-standards.md +502 -0
- package/Dev/i18n/de/VueJS/rules/06-tooling.md +422 -0
- package/Dev/i18n/de/VueJS/rules/07-testing-vuejs.md +606 -0
- package/Dev/i18n/de/VueJS/rules/08-quality-tools.md +441 -0
- package/Dev/i18n/de/VueJS/rules/11-security-vuejs.md +465 -0
- package/Dev/i18n/de/VueJS/templates/component.template.vue +133 -0
- package/Dev/i18n/de/VueJS/templates/composable.template.ts +162 -0
- package/Dev/i18n/de/VueJS/templates/store.template.ts +282 -0
- package/Dev/i18n/de/VueJS/templates/test.template.ts +233 -0
- package/Dev/i18n/en/Angular/CLAUDE.md.template +49 -0
- package/Dev/i18n/en/Angular/agents/angular-reviewer.md +213 -0
- package/Dev/i18n/en/Angular/checklists/new-feature.md +125 -0
- package/Dev/i18n/en/Angular/checklists/pre-commit.md +77 -0
- package/Dev/i18n/en/Angular/commands/check-architecture.md +261 -0
- package/Dev/i18n/en/Angular/commands/check-code-quality.md +238 -0
- package/Dev/i18n/en/Angular/commands/check-compliance.md +199 -0
- package/Dev/i18n/en/Angular/commands/check-security.md +263 -0
- package/Dev/i18n/en/Angular/commands/check-testing.md +292 -0
- package/Dev/i18n/en/Angular/commands/generate-component.md +220 -0
- package/Dev/i18n/en/Angular/rules/00-project-context.md.template +78 -0
- package/Dev/i18n/en/Angular/rules/02-architecture-angular.md +477 -0
- package/Dev/i18n/en/Angular/rules/03-coding-standards.md +640 -0
- package/Dev/i18n/en/Angular/rules/06-tooling.md +516 -0
- package/Dev/i18n/en/Angular/rules/07-testing-angular.md +739 -0
- package/Dev/i18n/en/Angular/rules/08-quality-tools.md +501 -0
- package/Dev/i18n/en/Angular/rules/11-security-angular.md +497 -0
- package/Dev/i18n/en/Angular/templates/component.template.ts +115 -0
- package/Dev/i18n/en/Angular/templates/service.template.ts +203 -0
- package/Dev/i18n/en/CSharp/CLAUDE.md.template +65 -0
- package/Dev/i18n/en/CSharp/agents/csharp-reviewer.md +166 -0
- package/Dev/i18n/en/CSharp/checklists/new-feature.md +178 -0
- package/Dev/i18n/en/CSharp/checklists/pre-commit.md +126 -0
- package/Dev/i18n/en/CSharp/commands/check-architecture.md +294 -0
- package/Dev/i18n/en/CSharp/commands/check-code-quality.md +355 -0
- package/Dev/i18n/en/CSharp/commands/check-compliance.md +178 -0
- package/Dev/i18n/en/CSharp/commands/check-security.md +369 -0
- package/Dev/i18n/en/CSharp/commands/check-testing.md +295 -0
- package/Dev/i18n/en/CSharp/commands/generate-feature.md +481 -0
- package/Dev/i18n/en/CSharp/rules/00-project-context.md.template +100 -0
- package/Dev/i18n/en/CSharp/rules/02-architecture-csharp.md +536 -0
- package/Dev/i18n/en/CSharp/rules/03-coding-standards.md +494 -0
- package/Dev/i18n/en/CSharp/rules/06-tooling.md +493 -0
- package/Dev/i18n/en/CSharp/rules/07-testing-csharp.md +566 -0
- package/Dev/i18n/en/CSharp/rules/08-quality-tools.md +497 -0
- package/Dev/i18n/en/CSharp/rules/11-security-csharp.md +568 -0
- package/Dev/i18n/en/CSharp/rules/12-aspire-cloud-native.md +514 -0
- package/Dev/i18n/en/CSharp/templates/command-handler.template.cs +100 -0
- package/Dev/i18n/en/CSharp/templates/entity.template.cs +159 -0
- package/Dev/i18n/en/Common/commands/add-technology.md +293 -0
- package/Dev/i18n/en/Laravel/CLAUDE.md.template +104 -0
- package/Dev/i18n/en/Laravel/agents/laravel-reviewer.md +200 -0
- package/Dev/i18n/en/Laravel/checklists/new-feature.md +277 -0
- package/Dev/i18n/en/Laravel/checklists/pre-commit.md +156 -0
- package/Dev/i18n/en/Laravel/commands/check-architecture.md +306 -0
- package/Dev/i18n/en/Laravel/commands/check-code-quality.md +302 -0
- package/Dev/i18n/en/Laravel/commands/check-compliance.md +141 -0
- package/Dev/i18n/en/Laravel/commands/check-security.md +372 -0
- package/Dev/i18n/en/Laravel/commands/check-testing.md +397 -0
- package/Dev/i18n/en/Laravel/commands/generate-controller.md +388 -0
- package/Dev/i18n/en/Laravel/rules/00-project-context.md.template +140 -0
- package/Dev/i18n/en/Laravel/rules/02-architecture-laravel.md +644 -0
- package/Dev/i18n/en/Laravel/rules/03-coding-standards.md +573 -0
- package/Dev/i18n/en/Laravel/rules/06-tooling.md +580 -0
- package/Dev/i18n/en/Laravel/rules/07-testing-laravel.md +525 -0
- package/Dev/i18n/en/Laravel/rules/08-quality-tools.md +591 -0
- package/Dev/i18n/en/Laravel/rules/11-security-laravel.md +787 -0
- package/Dev/i18n/en/Laravel/templates/action.template.php +79 -0
- package/Dev/i18n/en/Laravel/templates/controller.template.php +99 -0
- package/Dev/i18n/en/Laravel/templates/model.template.php +206 -0
- package/Dev/i18n/en/Laravel/templates/test.template.php +263 -0
- package/Dev/i18n/en/PHP/CLAUDE.md.template +460 -0
- package/Dev/i18n/en/PHP/agents/php-reviewer.md +345 -0
- package/Dev/i18n/en/PHP/checklists/new-feature.md +132 -0
- package/Dev/i18n/en/PHP/checklists/pre-commit.md +231 -0
- package/Dev/i18n/en/PHP/commands/check-architecture.md +557 -0
- package/Dev/i18n/en/PHP/commands/check-code-quality.md +448 -0
- package/Dev/i18n/en/PHP/commands/check-compliance.md +477 -0
- package/Dev/i18n/en/PHP/commands/check-security.md +420 -0
- package/Dev/i18n/en/PHP/commands/check-testing.md +486 -0
- package/Dev/i18n/en/PHP/rules/00-project-context.md.template +266 -0
- package/Dev/i18n/en/PHP/rules/02-architecture-php.md +696 -0
- package/Dev/i18n/en/PHP/rules/03-coding-standards.md +641 -0
- package/Dev/i18n/en/PHP/rules/06-tooling.md +543 -0
- package/Dev/i18n/en/PHP/rules/07-testing-php.md +636 -0
- package/Dev/i18n/en/PHP/rules/08-quality-tools.md +533 -0
- package/Dev/i18n/en/PHP/rules/11-security-php.md +759 -0
- package/Dev/i18n/en/PHP/templates/entity.md +435 -0
- package/Dev/i18n/en/PHP/templates/use-case.md +512 -0
- package/Dev/i18n/en/PHP/templates/value-object.md +555 -0
- package/Dev/i18n/en/VueJS/CLAUDE.md.template +102 -0
- package/Dev/i18n/en/VueJS/agents/vuejs-reviewer.md +206 -0
- package/Dev/i18n/en/VueJS/checklists/new-feature.md +131 -0
- package/Dev/i18n/en/VueJS/checklists/pre-commit.md +68 -0
- package/Dev/i18n/en/VueJS/commands/check-architecture.md +137 -0
- package/Dev/i18n/en/VueJS/commands/check-code-quality.md +152 -0
- package/Dev/i18n/en/VueJS/commands/check-compliance.md +124 -0
- package/Dev/i18n/en/VueJS/commands/check-security.md +186 -0
- package/Dev/i18n/en/VueJS/commands/check-testing.md +185 -0
- package/Dev/i18n/en/VueJS/commands/generate-component.md +233 -0
- package/Dev/i18n/en/VueJS/rules/00-project-context.md.template +125 -0
- package/Dev/i18n/en/VueJS/rules/02-architecture-vuejs.md +375 -0
- package/Dev/i18n/en/VueJS/rules/03-coding-standards.md +502 -0
- package/Dev/i18n/en/VueJS/rules/06-tooling.md +422 -0
- package/Dev/i18n/en/VueJS/rules/07-testing-vuejs.md +606 -0
- package/Dev/i18n/en/VueJS/rules/08-quality-tools.md +441 -0
- package/Dev/i18n/en/VueJS/rules/11-security-vuejs.md +465 -0
- package/Dev/i18n/en/VueJS/templates/component.template.vue +133 -0
- package/Dev/i18n/en/VueJS/templates/composable.template.ts +162 -0
- package/Dev/i18n/en/VueJS/templates/store.template.ts +282 -0
- package/Dev/i18n/en/VueJS/templates/test.template.ts +233 -0
- package/Dev/i18n/es/Angular/CLAUDE.md.template +49 -0
- package/Dev/i18n/es/Angular/agents/angular-reviewer.md +213 -0
- package/Dev/i18n/es/Angular/checklists/new-feature.md +125 -0
- package/Dev/i18n/es/Angular/checklists/pre-commit.md +77 -0
- package/Dev/i18n/es/Angular/commands/check-architecture.md +261 -0
- package/Dev/i18n/es/Angular/commands/check-code-quality.md +238 -0
- package/Dev/i18n/es/Angular/commands/check-compliance.md +199 -0
- package/Dev/i18n/es/Angular/commands/check-security.md +263 -0
- package/Dev/i18n/es/Angular/commands/check-testing.md +292 -0
- package/Dev/i18n/es/Angular/commands/generate-component.md +220 -0
- package/Dev/i18n/es/Angular/rules/00-project-context.md.template +78 -0
- package/Dev/i18n/es/Angular/rules/02-architecture-angular.md +477 -0
- package/Dev/i18n/es/Angular/rules/03-coding-standards.md +640 -0
- package/Dev/i18n/es/Angular/rules/06-tooling.md +516 -0
- package/Dev/i18n/es/Angular/rules/07-testing-angular.md +739 -0
- package/Dev/i18n/es/Angular/rules/08-quality-tools.md +501 -0
- package/Dev/i18n/es/Angular/rules/11-security-angular.md +497 -0
- package/Dev/i18n/es/Angular/templates/component.template.ts +115 -0
- package/Dev/i18n/es/Angular/templates/service.template.ts +203 -0
- package/Dev/i18n/es/CSharp/CLAUDE.md.template +65 -0
- package/Dev/i18n/es/CSharp/agents/csharp-reviewer.md +166 -0
- package/Dev/i18n/es/CSharp/checklists/new-feature.md +178 -0
- package/Dev/i18n/es/CSharp/checklists/pre-commit.md +126 -0
- package/Dev/i18n/es/CSharp/commands/check-architecture.md +294 -0
- package/Dev/i18n/es/CSharp/commands/check-code-quality.md +355 -0
- package/Dev/i18n/es/CSharp/commands/check-compliance.md +178 -0
- package/Dev/i18n/es/CSharp/commands/check-security.md +369 -0
- package/Dev/i18n/es/CSharp/commands/check-testing.md +295 -0
- package/Dev/i18n/es/CSharp/commands/generate-feature.md +481 -0
- package/Dev/i18n/es/CSharp/rules/00-project-context.md.template +100 -0
- package/Dev/i18n/es/CSharp/rules/02-architecture-csharp.md +536 -0
- package/Dev/i18n/es/CSharp/rules/03-coding-standards.md +494 -0
- package/Dev/i18n/es/CSharp/rules/06-tooling.md +493 -0
- package/Dev/i18n/es/CSharp/rules/07-testing-csharp.md +566 -0
- package/Dev/i18n/es/CSharp/rules/08-quality-tools.md +497 -0
- package/Dev/i18n/es/CSharp/rules/11-security-csharp.md +568 -0
- package/Dev/i18n/es/CSharp/rules/12-aspire-cloud-native.md +514 -0
- package/Dev/i18n/es/CSharp/templates/command-handler.template.cs +100 -0
- package/Dev/i18n/es/CSharp/templates/entity.template.cs +159 -0
- package/Dev/i18n/es/Common/commands/add-technology.md +195 -0
- package/Dev/i18n/es/Laravel/CLAUDE.md.template +104 -0
- package/Dev/i18n/es/Laravel/agents/laravel-reviewer.md +200 -0
- package/Dev/i18n/es/Laravel/checklists/new-feature.md +277 -0
- package/Dev/i18n/es/Laravel/checklists/pre-commit.md +156 -0
- package/Dev/i18n/es/Laravel/commands/check-architecture.md +306 -0
- package/Dev/i18n/es/Laravel/commands/check-code-quality.md +302 -0
- package/Dev/i18n/es/Laravel/commands/check-compliance.md +141 -0
- package/Dev/i18n/es/Laravel/commands/check-security.md +372 -0
- package/Dev/i18n/es/Laravel/commands/check-testing.md +397 -0
- package/Dev/i18n/es/Laravel/commands/generate-controller.md +388 -0
- package/Dev/i18n/es/Laravel/rules/00-project-context.md.template +140 -0
- package/Dev/i18n/es/Laravel/rules/02-architecture-laravel.md +644 -0
- package/Dev/i18n/es/Laravel/rules/03-coding-standards.md +573 -0
- package/Dev/i18n/es/Laravel/rules/06-tooling.md +580 -0
- package/Dev/i18n/es/Laravel/rules/07-testing-laravel.md +525 -0
- package/Dev/i18n/es/Laravel/rules/08-quality-tools.md +591 -0
- package/Dev/i18n/es/Laravel/rules/11-security-laravel.md +787 -0
- package/Dev/i18n/es/Laravel/templates/action.template.php +79 -0
- package/Dev/i18n/es/Laravel/templates/controller.template.php +99 -0
- package/Dev/i18n/es/Laravel/templates/model.template.php +206 -0
- package/Dev/i18n/es/Laravel/templates/test.template.php +263 -0
- package/Dev/i18n/es/PHP/CLAUDE.md.template +460 -0
- package/Dev/i18n/es/PHP/agents/php-reviewer.md +345 -0
- package/Dev/i18n/es/PHP/checklists/new-feature.md +132 -0
- package/Dev/i18n/es/PHP/checklists/pre-commit.md +231 -0
- package/Dev/i18n/es/PHP/commands/check-architecture.md +557 -0
- package/Dev/i18n/es/PHP/commands/check-code-quality.md +448 -0
- package/Dev/i18n/es/PHP/commands/check-compliance.md +477 -0
- package/Dev/i18n/es/PHP/commands/check-security.md +420 -0
- package/Dev/i18n/es/PHP/commands/check-testing.md +486 -0
- package/Dev/i18n/es/PHP/rules/00-project-context.md.template +266 -0
- package/Dev/i18n/es/PHP/rules/02-architecture-php.md +696 -0
- package/Dev/i18n/es/PHP/rules/03-coding-standards.md +641 -0
- package/Dev/i18n/es/PHP/rules/06-tooling.md +543 -0
- package/Dev/i18n/es/PHP/rules/07-testing-php.md +636 -0
- package/Dev/i18n/es/PHP/rules/08-quality-tools.md +533 -0
- package/Dev/i18n/es/PHP/rules/11-security-php.md +759 -0
- package/Dev/i18n/es/PHP/templates/entity.md +435 -0
- package/Dev/i18n/es/PHP/templates/use-case.md +512 -0
- package/Dev/i18n/es/PHP/templates/value-object.md +555 -0
- package/Dev/i18n/es/VueJS/CLAUDE.md.template +102 -0
- package/Dev/i18n/es/VueJS/agents/vuejs-reviewer.md +206 -0
- package/Dev/i18n/es/VueJS/checklists/new-feature.md +131 -0
- package/Dev/i18n/es/VueJS/checklists/pre-commit.md +68 -0
- package/Dev/i18n/es/VueJS/commands/check-architecture.md +137 -0
- package/Dev/i18n/es/VueJS/commands/check-code-quality.md +152 -0
- package/Dev/i18n/es/VueJS/commands/check-compliance.md +124 -0
- package/Dev/i18n/es/VueJS/commands/check-security.md +186 -0
- package/Dev/i18n/es/VueJS/commands/check-testing.md +185 -0
- package/Dev/i18n/es/VueJS/commands/generate-component.md +233 -0
- package/Dev/i18n/es/VueJS/rules/00-project-context.md.template +125 -0
- package/Dev/i18n/es/VueJS/rules/02-architecture-vuejs.md +375 -0
- package/Dev/i18n/es/VueJS/rules/03-coding-standards.md +502 -0
- package/Dev/i18n/es/VueJS/rules/06-tooling.md +422 -0
- package/Dev/i18n/es/VueJS/rules/07-testing-vuejs.md +606 -0
- package/Dev/i18n/es/VueJS/rules/08-quality-tools.md +441 -0
- package/Dev/i18n/es/VueJS/rules/11-security-vuejs.md +465 -0
- package/Dev/i18n/es/VueJS/templates/component.template.vue +133 -0
- package/Dev/i18n/es/VueJS/templates/composable.template.ts +162 -0
- package/Dev/i18n/es/VueJS/templates/store.template.ts +282 -0
- package/Dev/i18n/es/VueJS/templates/test.template.ts +233 -0
- package/Dev/i18n/fr/Angular/CLAUDE.md.template +49 -0
- package/Dev/i18n/fr/Angular/agents/angular-reviewer.md +213 -0
- package/Dev/i18n/fr/Angular/checklists/new-feature.md +125 -0
- package/Dev/i18n/fr/Angular/checklists/pre-commit.md +77 -0
- package/Dev/i18n/fr/Angular/commands/check-architecture.md +261 -0
- package/Dev/i18n/fr/Angular/commands/check-code-quality.md +238 -0
- package/Dev/i18n/fr/Angular/commands/check-compliance.md +199 -0
- package/Dev/i18n/fr/Angular/commands/check-security.md +263 -0
- package/Dev/i18n/fr/Angular/commands/check-testing.md +292 -0
- package/Dev/i18n/fr/Angular/commands/generate-component.md +220 -0
- package/Dev/i18n/fr/Angular/rules/00-project-context.md.template +78 -0
- package/Dev/i18n/fr/Angular/rules/02-architecture-angular.md +477 -0
- package/Dev/i18n/fr/Angular/rules/03-coding-standards.md +640 -0
- package/Dev/i18n/fr/Angular/rules/06-tooling.md +516 -0
- package/Dev/i18n/fr/Angular/rules/07-testing-angular.md +739 -0
- package/Dev/i18n/fr/Angular/rules/08-quality-tools.md +501 -0
- package/Dev/i18n/fr/Angular/rules/11-security-angular.md +497 -0
- package/Dev/i18n/fr/Angular/templates/component.template.ts +115 -0
- package/Dev/i18n/fr/Angular/templates/service.template.ts +203 -0
- package/Dev/i18n/fr/CSharp/CLAUDE.md.template +65 -0
- package/Dev/i18n/fr/CSharp/agents/csharp-reviewer.md +166 -0
- package/Dev/i18n/fr/CSharp/checklists/new-feature.md +178 -0
- package/Dev/i18n/fr/CSharp/checklists/pre-commit.md +126 -0
- package/Dev/i18n/fr/CSharp/commands/check-architecture.md +294 -0
- package/Dev/i18n/fr/CSharp/commands/check-code-quality.md +355 -0
- package/Dev/i18n/fr/CSharp/commands/check-compliance.md +178 -0
- package/Dev/i18n/fr/CSharp/commands/check-security.md +369 -0
- package/Dev/i18n/fr/CSharp/commands/check-testing.md +295 -0
- package/Dev/i18n/fr/CSharp/commands/generate-feature.md +481 -0
- package/Dev/i18n/fr/CSharp/rules/00-project-context.md.template +100 -0
- package/Dev/i18n/fr/CSharp/rules/02-architecture-csharp.md +536 -0
- package/Dev/i18n/fr/CSharp/rules/03-coding-standards.md +494 -0
- package/Dev/i18n/fr/CSharp/rules/06-tooling.md +493 -0
- package/Dev/i18n/fr/CSharp/rules/07-testing-csharp.md +566 -0
- package/Dev/i18n/fr/CSharp/rules/08-quality-tools.md +497 -0
- package/Dev/i18n/fr/CSharp/rules/11-security-csharp.md +568 -0
- package/Dev/i18n/fr/CSharp/rules/12-aspire-cloud-native.md +514 -0
- package/Dev/i18n/fr/CSharp/templates/command-handler.template.cs +100 -0
- package/Dev/i18n/fr/CSharp/templates/entity.template.cs +159 -0
- package/Dev/i18n/fr/Common/commands/add-technology.md +293 -0
- package/Dev/i18n/fr/Laravel/CLAUDE.md.template +104 -0
- package/Dev/i18n/fr/Laravel/agents/laravel-reviewer.md +200 -0
- package/Dev/i18n/fr/Laravel/checklists/new-feature.md +277 -0
- package/Dev/i18n/fr/Laravel/checklists/pre-commit.md +156 -0
- package/Dev/i18n/fr/Laravel/commands/check-architecture.md +306 -0
- package/Dev/i18n/fr/Laravel/commands/check-code-quality.md +302 -0
- package/Dev/i18n/fr/Laravel/commands/check-compliance.md +141 -0
- package/Dev/i18n/fr/Laravel/commands/check-security.md +372 -0
- package/Dev/i18n/fr/Laravel/commands/check-testing.md +397 -0
- package/Dev/i18n/fr/Laravel/commands/generate-controller.md +388 -0
- package/Dev/i18n/fr/Laravel/rules/00-project-context.md.template +140 -0
- package/Dev/i18n/fr/Laravel/rules/02-architecture-laravel.md +644 -0
- package/Dev/i18n/fr/Laravel/rules/03-coding-standards.md +573 -0
- package/Dev/i18n/fr/Laravel/rules/06-tooling.md +580 -0
- package/Dev/i18n/fr/Laravel/rules/07-testing-laravel.md +525 -0
- package/Dev/i18n/fr/Laravel/rules/08-quality-tools.md +591 -0
- package/Dev/i18n/fr/Laravel/rules/11-security-laravel.md +787 -0
- package/Dev/i18n/fr/Laravel/templates/action.template.php +79 -0
- package/Dev/i18n/fr/Laravel/templates/controller.template.php +99 -0
- package/Dev/i18n/fr/Laravel/templates/model.template.php +206 -0
- package/Dev/i18n/fr/Laravel/templates/test.template.php +263 -0
- package/Dev/i18n/fr/PHP/CLAUDE.md.template +460 -0
- package/Dev/i18n/fr/PHP/agents/php-reviewer.md +345 -0
- package/Dev/i18n/fr/PHP/checklists/new-feature.md +132 -0
- package/Dev/i18n/fr/PHP/checklists/pre-commit.md +231 -0
- package/Dev/i18n/fr/PHP/commands/check-architecture.md +557 -0
- package/Dev/i18n/fr/PHP/commands/check-code-quality.md +448 -0
- package/Dev/i18n/fr/PHP/commands/check-compliance.md +477 -0
- package/Dev/i18n/fr/PHP/commands/check-security.md +420 -0
- package/Dev/i18n/fr/PHP/commands/check-testing.md +486 -0
- package/Dev/i18n/fr/PHP/rules/00-project-context.md.template +266 -0
- package/Dev/i18n/fr/PHP/rules/02-architecture-php.md +506 -0
- package/Dev/i18n/fr/PHP/rules/03-coding-standards.md +585 -0
- package/Dev/i18n/fr/PHP/rules/06-tooling.md +543 -0
- package/Dev/i18n/fr/PHP/rules/07-testing-php.md +636 -0
- package/Dev/i18n/fr/PHP/rules/08-quality-tools.md +533 -0
- package/Dev/i18n/fr/PHP/rules/11-security-php.md +642 -0
- package/Dev/i18n/fr/PHP/templates/entity.md +435 -0
- package/Dev/i18n/fr/PHP/templates/use-case.md +512 -0
- package/Dev/i18n/fr/PHP/templates/value-object.md +555 -0
- package/Dev/i18n/fr/VueJS/CLAUDE.md.template +102 -0
- package/Dev/i18n/fr/VueJS/agents/vuejs-reviewer.md +206 -0
- package/Dev/i18n/fr/VueJS/checklists/new-feature.md +131 -0
- package/Dev/i18n/fr/VueJS/checklists/pre-commit.md +68 -0
- package/Dev/i18n/fr/VueJS/commands/check-architecture.md +137 -0
- package/Dev/i18n/fr/VueJS/commands/check-code-quality.md +152 -0
- package/Dev/i18n/fr/VueJS/commands/check-compliance.md +124 -0
- package/Dev/i18n/fr/VueJS/commands/check-security.md +186 -0
- package/Dev/i18n/fr/VueJS/commands/check-testing.md +185 -0
- package/Dev/i18n/fr/VueJS/commands/generate-component.md +233 -0
- package/Dev/i18n/fr/VueJS/rules/00-project-context.md.template +125 -0
- package/Dev/i18n/fr/VueJS/rules/02-architecture-vuejs.md +375 -0
- package/Dev/i18n/fr/VueJS/rules/03-coding-standards.md +502 -0
- package/Dev/i18n/fr/VueJS/rules/06-tooling.md +422 -0
- package/Dev/i18n/fr/VueJS/rules/07-testing-vuejs.md +606 -0
- package/Dev/i18n/fr/VueJS/rules/08-quality-tools.md +441 -0
- package/Dev/i18n/fr/VueJS/rules/11-security-vuejs.md +465 -0
- package/Dev/i18n/fr/VueJS/templates/component.template.vue +133 -0
- package/Dev/i18n/fr/VueJS/templates/composable.template.ts +162 -0
- package/Dev/i18n/fr/VueJS/templates/store.template.ts +282 -0
- package/Dev/i18n/fr/VueJS/templates/test.template.ts +233 -0
- package/Dev/i18n/pt/Angular/CLAUDE.md.template +49 -0
- package/Dev/i18n/pt/Angular/agents/angular-reviewer.md +213 -0
- package/Dev/i18n/pt/Angular/checklists/new-feature.md +125 -0
- package/Dev/i18n/pt/Angular/checklists/pre-commit.md +77 -0
- package/Dev/i18n/pt/Angular/commands/check-architecture.md +261 -0
- package/Dev/i18n/pt/Angular/commands/check-code-quality.md +238 -0
- package/Dev/i18n/pt/Angular/commands/check-compliance.md +199 -0
- package/Dev/i18n/pt/Angular/commands/check-security.md +263 -0
- package/Dev/i18n/pt/Angular/commands/check-testing.md +292 -0
- package/Dev/i18n/pt/Angular/commands/generate-component.md +220 -0
- package/Dev/i18n/pt/Angular/rules/00-project-context.md.template +78 -0
- package/Dev/i18n/pt/Angular/rules/02-architecture-angular.md +477 -0
- package/Dev/i18n/pt/Angular/rules/03-coding-standards.md +640 -0
- package/Dev/i18n/pt/Angular/rules/06-tooling.md +516 -0
- package/Dev/i18n/pt/Angular/rules/07-testing-angular.md +739 -0
- package/Dev/i18n/pt/Angular/rules/08-quality-tools.md +501 -0
- package/Dev/i18n/pt/Angular/rules/11-security-angular.md +497 -0
- package/Dev/i18n/pt/Angular/templates/component.template.ts +115 -0
- package/Dev/i18n/pt/Angular/templates/service.template.ts +203 -0
- package/Dev/i18n/pt/CSharp/CLAUDE.md.template +65 -0
- package/Dev/i18n/pt/CSharp/agents/csharp-reviewer.md +166 -0
- package/Dev/i18n/pt/CSharp/checklists/new-feature.md +178 -0
- package/Dev/i18n/pt/CSharp/checklists/pre-commit.md +126 -0
- package/Dev/i18n/pt/CSharp/commands/check-architecture.md +294 -0
- package/Dev/i18n/pt/CSharp/commands/check-code-quality.md +355 -0
- package/Dev/i18n/pt/CSharp/commands/check-compliance.md +178 -0
- package/Dev/i18n/pt/CSharp/commands/check-security.md +369 -0
- package/Dev/i18n/pt/CSharp/commands/check-testing.md +295 -0
- package/Dev/i18n/pt/CSharp/commands/generate-feature.md +481 -0
- package/Dev/i18n/pt/CSharp/rules/00-project-context.md.template +100 -0
- package/Dev/i18n/pt/CSharp/rules/02-architecture-csharp.md +536 -0
- package/Dev/i18n/pt/CSharp/rules/03-coding-standards.md +494 -0
- package/Dev/i18n/pt/CSharp/rules/06-tooling.md +493 -0
- package/Dev/i18n/pt/CSharp/rules/07-testing-csharp.md +566 -0
- package/Dev/i18n/pt/CSharp/rules/08-quality-tools.md +497 -0
- package/Dev/i18n/pt/CSharp/rules/11-security-csharp.md +568 -0
- package/Dev/i18n/pt/CSharp/rules/12-aspire-cloud-native.md +514 -0
- package/Dev/i18n/pt/CSharp/templates/command-handler.template.cs +100 -0
- package/Dev/i18n/pt/CSharp/templates/entity.template.cs +159 -0
- package/Dev/i18n/pt/Common/commands/add-technology.md +195 -0
- package/Dev/i18n/pt/Laravel/CLAUDE.md.template +104 -0
- package/Dev/i18n/pt/Laravel/agents/laravel-reviewer.md +200 -0
- package/Dev/i18n/pt/Laravel/checklists/new-feature.md +277 -0
- package/Dev/i18n/pt/Laravel/checklists/pre-commit.md +156 -0
- package/Dev/i18n/pt/Laravel/commands/check-architecture.md +306 -0
- package/Dev/i18n/pt/Laravel/commands/check-code-quality.md +302 -0
- package/Dev/i18n/pt/Laravel/commands/check-compliance.md +141 -0
- package/Dev/i18n/pt/Laravel/commands/check-security.md +372 -0
- package/Dev/i18n/pt/Laravel/commands/check-testing.md +397 -0
- package/Dev/i18n/pt/Laravel/commands/generate-controller.md +388 -0
- package/Dev/i18n/pt/Laravel/rules/00-project-context.md.template +140 -0
- package/Dev/i18n/pt/Laravel/rules/02-architecture-laravel.md +644 -0
- package/Dev/i18n/pt/Laravel/rules/03-coding-standards.md +573 -0
- package/Dev/i18n/pt/Laravel/rules/06-tooling.md +580 -0
- package/Dev/i18n/pt/Laravel/rules/07-testing-laravel.md +525 -0
- package/Dev/i18n/pt/Laravel/rules/08-quality-tools.md +591 -0
- package/Dev/i18n/pt/Laravel/rules/11-security-laravel.md +787 -0
- package/Dev/i18n/pt/Laravel/templates/action.template.php +79 -0
- package/Dev/i18n/pt/Laravel/templates/controller.template.php +99 -0
- package/Dev/i18n/pt/Laravel/templates/model.template.php +206 -0
- package/Dev/i18n/pt/Laravel/templates/test.template.php +263 -0
- package/Dev/i18n/pt/PHP/CLAUDE.md.template +460 -0
- package/Dev/i18n/pt/PHP/agents/php-reviewer.md +345 -0
- package/Dev/i18n/pt/PHP/checklists/new-feature.md +132 -0
- package/Dev/i18n/pt/PHP/checklists/pre-commit.md +231 -0
- package/Dev/i18n/pt/PHP/commands/check-architecture.md +557 -0
- package/Dev/i18n/pt/PHP/commands/check-code-quality.md +448 -0
- package/Dev/i18n/pt/PHP/commands/check-compliance.md +477 -0
- package/Dev/i18n/pt/PHP/commands/check-security.md +420 -0
- package/Dev/i18n/pt/PHP/commands/check-testing.md +486 -0
- package/Dev/i18n/pt/PHP/rules/00-project-context.md.template +266 -0
- package/Dev/i18n/pt/PHP/rules/02-architecture-php.md +696 -0
- package/Dev/i18n/pt/PHP/rules/03-coding-standards.md +641 -0
- package/Dev/i18n/pt/PHP/rules/06-tooling.md +543 -0
- package/Dev/i18n/pt/PHP/rules/07-testing-php.md +636 -0
- package/Dev/i18n/pt/PHP/rules/08-quality-tools.md +533 -0
- package/Dev/i18n/pt/PHP/rules/11-security-php.md +759 -0
- package/Dev/i18n/pt/PHP/templates/entity.md +435 -0
- package/Dev/i18n/pt/PHP/templates/use-case.md +512 -0
- package/Dev/i18n/pt/PHP/templates/value-object.md +555 -0
- package/Dev/i18n/pt/VueJS/CLAUDE.md.template +102 -0
- package/Dev/i18n/pt/VueJS/agents/vuejs-reviewer.md +206 -0
- package/Dev/i18n/pt/VueJS/checklists/new-feature.md +131 -0
- package/Dev/i18n/pt/VueJS/checklists/pre-commit.md +68 -0
- package/Dev/i18n/pt/VueJS/commands/check-architecture.md +137 -0
- package/Dev/i18n/pt/VueJS/commands/check-code-quality.md +152 -0
- package/Dev/i18n/pt/VueJS/commands/check-compliance.md +124 -0
- package/Dev/i18n/pt/VueJS/commands/check-security.md +186 -0
- package/Dev/i18n/pt/VueJS/commands/check-testing.md +185 -0
- package/Dev/i18n/pt/VueJS/commands/generate-component.md +233 -0
- package/Dev/i18n/pt/VueJS/rules/00-project-context.md.template +125 -0
- package/Dev/i18n/pt/VueJS/rules/02-architecture-vuejs.md +375 -0
- package/Dev/i18n/pt/VueJS/rules/03-coding-standards.md +502 -0
- package/Dev/i18n/pt/VueJS/rules/06-tooling.md +422 -0
- package/Dev/i18n/pt/VueJS/rules/07-testing-vuejs.md +606 -0
- package/Dev/i18n/pt/VueJS/rules/08-quality-tools.md +441 -0
- package/Dev/i18n/pt/VueJS/rules/11-security-vuejs.md +465 -0
- package/Dev/i18n/pt/VueJS/templates/component.template.vue +133 -0
- package/Dev/i18n/pt/VueJS/templates/composable.template.ts +162 -0
- package/Dev/i18n/pt/VueJS/templates/store.template.ts +282 -0
- package/Dev/i18n/pt/VueJS/templates/test.template.ts +233 -0
- package/Dev/scripts/install-angular-rules.sh +543 -0
- package/Dev/scripts/install-common-rules.sh +13 -1
- package/Dev/scripts/install-csharp-rules.sh +544 -0
- package/Dev/scripts/install-flutter-rules.sh +17 -4
- package/Dev/scripts/install-from-config.sh +61 -23
- package/Dev/scripts/install-laravel-rules.sh +552 -0
- package/Dev/scripts/install-php-rules.sh +537 -0
- package/Dev/scripts/install-python-rules.sh +17 -4
- package/Dev/scripts/install-react-rules.sh +17 -4
- package/Dev/scripts/install-reactnative-rules.sh +17 -4
- package/Dev/scripts/install-symfony-rules.sh +22 -4
- package/Dev/scripts/install-vuejs-rules.sh +588 -0
- package/README.md +68 -2
- package/Tools/Ralph/README.md +106 -10
- package/Tools/Ralph/lib/checkpoint.sh +15 -9
- package/Tools/Ralph/lib/circuit-breaker.sh +16 -7
- package/Tools/Ralph/lib/context-manager.sh +473 -0
- package/Tools/Ralph/lib/context-reconstruction.sh +329 -0
- package/Tools/Ralph/lib/dod-validator.sh +17 -4
- package/Tools/Ralph/lib/loop.sh +33 -10
- package/Tools/Ralph/lib/session.sh +88 -33
- package/Tools/Ralph/lib/sprint-progress.sh +832 -0
- package/Tools/Ralph/lib/utils.sh +362 -0
- package/Tools/Ralph/ralph.sh +172 -14
- package/Tools/Ralph/templates/ralph.yml.template +87 -0
- package/Tools/Ralph/templates/sprint-progress.md.template +72 -0
- package/Tools/i18n/ralph/de.sh +31 -0
- package/Tools/i18n/ralph/en.sh +31 -0
- package/Tools/i18n/ralph/es.sh +31 -0
- package/Tools/i18n/ralph/fr.sh +31 -0
- package/Tools/i18n/ralph/pt.sh +31 -0
- package/package.json +1 -1
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
# Laravel Security Standards
|
|
2
|
+
|
|
3
|
+
## OWASP Top 10 Protection
|
|
4
|
+
|
|
5
|
+
### A01:2021 - Broken Access Control
|
|
6
|
+
|
|
7
|
+
```php
|
|
8
|
+
<?php
|
|
9
|
+
// Always use Laravel's authorization features
|
|
10
|
+
|
|
11
|
+
// Policy-based authorization
|
|
12
|
+
class OrderPolicy
|
|
13
|
+
{
|
|
14
|
+
public function view(User $user, Order $order): bool
|
|
15
|
+
{
|
|
16
|
+
return $user->id === $order->customer_id
|
|
17
|
+
|| $user->hasRole('admin');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public function update(User $user, Order $order): bool
|
|
21
|
+
{
|
|
22
|
+
return $user->id === $order->customer_id
|
|
23
|
+
&& $order->status === OrderStatus::Draft;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public function delete(User $user, Order $order): bool
|
|
27
|
+
{
|
|
28
|
+
return $user->hasRole('admin');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Controller usage
|
|
33
|
+
class OrderController extends Controller
|
|
34
|
+
{
|
|
35
|
+
public function __construct()
|
|
36
|
+
{
|
|
37
|
+
$this->authorizeResource(Order::class, 'order');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public function show(Order $order)
|
|
41
|
+
{
|
|
42
|
+
// Authorization handled automatically
|
|
43
|
+
return OrderResource::make($order);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Gate-based authorization
|
|
48
|
+
Gate::define('access-admin-panel', function (User $user) {
|
|
49
|
+
return $user->hasRole('admin');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Middleware-based protection
|
|
53
|
+
Route::middleware(['auth', 'can:access-admin-panel'])
|
|
54
|
+
->prefix('admin')
|
|
55
|
+
->group(function () {
|
|
56
|
+
Route::resource('users', AdminUserController::class);
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### A02:2021 - Cryptographic Failures
|
|
61
|
+
|
|
62
|
+
```php
|
|
63
|
+
<?php
|
|
64
|
+
// Use Laravel's encryption for sensitive data
|
|
65
|
+
use Illuminate\Support\Facades\Crypt;
|
|
66
|
+
|
|
67
|
+
// Encrypting data
|
|
68
|
+
$encrypted = Crypt::encryptString($sensitiveData);
|
|
69
|
+
|
|
70
|
+
// Decrypting data
|
|
71
|
+
$decrypted = Crypt::decryptString($encrypted);
|
|
72
|
+
|
|
73
|
+
// Model attribute encryption
|
|
74
|
+
class User extends Authenticatable
|
|
75
|
+
{
|
|
76
|
+
protected $casts = [
|
|
77
|
+
'ssn' => 'encrypted',
|
|
78
|
+
'api_key' => 'encrypted',
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Hashing passwords (automatic with Laravel)
|
|
83
|
+
use Illuminate\Support\Facades\Hash;
|
|
84
|
+
|
|
85
|
+
$hashedPassword = Hash::make($password);
|
|
86
|
+
|
|
87
|
+
if (Hash::check($plainPassword, $hashedPassword)) {
|
|
88
|
+
// Password matches
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Never store sensitive data in plain text
|
|
92
|
+
// BAD: $user->credit_card = $cardNumber;
|
|
93
|
+
// GOOD: Use a payment processor that handles card data
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### A03:2021 - Injection
|
|
97
|
+
|
|
98
|
+
```php
|
|
99
|
+
<?php
|
|
100
|
+
// SQL Injection Prevention - Use Eloquent/Query Builder
|
|
101
|
+
|
|
102
|
+
// GOOD: Parameterized queries
|
|
103
|
+
$users = User::where('email', $email)->get();
|
|
104
|
+
$orders = DB::table('orders')->where('status', $status)->get();
|
|
105
|
+
|
|
106
|
+
// GOOD: Raw expressions with bindings
|
|
107
|
+
$results = DB::select('SELECT * FROM users WHERE email = ?', [$email]);
|
|
108
|
+
|
|
109
|
+
// BAD: Raw queries with concatenation
|
|
110
|
+
// $users = DB::select("SELECT * FROM users WHERE email = '$email'");
|
|
111
|
+
|
|
112
|
+
// XSS Prevention - Always escape output in Blade
|
|
113
|
+
// GOOD: {{ $user->name }} - Escapes HTML entities
|
|
114
|
+
// BAD: {!! $user->name !!} - Only for trusted HTML content
|
|
115
|
+
|
|
116
|
+
// Command Injection Prevention
|
|
117
|
+
use Symfony\Component\Process\Process;
|
|
118
|
+
|
|
119
|
+
// GOOD: Use Process component
|
|
120
|
+
$process = new Process(['ls', '-la', $directory]);
|
|
121
|
+
$process->run();
|
|
122
|
+
|
|
123
|
+
// BAD: Using shell_exec or exec with user input
|
|
124
|
+
// shell_exec("ls -la $directory");
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### A04:2021 - Insecure Design
|
|
128
|
+
|
|
129
|
+
```php
|
|
130
|
+
<?php
|
|
131
|
+
// Rate limiting
|
|
132
|
+
Route::middleware(['throttle:api'])
|
|
133
|
+
->group(function () {
|
|
134
|
+
Route::post('/login', [AuthController::class, 'login']);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Custom rate limiter
|
|
138
|
+
use Illuminate\Cache\RateLimiting\Limit;
|
|
139
|
+
use Illuminate\Support\Facades\RateLimiter;
|
|
140
|
+
|
|
141
|
+
RateLimiter::for('login', function (Request $request) {
|
|
142
|
+
return Limit::perMinute(5)->by($request->ip());
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
RateLimiter::for('api', function (Request $request) {
|
|
146
|
+
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Input validation
|
|
150
|
+
class StoreOrderRequest extends FormRequest
|
|
151
|
+
{
|
|
152
|
+
public function rules(): array
|
|
153
|
+
{
|
|
154
|
+
return [
|
|
155
|
+
'customer_id' => ['required', 'integer', 'exists:customers,id'],
|
|
156
|
+
'items' => ['required', 'array', 'min:1', 'max:50'],
|
|
157
|
+
'items.*.product_id' => ['required', 'integer', 'exists:products,id'],
|
|
158
|
+
'items.*.quantity' => ['required', 'integer', 'min:1', 'max:100'],
|
|
159
|
+
'notes' => ['nullable', 'string', 'max:1000'],
|
|
160
|
+
];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Business logic validation
|
|
165
|
+
public function placeOrder(Order $order): void
|
|
166
|
+
{
|
|
167
|
+
if ($order->items->isEmpty()) {
|
|
168
|
+
throw new OrderCannotBePlacedException('Order must have at least one item');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if ($order->total_amount <= 0) {
|
|
172
|
+
throw new OrderCannotBePlacedException('Order total must be positive');
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Proceed with order placement
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### A05:2021 - Security Misconfiguration
|
|
180
|
+
|
|
181
|
+
```php
|
|
182
|
+
<?php
|
|
183
|
+
// .env configuration for production
|
|
184
|
+
// APP_ENV=production
|
|
185
|
+
// APP_DEBUG=false
|
|
186
|
+
// APP_KEY=base64:your-secure-key-here
|
|
187
|
+
|
|
188
|
+
// config/app.php
|
|
189
|
+
return [
|
|
190
|
+
'debug' => env('APP_DEBUG', false),
|
|
191
|
+
'env' => env('APP_ENV', 'production'),
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
// Disable unnecessary features in production
|
|
195
|
+
// config/debugbar.php
|
|
196
|
+
return [
|
|
197
|
+
'enabled' => env('DEBUGBAR_ENABLED', false),
|
|
198
|
+
];
|
|
199
|
+
|
|
200
|
+
// Secure headers middleware
|
|
201
|
+
class SecureHeaders
|
|
202
|
+
{
|
|
203
|
+
public function handle(Request $request, Closure $next): Response
|
|
204
|
+
{
|
|
205
|
+
$response = $next($request);
|
|
206
|
+
|
|
207
|
+
return $response
|
|
208
|
+
->header('X-Content-Type-Options', 'nosniff')
|
|
209
|
+
->header('X-Frame-Options', 'DENY')
|
|
210
|
+
->header('X-XSS-Protection', '1; mode=block')
|
|
211
|
+
->header('Strict-Transport-Security', 'max-age=31536000; includeSubDomains')
|
|
212
|
+
->header('Content-Security-Policy', "default-src 'self'")
|
|
213
|
+
->header('Referrer-Policy', 'strict-origin-when-cross-origin')
|
|
214
|
+
->header('Permissions-Policy', 'geolocation=(), microphone=(), camera=()');
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Register in bootstrap/app.php
|
|
219
|
+
->withMiddleware(function (Middleware $middleware) {
|
|
220
|
+
$middleware->append(SecureHeaders::class);
|
|
221
|
+
})
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### A06:2021 - Vulnerable Components
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Regular security audits
|
|
228
|
+
composer audit
|
|
229
|
+
|
|
230
|
+
# Update dependencies regularly
|
|
231
|
+
composer update --with-all-dependencies
|
|
232
|
+
|
|
233
|
+
# Check for security advisories
|
|
234
|
+
composer outdated --direct
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
```json
|
|
238
|
+
// composer.json - Pin versions and use version constraints
|
|
239
|
+
{
|
|
240
|
+
"require": {
|
|
241
|
+
"php": "^8.3",
|
|
242
|
+
"laravel/framework": "^12.0",
|
|
243
|
+
"laravel/sanctum": "^4.0"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### A07:2021 - Authentication Failures
|
|
249
|
+
|
|
250
|
+
```php
|
|
251
|
+
<?php
|
|
252
|
+
// Laravel Sanctum for API authentication
|
|
253
|
+
use Laravel\Sanctum\HasApiTokens;
|
|
254
|
+
|
|
255
|
+
class User extends Authenticatable
|
|
256
|
+
{
|
|
257
|
+
use HasApiTokens, HasFactory, Notifiable;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Token creation with abilities
|
|
261
|
+
$token = $user->createToken('api-token', ['orders:read', 'orders:write']);
|
|
262
|
+
|
|
263
|
+
// Token validation middleware
|
|
264
|
+
Route::middleware('auth:sanctum')->group(function () {
|
|
265
|
+
Route::get('/user', function (Request $request) {
|
|
266
|
+
return $request->user();
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// Ability checking
|
|
271
|
+
Route::middleware(['auth:sanctum', 'ability:orders:write'])
|
|
272
|
+
->post('/orders', [OrderController::class, 'store']);
|
|
273
|
+
|
|
274
|
+
// Password confirmation for sensitive actions
|
|
275
|
+
Route::middleware(['auth', 'password.confirm'])->group(function () {
|
|
276
|
+
Route::delete('/account', [AccountController::class, 'destroy']);
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
// Multi-factor authentication
|
|
280
|
+
use Laravel\Fortify\Features;
|
|
281
|
+
|
|
282
|
+
// config/fortify.php
|
|
283
|
+
'features' => [
|
|
284
|
+
Features::registration(),
|
|
285
|
+
Features::resetPasswords(),
|
|
286
|
+
Features::emailVerification(),
|
|
287
|
+
Features::updateProfileInformation(),
|
|
288
|
+
Features::updatePasswords(),
|
|
289
|
+
Features::twoFactorAuthentication([
|
|
290
|
+
'confirm' => true,
|
|
291
|
+
'confirmPassword' => true,
|
|
292
|
+
]),
|
|
293
|
+
],
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### A08:2021 - Software and Data Integrity
|
|
297
|
+
|
|
298
|
+
```php
|
|
299
|
+
<?php
|
|
300
|
+
// Signed URLs for secure file downloads
|
|
301
|
+
use Illuminate\Support\Facades\URL;
|
|
302
|
+
|
|
303
|
+
$signedUrl = URL::signedRoute('download', ['file' => $fileId]);
|
|
304
|
+
$temporarySignedUrl = URL::temporarySignedRoute(
|
|
305
|
+
'download',
|
|
306
|
+
now()->addMinutes(30),
|
|
307
|
+
['file' => $fileId]
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
// Validate signed URL in controller
|
|
311
|
+
public function download(Request $request, string $file)
|
|
312
|
+
{
|
|
313
|
+
if (!$request->hasValidSignature()) {
|
|
314
|
+
abort(401);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return Storage::download($file);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// CSRF protection (enabled by default)
|
|
321
|
+
// All POST, PUT, PATCH, DELETE requests require CSRF token
|
|
322
|
+
<form method="POST" action="/orders">
|
|
323
|
+
@csrf
|
|
324
|
+
<!-- form fields -->
|
|
325
|
+
</form>
|
|
326
|
+
|
|
327
|
+
// SRI for external scripts
|
|
328
|
+
<script src="https://cdn.example.com/app.js"
|
|
329
|
+
integrity="sha384-hash-here"
|
|
330
|
+
crossorigin="anonymous"></script>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### A09:2021 - Security Logging and Monitoring
|
|
334
|
+
|
|
335
|
+
```php
|
|
336
|
+
<?php
|
|
337
|
+
// config/logging.php
|
|
338
|
+
'channels' => [
|
|
339
|
+
'security' => [
|
|
340
|
+
'driver' => 'daily',
|
|
341
|
+
'path' => storage_path('logs/security.log'),
|
|
342
|
+
'level' => 'info',
|
|
343
|
+
'days' => 90,
|
|
344
|
+
],
|
|
345
|
+
],
|
|
346
|
+
|
|
347
|
+
// Security event logging
|
|
348
|
+
use Illuminate\Support\Facades\Log;
|
|
349
|
+
|
|
350
|
+
class AuthController extends Controller
|
|
351
|
+
{
|
|
352
|
+
public function login(LoginRequest $request)
|
|
353
|
+
{
|
|
354
|
+
if (Auth::attempt($request->only('email', 'password'))) {
|
|
355
|
+
Log::channel('security')->info('User logged in', [
|
|
356
|
+
'user_id' => Auth::id(),
|
|
357
|
+
'ip' => $request->ip(),
|
|
358
|
+
'user_agent' => $request->userAgent(),
|
|
359
|
+
]);
|
|
360
|
+
|
|
361
|
+
return response()->json(['message' => 'Logged in']);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
Log::channel('security')->warning('Failed login attempt', [
|
|
365
|
+
'email' => $request->email,
|
|
366
|
+
'ip' => $request->ip(),
|
|
367
|
+
'user_agent' => $request->userAgent(),
|
|
368
|
+
]);
|
|
369
|
+
|
|
370
|
+
return response()->json(['message' => 'Invalid credentials'], 401);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Activity logging with Spatie
|
|
375
|
+
use Spatie\Activitylog\Traits\LogsActivity;
|
|
376
|
+
use Spatie\Activitylog\LogOptions;
|
|
377
|
+
|
|
378
|
+
class Order extends Model
|
|
379
|
+
{
|
|
380
|
+
use LogsActivity;
|
|
381
|
+
|
|
382
|
+
public function getActivitylogOptions(): LogOptions
|
|
383
|
+
{
|
|
384
|
+
return LogOptions::defaults()
|
|
385
|
+
->logOnly(['status', 'total_amount'])
|
|
386
|
+
->logOnlyDirty()
|
|
387
|
+
->dontSubmitEmptyLogs();
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### A10:2021 - Server-Side Request Forgery (SSRF)
|
|
393
|
+
|
|
394
|
+
```php
|
|
395
|
+
<?php
|
|
396
|
+
// Validate and restrict URLs
|
|
397
|
+
class WebhookRequest extends FormRequest
|
|
398
|
+
{
|
|
399
|
+
public function rules(): array
|
|
400
|
+
{
|
|
401
|
+
return [
|
|
402
|
+
'url' => [
|
|
403
|
+
'required',
|
|
404
|
+
'url',
|
|
405
|
+
function ($attribute, $value, $fail) {
|
|
406
|
+
$parsed = parse_url($value);
|
|
407
|
+
|
|
408
|
+
// Block internal networks
|
|
409
|
+
$blockedHosts = ['localhost', '127.0.0.1', '0.0.0.0'];
|
|
410
|
+
if (in_array($parsed['host'] ?? '', $blockedHosts)) {
|
|
411
|
+
$fail('Internal URLs are not allowed.');
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Only allow HTTPS
|
|
415
|
+
if (($parsed['scheme'] ?? '') !== 'https') {
|
|
416
|
+
$fail('Only HTTPS URLs are allowed.');
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Check for private IP ranges
|
|
420
|
+
$ip = gethostbyname($parsed['host'] ?? '');
|
|
421
|
+
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false) {
|
|
422
|
+
$fail('URLs pointing to private networks are not allowed.');
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
],
|
|
426
|
+
];
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Use allowlist for external services
|
|
431
|
+
$allowedDomains = config('services.allowed_webhook_domains');
|
|
432
|
+
|
|
433
|
+
if (!in_array(parse_url($url, PHP_URL_HOST), $allowedDomains)) {
|
|
434
|
+
throw new InvalidArgumentException('Domain not allowed');
|
|
435
|
+
}
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
## Authentication Best Practices
|
|
439
|
+
|
|
440
|
+
### Laravel Sanctum (API Tokens)
|
|
441
|
+
|
|
442
|
+
```php
|
|
443
|
+
<?php
|
|
444
|
+
// Install Sanctum
|
|
445
|
+
// composer require laravel/sanctum
|
|
446
|
+
// php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
|
|
447
|
+
// php artisan migrate
|
|
448
|
+
|
|
449
|
+
// config/sanctum.php
|
|
450
|
+
return [
|
|
451
|
+
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', 'localhost')),
|
|
452
|
+
'expiration' => 60 * 24 * 7, // 7 days
|
|
453
|
+
'token_prefix' => 'laravel_',
|
|
454
|
+
];
|
|
455
|
+
|
|
456
|
+
// Token creation
|
|
457
|
+
public function login(LoginRequest $request): JsonResponse
|
|
458
|
+
{
|
|
459
|
+
$user = User::where('email', $request->email)->first();
|
|
460
|
+
|
|
461
|
+
if (!$user || !Hash::check($request->password, $user->password)) {
|
|
462
|
+
return response()->json(['message' => 'Invalid credentials'], 401);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Revoke existing tokens
|
|
466
|
+
$user->tokens()->delete();
|
|
467
|
+
|
|
468
|
+
// Create new token with abilities
|
|
469
|
+
$token = $user->createToken('api-token', [
|
|
470
|
+
'orders:read',
|
|
471
|
+
'orders:write',
|
|
472
|
+
'profile:read',
|
|
473
|
+
'profile:update',
|
|
474
|
+
]);
|
|
475
|
+
|
|
476
|
+
return response()->json([
|
|
477
|
+
'token' => $token->plainTextToken,
|
|
478
|
+
'expires_at' => now()->addDays(7)->toIso8601String(),
|
|
479
|
+
]);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// Token revocation
|
|
483
|
+
public function logout(Request $request): JsonResponse
|
|
484
|
+
{
|
|
485
|
+
$request->user()->currentAccessToken()->delete();
|
|
486
|
+
|
|
487
|
+
return response()->json(['message' => 'Logged out']);
|
|
488
|
+
}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### Laravel Passport (OAuth2)
|
|
492
|
+
|
|
493
|
+
```php
|
|
494
|
+
<?php
|
|
495
|
+
// For OAuth2 server implementation
|
|
496
|
+
// composer require laravel/passport
|
|
497
|
+
// php artisan passport:install
|
|
498
|
+
|
|
499
|
+
// config/auth.php
|
|
500
|
+
'guards' => [
|
|
501
|
+
'api' => [
|
|
502
|
+
'driver' => 'passport',
|
|
503
|
+
'provider' => 'users',
|
|
504
|
+
],
|
|
505
|
+
],
|
|
506
|
+
|
|
507
|
+
// Scopes definition
|
|
508
|
+
Passport::tokensCan([
|
|
509
|
+
'read-orders' => 'Read order information',
|
|
510
|
+
'write-orders' => 'Create and update orders',
|
|
511
|
+
'delete-orders' => 'Delete orders',
|
|
512
|
+
]);
|
|
513
|
+
|
|
514
|
+
// Client credentials grant
|
|
515
|
+
Route::middleware(['client', 'scopes:read-orders'])->group(function () {
|
|
516
|
+
Route::get('/orders', [OrderController::class, 'index']);
|
|
517
|
+
});
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
## Data Validation
|
|
521
|
+
|
|
522
|
+
### Request Validation
|
|
523
|
+
|
|
524
|
+
```php
|
|
525
|
+
<?php
|
|
526
|
+
class StoreOrderRequest extends FormRequest
|
|
527
|
+
{
|
|
528
|
+
public function authorize(): bool
|
|
529
|
+
{
|
|
530
|
+
return $this->user()->can('create', Order::class);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
public function rules(): array
|
|
534
|
+
{
|
|
535
|
+
return [
|
|
536
|
+
'customer_id' => [
|
|
537
|
+
'required',
|
|
538
|
+
'integer',
|
|
539
|
+
Rule::exists('customers', 'id')->where('active', true),
|
|
540
|
+
],
|
|
541
|
+
'items' => ['required', 'array', 'min:1', 'max:100'],
|
|
542
|
+
'items.*.product_id' => [
|
|
543
|
+
'required',
|
|
544
|
+
'integer',
|
|
545
|
+
Rule::exists('products', 'id')->where('available', true),
|
|
546
|
+
],
|
|
547
|
+
'items.*.quantity' => ['required', 'integer', 'min:1', 'max:999'],
|
|
548
|
+
'shipping_address' => ['required', 'array'],
|
|
549
|
+
'shipping_address.street' => ['required', 'string', 'max:255'],
|
|
550
|
+
'shipping_address.city' => ['required', 'string', 'max:100'],
|
|
551
|
+
'shipping_address.postal_code' => ['required', 'string', 'max:20'],
|
|
552
|
+
'shipping_address.country' => ['required', 'string', 'size:2'],
|
|
553
|
+
'notes' => ['nullable', 'string', 'max:1000'],
|
|
554
|
+
'coupon_code' => ['nullable', 'string', new ValidCouponCode()],
|
|
555
|
+
];
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
public function messages(): array
|
|
559
|
+
{
|
|
560
|
+
return [
|
|
561
|
+
'items.min' => 'At least one item is required.',
|
|
562
|
+
'items.max' => 'Maximum 100 items per order.',
|
|
563
|
+
'items.*.quantity.max' => 'Maximum quantity per item is 999.',
|
|
564
|
+
];
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
protected function prepareForValidation(): void
|
|
568
|
+
{
|
|
569
|
+
// Sanitize input
|
|
570
|
+
$this->merge([
|
|
571
|
+
'notes' => strip_tags($this->notes ?? ''),
|
|
572
|
+
]);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### Custom Validation Rules
|
|
578
|
+
|
|
579
|
+
```php
|
|
580
|
+
<?php
|
|
581
|
+
// app/Rules/ValidCouponCode.php
|
|
582
|
+
namespace App\Rules;
|
|
583
|
+
|
|
584
|
+
use App\Models\Coupon;
|
|
585
|
+
use Closure;
|
|
586
|
+
use Illuminate\Contracts\Validation\ValidationRule;
|
|
587
|
+
|
|
588
|
+
class ValidCouponCode implements ValidationRule
|
|
589
|
+
{
|
|
590
|
+
public function validate(string $attribute, mixed $value, Closure $fail): void
|
|
591
|
+
{
|
|
592
|
+
$coupon = Coupon::where('code', $value)->first();
|
|
593
|
+
|
|
594
|
+
if (!$coupon) {
|
|
595
|
+
$fail('The coupon code is invalid.');
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
if ($coupon->isExpired()) {
|
|
600
|
+
$fail('The coupon code has expired.');
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
if ($coupon->usageLimit && $coupon->usage_count >= $coupon->usageLimit) {
|
|
605
|
+
$fail('The coupon code has reached its usage limit.');
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
## File Upload Security
|
|
612
|
+
|
|
613
|
+
```php
|
|
614
|
+
<?php
|
|
615
|
+
class UploadDocumentRequest extends FormRequest
|
|
616
|
+
{
|
|
617
|
+
public function rules(): array
|
|
618
|
+
{
|
|
619
|
+
return [
|
|
620
|
+
'document' => [
|
|
621
|
+
'required',
|
|
622
|
+
'file',
|
|
623
|
+
'mimes:pdf,doc,docx',
|
|
624
|
+
'max:10240', // 10MB
|
|
625
|
+
function ($attribute, $value, $fail) {
|
|
626
|
+
// Verify MIME type matches extension
|
|
627
|
+
$mimeType = $value->getMimeType();
|
|
628
|
+
$extension = $value->getClientOriginalExtension();
|
|
629
|
+
|
|
630
|
+
$allowedMimes = [
|
|
631
|
+
'pdf' => 'application/pdf',
|
|
632
|
+
'doc' => 'application/msword',
|
|
633
|
+
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
634
|
+
];
|
|
635
|
+
|
|
636
|
+
if (($allowedMimes[$extension] ?? null) !== $mimeType) {
|
|
637
|
+
$fail('File type does not match extension.');
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
],
|
|
641
|
+
];
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// Secure file storage
|
|
646
|
+
class DocumentController extends Controller
|
|
647
|
+
{
|
|
648
|
+
public function store(UploadDocumentRequest $request): JsonResponse
|
|
649
|
+
{
|
|
650
|
+
$file = $request->file('document');
|
|
651
|
+
|
|
652
|
+
// Generate secure filename
|
|
653
|
+
$filename = Str::uuid() . '.' . $file->getClientOriginalExtension();
|
|
654
|
+
|
|
655
|
+
// Store outside public directory
|
|
656
|
+
$path = $file->storeAs(
|
|
657
|
+
'documents/' . auth()->id(),
|
|
658
|
+
$filename,
|
|
659
|
+
's3' // Or 'local' with private disk
|
|
660
|
+
);
|
|
661
|
+
|
|
662
|
+
$document = Document::create([
|
|
663
|
+
'user_id' => auth()->id(),
|
|
664
|
+
'original_name' => $file->getClientOriginalName(),
|
|
665
|
+
'path' => $path,
|
|
666
|
+
'size' => $file->getSize(),
|
|
667
|
+
'mime_type' => $file->getMimeType(),
|
|
668
|
+
]);
|
|
669
|
+
|
|
670
|
+
return response()->json([
|
|
671
|
+
'document' => DocumentResource::make($document),
|
|
672
|
+
], 201);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
public function download(Document $document): Response
|
|
676
|
+
{
|
|
677
|
+
$this->authorize('view', $document);
|
|
678
|
+
|
|
679
|
+
return Storage::disk('s3')->download(
|
|
680
|
+
$document->path,
|
|
681
|
+
$document->original_name
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
## Environment Security
|
|
688
|
+
|
|
689
|
+
```env
|
|
690
|
+
# .env.example - Never commit actual .env file
|
|
691
|
+
|
|
692
|
+
# Application
|
|
693
|
+
APP_NAME=MyApp
|
|
694
|
+
APP_ENV=production
|
|
695
|
+
APP_KEY=
|
|
696
|
+
APP_DEBUG=false
|
|
697
|
+
APP_URL=https://myapp.com
|
|
698
|
+
|
|
699
|
+
# Database
|
|
700
|
+
DB_CONNECTION=pgsql
|
|
701
|
+
DB_HOST=127.0.0.1
|
|
702
|
+
DB_PORT=5432
|
|
703
|
+
DB_DATABASE=myapp
|
|
704
|
+
DB_USERNAME=
|
|
705
|
+
DB_PASSWORD=
|
|
706
|
+
|
|
707
|
+
# Redis
|
|
708
|
+
REDIS_HOST=127.0.0.1
|
|
709
|
+
REDIS_PASSWORD=
|
|
710
|
+
REDIS_PORT=6379
|
|
711
|
+
|
|
712
|
+
# Mail (use transactional email service)
|
|
713
|
+
MAIL_MAILER=smtp
|
|
714
|
+
MAIL_HOST=
|
|
715
|
+
MAIL_PORT=587
|
|
716
|
+
MAIL_USERNAME=
|
|
717
|
+
MAIL_PASSWORD=
|
|
718
|
+
MAIL_ENCRYPTION=tls
|
|
719
|
+
|
|
720
|
+
# Session
|
|
721
|
+
SESSION_DRIVER=redis
|
|
722
|
+
SESSION_LIFETIME=120
|
|
723
|
+
SESSION_SECURE_COOKIE=true
|
|
724
|
+
SESSION_SAME_SITE=strict
|
|
725
|
+
|
|
726
|
+
# Sanctum
|
|
727
|
+
SANCTUM_STATEFUL_DOMAINS=myapp.com
|
|
728
|
+
|
|
729
|
+
# Security
|
|
730
|
+
BCRYPT_ROUNDS=12
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
```php
|
|
734
|
+
<?php
|
|
735
|
+
// config/session.php
|
|
736
|
+
return [
|
|
737
|
+
'driver' => env('SESSION_DRIVER', 'redis'),
|
|
738
|
+
'lifetime' => env('SESSION_LIFETIME', 120),
|
|
739
|
+
'expire_on_close' => true,
|
|
740
|
+
'encrypt' => true,
|
|
741
|
+
'secure' => env('SESSION_SECURE_COOKIE', true),
|
|
742
|
+
'http_only' => true,
|
|
743
|
+
'same_site' => env('SESSION_SAME_SITE', 'strict'),
|
|
744
|
+
];
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
## Security Checklist
|
|
748
|
+
|
|
749
|
+
### Authentication & Authorization
|
|
750
|
+
- [ ] Laravel Sanctum/Passport configured
|
|
751
|
+
- [ ] Token expiration set appropriately
|
|
752
|
+
- [ ] Policies defined for all models
|
|
753
|
+
- [ ] Gates defined for non-model authorization
|
|
754
|
+
- [ ] Rate limiting on authentication endpoints
|
|
755
|
+
- [ ] Password reset tokens expire quickly
|
|
756
|
+
|
|
757
|
+
### Input Validation
|
|
758
|
+
- [ ] All inputs validated via Form Requests
|
|
759
|
+
- [ ] File uploads validated (type, size, content)
|
|
760
|
+
- [ ] SQL injection prevented (Eloquent/Query Builder)
|
|
761
|
+
- [ ] XSS prevented (Blade escaping)
|
|
762
|
+
- [ ] CSRF protection enabled
|
|
763
|
+
|
|
764
|
+
### Configuration
|
|
765
|
+
- [ ] APP_DEBUG=false in production
|
|
766
|
+
- [ ] APP_KEY set and secure
|
|
767
|
+
- [ ] HTTPS enforced
|
|
768
|
+
- [ ] Security headers configured
|
|
769
|
+
- [ ] Sensitive data encrypted
|
|
770
|
+
- [ ] .env not committed to version control
|
|
771
|
+
|
|
772
|
+
### Dependencies
|
|
773
|
+
- [ ] composer audit passes
|
|
774
|
+
- [ ] Dependencies up to date
|
|
775
|
+
- [ ] No known vulnerabilities
|
|
776
|
+
|
|
777
|
+
### Logging & Monitoring
|
|
778
|
+
- [ ] Security events logged
|
|
779
|
+
- [ ] Failed login attempts tracked
|
|
780
|
+
- [ ] Sensitive data not logged
|
|
781
|
+
- [ ] Log retention policy defined
|
|
782
|
+
|
|
783
|
+
### API Security
|
|
784
|
+
- [ ] Rate limiting configured
|
|
785
|
+
- [ ] CORS properly configured
|
|
786
|
+
- [ ] API versioning implemented
|
|
787
|
+
- [ ] Sensitive endpoints require authentication
|