rsnext/packages/next/server/web
Seiya Nuta 0bf9233e14
[middleware] Warn dynamic WASM compilation (#37681)
In Middlewares, dynamic code execution is not allowed. Currently, we warn if eval / new Function are invoked in dev but don't warn another dynamic code execution in WebAssembly.

This PR adds warnings for `WebAssembly.compile` and `WebAssembly.instantiate` with a buffer parameter (note that `WebAssembly.instantiate` with a **module** parameter is legit) invocations. Note that other methods that compile WASM dynamically such as `WebAssembly.compileStreaming` are not exposed to users so we don't need to cover them.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [x] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-06-16 14:59:30 +00:00
..
sandbox [middleware] Warn dynamic WASM compilation (#37681) 2022-06-16 14:59:30 +00:00
spec-extension Middleware: remove req.ua (#37512) 2022-06-09 11:10:21 +00:00
adapter.ts Ensure navigating with middleware parses route params correctly (#37704) 2022-06-15 09:09:51 -05:00
error.ts Middleware: remove req.ua (#37512) 2022-06-09 11:10:21 +00:00
next-url.ts Execute middleware on Next.js internal requests (#37121) 2022-05-27 13:29:04 -05:00
types.ts Allow reading request bodies in middlewares (#34294) (#34519) 2022-02-18 19:43:43 +00:00
utils.ts Use Edge Runtime for running Edge Functions locally (#37024) 2022-05-30 12:01:36 +00:00