-
Notifications
You must be signed in to change notification settings - Fork 652
Update dependency body-parser to v2 #8107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@backstage-community/plugin-code-coverage-backend': patch | ||
| --- | ||
|
|
||
| Updated dependency `body-parser` to `^2.0.0`. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -46,7 +46,7 @@ | |||||
| "@backstage/errors": "backstage:^", | ||||||
| "@backstage/integration": "backstage:^", | ||||||
| "@types/express": "^4.17.6", | ||||||
| "body-parser": "^1.20.0", | ||||||
| "body-parser": "^2.0.0", | ||||||
|
||||||
| "body-parser": "^2.0.0", | |
| "body-parser": "^1.20.3", |
Copilot
AI
Apr 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
body-parser@2.x requires Node.js 18+ per upstream release notes. If this plugin/workspace is expected to run on older Node versions, installs or runtime will break; ensure the package/workspace engines.node (and deployment/CI runtime) is aligned with Node 18+ as part of this upgrade.
Copilot
AI
Apr 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
body-parser v2 is a major upgrade and this plugin uses both BodyParser.text() and BodyParser.xml() (via body-parser-xml), but the current router tests only exercise the text/plain path. To reduce upgrade risk, add a test that posts Content-Type: text/xml (or whichever XML content-type you support) through POST /report and asserts the request body is parsed and accepted (or errors as expected).
Copilot
AI
Apr 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
body-parser v2 introduces breaking behavior changes (e.g., req.body left undefined unless parsed) and this plugin relies on both BodyParser.text() and body-parser-xml (BodyParser.xml()). There are tests for the text/plain path, but no coverage for the XML parser or the "missing/empty body" behavior; please add/extend tests to ensure XML uploads still parse correctly and that requests without a parsed body return the expected error after the major upgrade.
Copilot
AI
Apr 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
express@4.22.1 still pulls in body-parser@~1.20.3 (see yarn.lock), so after adding body-parser@^2 this workspace ends up with both v1 and v2 installed. If the intent of this upgrade is to pick up the v2 security fix, note that any usage of express.json() / express.urlencoded() will continue to use the v1 parser from Express. Consider switching any JSON/urlencoded parsing in the plugin to use the newly added body-parser@^2 APIs instead (or removing it if unused), otherwise scanners/runtime may still be impacted by the v1 dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a major
body-parserupgrade, but the backend plugin’s router tests only cover thetext/plain(LCOV) parsing path. SincecoverageType=jacoco|coberturarelies on the XML parsing middleware (body-parser-xmlwiring intobody-parser), please add/extend tests to cover atext/xmlPOST to/reportto catch any compatibility/regression issues introduced bybody-parser@^2.