Skip to content

Commit

Permalink
chore: documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Apr 8, 2024
1 parent 01b39be commit 6e55a59
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
22 changes: 9 additions & 13 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ export interface AstroUserConfig {
* @type {object}
* @description
*
* It allows to opt-in various security measures for Astro applications.
* It allows to opt-in various security features.
*/
security?: {
/**
Expand All @@ -1626,6 +1626,8 @@ export interface AstroUserConfig {
* @default '{}'
* @version 4.6.0
* @description
*
* It enables some security measures to prevent CSRF attacks: https://owasp.org/www-community/attacks/csrf
*/

csrfProtection?: {
Expand All @@ -1636,20 +1638,14 @@ export interface AstroUserConfig {
* @version 4.6.0
* @description
*
* Something
*/
origin?: boolean;

/**
* @name security.csrfProtection.token
* @type {boolean}
* @default 'false'
* @version 4.6.0
* @description
* When enabled, it enables a strict check on the "origin" header. This is header it that is passed by the browsers on each request.
*
* Something
* The "origin" check is executed only on-demand pages, and only for the requests `POST, `PATCH`, `DELETE` and `PUT`, only for those requests that
* the followin `content-type` header: 'application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'.
*
* It the "origin" header doesn't match the pathname of the request, Astro will return a 403 status code and won't render the page.
*/
token?: boolean | string;
origin?: boolean;
};
};

Expand Down
1 change: 0 additions & 1 deletion packages/astro/src/core/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ export class App {
* @private
*/
#createPipeline(streaming = false) {
console.log(this.#manifest);
if (this.#manifest.csrfProtection?.origin === true) {
this.#manifest.middleware = sequence(
this.#createOriginCheckMiddleware(),
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6e55a59

Please sign in to comment.