Skip to content

Commit

Permalink
fix(oas): prevent ReDoS in the BodyConverter (#219)
Browse files Browse the repository at this point in the history
closes #218
  • Loading branch information
ostridm committed Nov 14, 2023
1 parent d7f1a96 commit 30eb0e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/oas/src/converter/parts/postdata/BodyConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ export abstract class BodyConverter<T extends OpenAPI.Document>
}: EncodingData): string {
const [mime]: string[] = contentType
.split(',')
.map((x) => x.trim().replace(/;.+?$/, ''));
.map((x) => {
const [part]: string[] = x.trim().split(';');

return part;
})
.filter(Boolean) as string[];

switch (mime) {
case 'application/json':
Expand Down

0 comments on commit 30eb0e4

Please sign in to comment.