Skip to content

Transformer插件处理multipart/form-data请求体时导致file字段丢失 || =The file field is lost when the Transformer plugin handles multipart/form-data request body #2257

@exuscartman

Description

@exuscartman

If you are reporting any crash or any potential security issue, do not
open an issue in this repo. Please report the issue via ASRC(Alibaba Security Response Center) where the issue will be triaged appropriately.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

Transformer插件处理multipart/form-data请求体时导致file字段丢失

Ⅱ. Describe what happened

当使用transformer插件的replace操作修改multipart/form-data类型接口(如/v1/audio/transcriptions)的body中普通字段(如model)时,会导致upstream服务报422错误,提示缺少file字段。

If there is an exception, please attach the exception trace:

Just paste your stack trace here!

Ⅲ. Describe what you expected to happen

transformer插件应该能够正确处理multipart/form-data类型的请求,在修改body中普通字段的同时保留file字段的完整性,不破坏multipart/form-data的结构。

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. 配置transformer插件,使用replace操作修改multipart/form-data类型请求/v1/audio/transcriptions的body中的model字段
  2. 向higress请求/v1/audio/transcriptions
  3. upstream服务报422错误,提示缺少file字段

Ⅴ. Anything else we need to know?

若使用transformer插件不修改body字段,只修改headers,则不会出现该问题

Ⅵ. Environment:

  • Higress version: 2.1.3
  • OS : linux
  • Others: kubernetes部署

If you are reporting any crash or any potential security issue, do not
open an issue in this repo. Please report the issue via ASRC(Alibaba Security Response Center) where the issue will be tried appropriately.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

The file field is lost when the Transformer plugin handles multipart/form-data request body

Ⅱ. Describe what happened

When using the transformer plug-in's replace operation to modify the normal field (such as model) in the body of the multipart/form-data type interface (such as /v1/audio/transcriptions), it will cause the upstream service to report a 422 error, prompting that the file field is missing.

If there is an exception, please attach the exception trace:

Just paste your stack trace here!

Ⅲ. Describe what you expected to happen

The transformer plug-in should be able to correctly handle multipart/form-data requests, while modifying normal fields in the body, while retaining the integrity of the file field without destroying the multipart/form-data structure.

IV. How to reproduce it (as minimally and precisely as possible)

  1. Configure the transformer plug-in and use the replace operation to modify the model field in the body of multipart/form-data type request/v1/audio/transcriptions
  2. Request /v1/audio/transcriptions from higress
  3. The upstream service reported 422 error, prompting that the file field is missing

V. Anything else we need to know?

If you use the transformer plugin to not modify the body field and only modify the headers, the problem will not occur.

Ⅵ. Environment:

  • Higress version: 2.1.3
  • OS: linux
  • Others: kubernetes deployment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions