-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular/build): update vite to version 6.0.11
Version update from 6.0.7 to address advisory GHSA-vg6x-rcgg-rjx6 Vite version 6.0.9+, which is now used by the Angular CLI with the `application`/`browser-esbuild` builders, contains a potentially breaking change for some development setups. Examples of such setups include those that use reverse proxies or custom host names during development. The change within a patch release was made by Vite to address a security vulnerability. For projects that directly access the development server via `localhost`, no changes should be needed. However, some development setups may now need to adjust the `allowedHosts` development server option. This option can include an array of host names that are allowed to communicate with the development server. The option sets the corresponding Vite option within the Angular CLI. For more information on the option and its specific behavior, please see the Vite documentation located here: https://vite.dev/config/server-options.html#server-allowedhosts The following is an example of the configuration option allowing `example.com`: ``` "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { "allowedHosts": ["example.com"] }, ```
- Loading branch information
Showing
13 changed files
with
192 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
packages/angular/build/src/builders/dev-server/tests/options/allowed-hosts_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.dev/license | ||
*/ | ||
|
||
import { executeDevServer } from '../../index'; | ||
import { executeOnceAndGet } from '../execute-fetch'; | ||
import { describeServeBuilder } from '../jasmine-helpers'; | ||
import { BASE_OPTIONS, DEV_SERVER_BUILDER_INFO } from '../setup'; | ||
|
||
const FETCH_HEADERS = Object.freeze({ Host: 'example.com' }); | ||
|
||
describeServeBuilder(executeDevServer, DEV_SERVER_BUILDER_INFO, (harness, setupTarget) => { | ||
describe('option: "allowedHosts"', () => { | ||
beforeEach(async () => { | ||
setupTarget(harness); | ||
|
||
// Application code is not needed for these tests | ||
await harness.writeFile('src/main.ts', ''); | ||
}); | ||
|
||
it('does not allow an invalid host when option is not present', async () => { | ||
harness.useTarget('serve', { | ||
...BASE_OPTIONS, | ||
}); | ||
|
||
const { result, response } = await executeOnceAndGet(harness, '/', { | ||
request: { headers: FETCH_HEADERS }, | ||
}); | ||
|
||
expect(result?.success).toBeTrue(); | ||
expect(response?.statusCode).toBe(403); | ||
}); | ||
|
||
it('does not allow an invalid host when option is an empty array', async () => { | ||
harness.useTarget('serve', { | ||
...BASE_OPTIONS, | ||
allowedHosts: [], | ||
}); | ||
|
||
const { result, response } = await executeOnceAndGet(harness, '/', { | ||
request: { headers: FETCH_HEADERS }, | ||
}); | ||
|
||
expect(result?.success).toBeTrue(); | ||
expect(response?.statusCode).toBe(403); | ||
}); | ||
|
||
it('allows a host when specified in the option', async () => { | ||
harness.useTarget('serve', { | ||
...BASE_OPTIONS, | ||
allowedHosts: ['example.com'], | ||
}); | ||
|
||
const { result, content } = await executeOnceAndGet(harness, '/', { | ||
request: { headers: FETCH_HEADERS }, | ||
}); | ||
|
||
expect(result?.success).toBeTrue(); | ||
expect(content).toContain('<title>'); | ||
}); | ||
|
||
it('allows a host when option is true', async () => { | ||
harness.useTarget('serve', { | ||
...BASE_OPTIONS, | ||
allowedHosts: true, | ||
}); | ||
|
||
const { result, content } = await executeOnceAndGet(harness, '/', { | ||
request: { headers: FETCH_HEADERS }, | ||
}); | ||
|
||
expect(result?.success).toBeTrue(); | ||
expect(content).toContain('<title>'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.