Skip to content

refactor: Security upgrade @apollo/server from 4.12.1 to 5.0.0 #9830

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

Open
wants to merge 1 commit into
base: alpha
Choose a base branch
from

Conversation

parseplatformorg
Copy link
Contributor

@parseplatformorg parseplatformorg commented Jul 22, 2025

snyk-top-banner

Snyk has created this PR to fix 1 vulnerabilities in the npm dependencies of this project.

Snyk changed the following file(s):

  • package.json
  • package-lock.json

Vulnerabilities that will be fixed with an upgrade:

Issue Score
critical severity Predictable Value Range from Previous Values
SNYK-JS-FORMDATA-10841150
  863  

Important

  • Check the changes in this PR to ensure they won't cause issues with your project.
  • Max score is 1000. Note that the real score may have changed since the PR was raised.
  • This PR was automatically created by Snyk using the credentials of a real user.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open fix PRs.

For more information:
🧐 View latest project report
📜 Customise PR templates
🛠 Adjust project settings
📚 Read about Snyk's upgrade logic


Learn how to fix vulnerabilities with free interactive lessons:

🦉 Learn about vulnerability in an interactive lesson of Snyk Learn.

Summary by CodeRabbit

  • Chores
    • Updated the "@apollo/server" dependency to version 5.0.0.

Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title [Snyk] Security upgrade @apollo/server from 4.12.1 to 5.0.0 refactor: Security upgrade @apollo/server from 4.12.1 to 5.0.0 Jul 22, 2025
Copy link

🚀 Thanks for opening this pull request!

Copy link

coderabbitai bot commented Jul 22, 2025

📝 Walkthrough

Walkthrough

The version of the "@apollo/server" dependency in the package.json file was updated from "4.12.1" to "5.0.0". No other dependencies or parts of the file were changed.

Changes

File(s) Change Summary
package.json Updated "@apollo/server" version from 4.12.1 to 5.0.0

Estimated code review effort

1 (~2 minutes)

Possibly related PRs


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@parseplatformorg
Copy link
Contributor Author

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
package.json (1)

23-23: Consider loosening the pin to receive patch releases

Locking to exactly 5.0.0 prevents automatic adoption of security/bug-fix patch versions (5.0.x). Using a caret (^5.0.0) or at least 5.0.1 (latest) is safer unless strict reproducibility is required.

-    "@apollo/server": "5.0.0",
+    "@apollo/server": "^5.0.0",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e301a5 and 7de26f4.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json (1 hunks)

Comment on lines 22 to 24
"dependencies": {
"@apollo/server": "4.12.1",
"@apollo/server": "5.0.0",
"@babel/eslint-parser": "7.27.1",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Double-check compatibility & breaking changes introduced in @apollo/server 5.x

Upgrading from 4.x → 5.x is a major bump that removes or renames several APIs (e.g. expressMiddleware, ApolloServerPluginDrainHttpServer, built-in file-upload handling) and drops support for subscriptions-transport-ws. Given Parse Server’s existing GraphQL stack (graphql-upload, subscriptions-transport-ws, etc.), this may introduce runtime failures.

Run the quick scan below to locate potential 4.x-specific usages that now need migration:

If matches are found, refer to Apollo Server 5 migration docs and update the affected code before merging.


🏁 Script executed:

#!/bin/bash
# Search for deprecated/renamed 4.x APIs that were removed in 5.x
rg -n --glob '!node_modules' $'expressMiddleware|ApolloServerPluginDrainHttpServer|ApolloServerPluginLandingPage*|addPlugin' -A2

Length of output: 605


🏁 Script executed:

#!/bin/bash
# Inspect ApolloServer instantiation to see if `start()` is called
rg -n "new ApolloServer" -A5 src/GraphQL/ParseGraphQLServer.js

# Check for any calls to `start()` on the ApolloServer instance
rg -n "start(" -A5 src/GraphQL/ParseGraphQLServer.js

# Look for usages of the deprecated `subscriptions-transport-ws` package
rg -n --glob '!node_modules' "subscriptions-transport-ws" -A2

Length of output: 3632


Update GraphQL Server for Apollo Server 5.x Compatibility

Upgrading from @apollo/server 4.x → 5.x is a major bump that:

  • Renames/removes expressMiddleware (now requires calling await server.start() and using server.getMiddleware()).
  • Drops built-in file‐upload handling and subscriptions-transport-ws support.

Before merging, update or replace these usages:

src/GraphQL/ParseGraphQLServer.js
– Line 4: import { expressMiddleware } from '@apollo/server/express4';
– Lines 112–114: calls to expressMiddleware(apollo, { … })
• Change to the new pattern:
js await apollo.start(); const graphqlHandler = apollo.getMiddleware({ context }); app.use('/graphql', graphqlHandler);

• Subscription setup in src/GraphQL/ParseGraphQLServer.js
– Lines 8–9: importing/using SubscriptionServer from subscriptions-transport-ws
• Migrate to graphql-ws (see Apollo docs: https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws).

• Tests in spec/ParseGraphQLServer.spec.js
– Lines 13–15: SubscriptionClient from subscriptions-transport-ws
• Update to use an in-memory or graphql-ws test client and async/await patterns.

Refer to Apollo Server 5 migration guide for full list of breaking changes and examples:
https://www.apollographql.com/docs/apollo-server/migration/#apollo-server-5x-migration-guide

🤖 Prompt for AI Agents
In package.json around lines 22 to 24, the dependency upgrade to @apollo/server
5.0.0 requires code changes for compatibility. Update
src/GraphQL/ParseGraphQLServer.js by removing the import of expressMiddleware
from '@apollo/server/express4' and replace calls to expressMiddleware with the
new pattern: call await apollo.start(), then get the middleware via
apollo.getMiddleware({ context }), and use app.use('/graphql', graphqlHandler).
Also, replace the subscription setup that uses subscriptions-transport-ws with
graphql-ws as per Apollo Server 5 migration guide. Similarly, update tests in
spec/ParseGraphQLServer.spec.js to replace SubscriptionClient from
subscriptions-transport-ws with a graphql-ws based test client using
async/await. Follow the Apollo Server 5 migration guide for detailed steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants