diff --git a/security-reports/zap-baseline.html b/security-reports/zap-baseline.html new file mode 100644 index 00000000..1123d0ca --- /dev/null +++ b/security-reports/zap-baseline.html @@ -0,0 +1,621 @@ + + +
+ +| Risk Level | +Number of Alerts | +
|---|---|
|
+ High
+ |
+
+ 0
+ |
+
|
+ Medium
+ |
+
+ 0
+ |
+
|
+ Low
+ |
+
+ 0
+ |
+
|
+ Informational
+ |
+
+ 1
+ |
+
|
+ False Positives:
+ |
+
+ 0
+ |
+
| Level | +Reason | +Site | +Description | +Statistic | +
|---|---|---|---|---|
|
+ Info
+ |
+
+ Informational
+ |
+
+ http://host.docker.internal:5173
+ |
+
+ Percentage of responses with status code 4xx
+ |
+
+ 100 %
+ |
+
|
+ Info
+ |
+
+ Informational
+ |
+
+ http://host.docker.internal:5173
+ |
+
+ Percentage of endpoints with content type text/plain
+ |
+
+ 100 %
+ |
+
|
+ Info
+ |
+
+ Informational
+ |
+
+ http://host.docker.internal:5173
+ |
+
+ Percentage of endpoints with method GET
+ |
+
+ 100 %
+ |
+
|
+ Info
+ |
+
+ Informational
+ |
+
+ http://host.docker.internal:5173
+ |
+
+ Count of total endpoints
+ |
+
+ 2
+ |
+
For each step: result (Pass/Fail) - risk (of highest alert(s) for the step, if any).
+ + + + + + + + +| Name | +Risk Level | +Number of Instances | +
|---|---|---|
| Non-Storable Content | +Informational | + + +3 | + +
|
+ Informational |
+ Non-Storable Content | +
|---|---|
| Description | +
+ The response contents are not storable by caching components such as proxy servers. If the response does not contain sensitive, personal or user-specific information, it may benefit from being stored and cached, to improve performance.
+
+ |
+
| + | |
| URL | +http://host.docker.internal:5173 | +
| Node Name | +http://host.docker.internal:5173 | +
| Method | +GET | +
| Parameter | ++ |
| Attack | ++ |
| Evidence | +403 | +
| Other Info | ++ |
| URL | +http://host.docker.internal:5173/robots.txt | +
| Node Name | +http://host.docker.internal:5173/robots.txt | +
| Method | +GET | +
| Parameter | ++ |
| Attack | ++ |
| Evidence | +403 | +
| Other Info | ++ |
| URL | +http://host.docker.internal:5173/sitemap.xml | +
| Node Name | +http://host.docker.internal:5173/sitemap.xml | +
| Method | +GET | +
| Parameter | ++ |
| Attack | ++ |
| Evidence | +403 | +
| Other Info | ++ |
| Instances | + + +3 | + +
| Solution | +
+ The content may be marked as storable by ensuring that the following conditions are satisfied:
+ + + The request method must be understood by the cache and defined as being cacheable ("GET", "HEAD", and "POST" are currently defined as cacheable)
+ + + The response status code must be understood by the cache (one of the 1XX, 2XX, 3XX, 4XX, or 5XX response classes are generally understood)
+ + + The "no-store" cache directive must not appear in the request or response header fields
+ + + For caching by "shared" caches such as "proxy" caches, the "private" response directive must not appear in the response
+ + + For caching by "shared" caches such as "proxy" caches, the "Authorization" header field must not appear in the request, unless the response explicitly allows it (using one of the "must-revalidate", "public", or "s-maxage" Cache-Control response directives)
+ + + In addition to the conditions above, at least one of the following conditions must also be satisfied by the response:
+ + + It must contain an "Expires" header field
+ + + It must contain a "max-age" response directive
+ + + For "shared" caches such as "proxy" caches, it must contain a "s-maxage" response directive
+ + + It must contain a "Cache Control Extension" that allows it to be cached
+ + + It must have a status code that is defined as cacheable by default (200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501).
+
+ |
+
| Reference | +
+ https://datatracker.ietf.org/doc/html/rfc7234
+ + + https://datatracker.ietf.org/doc/html/rfc7231 + + + https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html + + |
+
| CWE Id | +524 | +
| WASC Id | +13 | +
| Plugin Id | +10049 | +
The response contents are not storable by caching components such as proxy servers. If the response does not contain sensitive, personal or user-specific information, it may benefit from being stored and cached, to improve performance.
", + "instances":[ + { + "id": "3", + "uri": "http://host.docker.internal:5173", + "nodeName": "http:\/\/host.docker.internal:5173", + "method": "GET", + "param": "", + "attack": "", + "evidence": "403", + "otherinfo": "" + }, + { + "id": "2", + "uri": "http://host.docker.internal:5173/robots.txt", + "nodeName": "http:\/\/host.docker.internal:5173\/robots.txt", + "method": "GET", + "param": "", + "attack": "", + "evidence": "403", + "otherinfo": "" + }, + { + "id": "1", + "uri": "http://host.docker.internal:5173/sitemap.xml", + "nodeName": "http:\/\/host.docker.internal:5173\/sitemap.xml", + "method": "GET", + "param": "", + "attack": "", + "evidence": "403", + "otherinfo": "" + } + ], + "count": "3", + "systemic": false, + "solution": "The content may be marked as storable by ensuring that the following conditions are satisfied:
The request method must be understood by the cache and defined as being cacheable (\"GET\", \"HEAD\", and \"POST\" are currently defined as cacheable)
The response status code must be understood by the cache (one of the 1XX, 2XX, 3XX, 4XX, or 5XX response classes are generally understood)
The \"no-store\" cache directive must not appear in the request or response header fields
For caching by \"shared\" caches such as \"proxy\" caches, the \"private\" response directive must not appear in the response
For caching by \"shared\" caches such as \"proxy\" caches, the \"Authorization\" header field must not appear in the request, unless the response explicitly allows it (using one of the \"must-revalidate\", \"public\", or \"s-maxage\" Cache-Control response directives)
In addition to the conditions above, at least one of the following conditions must also be satisfied by the response:
It must contain an \"Expires\" header field
It must contain a \"max-age\" response directive
For \"shared\" caches such as \"proxy\" caches, it must contain a \"s-maxage\" response directive
It must contain a \"Cache Control Extension\" that allows it to be cached
It must have a status code that is defined as cacheable by default (200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501).
", + "otherinfo": "", + "reference": "https://datatracker.ietf.org/doc/html/rfc7234
https://datatracker.ietf.org/doc/html/rfc7231
https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html
", + "cweid": "524", + "wascid": "13", + "sourceid": "1" + } + ] + } + ], + "sequences":[ + ] + +} diff --git a/security-reports/zap.yaml b/security-reports/zap.yaml new file mode 100644 index 00000000..1f041ef0 --- /dev/null +++ b/security-reports/zap.yaml @@ -0,0 +1,40 @@ +env: + contexts: + - excludePaths: [] + name: baseline + urls: + - http://host.docker.internal:4173 + parameters: + failOnError: true + progressToStdout: false +jobs: +- parameters: + enableTags: false + maxAlertsPerRule: 10 + type: passiveScan-config +- parameters: + maxDuration: 1 + url: http://host.docker.internal:4173 + type: spider +- parameters: + maxDuration: 0 + type: passiveScan-wait +- parameters: + format: Long + summaryFile: /home/zap/zap_out.json + rules: [] + type: outputSummary +- parameters: + reportDescription: '' + reportDir: /zap/wrk/ + reportFile: zap-preview.html + reportTitle: ZAP Scanning Report + template: traditional-html + type: report +- parameters: + reportDescription: '' + reportDir: /zap/wrk/ + reportFile: zap-preview.json + reportTitle: ZAP Scanning Report + template: traditional-json + type: report diff --git a/tests/Feature/BulkUserRoleCreationTest_api.php b/tests/Feature/BulkUserRoleCreationTest_api.php new file mode 100644 index 00000000..2295f6af --- /dev/null +++ b/tests/Feature/BulkUserRoleCreationTest_api.php @@ -0,0 +1,125 @@ +seedRolesForUserCreation(); + $adminActor = $this->createAuthenticatedAdministratorActor($roles['administrator']); + + $this->actingAs($adminActor, 'api'); + + $this->createUsersThroughApi('parent', (int) $roles['parent']->id, 1000); + $this->createUsersThroughApi('teacher', (int) $roles['teacher']->id, 1000); + $this->createUsersThroughApi('admin', (int) $roles['admin']->id, 1000); + + $this->assertSame(3000, User::query()->where('email', 'like', 'bulk_api_%')->count()); + $this->assertSame(1000, User::query()->hasRoleName('parent')->where('email', 'like', 'bulk_api_parent_%')->count()); + $this->assertSame(1000, User::query()->hasRoleName('teacher')->where('email', 'like', 'bulk_api_teacher_%')->count()); + $this->assertSame(1000, User::query()->hasRoleName('admin')->where('email', 'like', 'bulk_api_admin_%')->count()); + + $this->assertDatabaseHas('users', [ + 'email' => 'bulk_api_parent_0001@example.test', + 'status' => 'Active', + 'is_verified' => 1, + ]); + + $this->assertSame( + ['parent'], + User::query()->where('email', 'bulk_api_parent_0001@example.test')->firstOrFail()->roleNames() + ); + $this->assertSame( + ['teacher'], + User::query()->where('email', 'bulk_api_teacher_0001@example.test')->firstOrFail()->roleNames() + ); + $this->assertSame( + ['admin'], + User::query()->where('email', 'bulk_api_admin_0001@example.test')->firstOrFail()->roleNames() + ); + } + + /** + * @return array