Skip to content
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

chore(deps): update dependency @apollo/server to v4.9.3 [security] - autoclosed #480

Closed
wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Aug 31, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@apollo/server 4.1.0 -> 4.9.3 age adoption passing confidence

GitHub Vulnerability Alerts

GHSA-j5g3-5c8r-7qfx

Impact

What kind of vulnerability is it?

Apollo Server can log sensitive information (Studio API keys) if they are passed incorrectly (with leading/trailing whitespace) or if they have any characters that are invalid as part of a header value.

Who is impacted?

Users who (all of the below):

  • use either the schema reporting or usage reporting feature
  • use an Apollo Studio API key which has invalid header values
  • use the default fetcher (node-fetch) or configured their own node-fetch fetcher

The following node snippet can test whether your API key has invalid header values. This code is taken directly from node-fetch@2's header value validation code.

const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
if (invalidHeaderCharRegex.test('<YOUR_API_KEY>')) {
  console.log('potentially affected');
}
console.log('unaffected');

If the provided API key is not a valid header value, whenever Apollo Server uses that API key in a request (to Studio, for example), node-fetch will throw an error which contains the header value. This error is logged in various ways depending on the user's configuration, but most likely the console or some configured logging service.

Patches

This problem is patched in the latest version of Apollo Server as soon as this advisory is published.

Workarounds

  • Try retrieving a new API key from Studio. Note: this may not work if the invalid character is not part of the secret (it may be derived from identifiers like graph name, user name).
  • Override the fetcher
  • Disable schema reporting and/or usage reporting

Solution

  • Apollo Server will now call .trim() on incoming API keys in order to eliminate leading/trailing whitespace and log a warning when it does so.
  • Apollo Server will now perform the same validation of API keys as node-fetch@2 performs on header values on startup. Apollo Server will throw an error on startup (i.e., fail to start completely) and notify the user their API key is invalid along with the offending characters.

Release Notes

apollographql/apollo-server (@​apollo/server)

v4.9.3

Compare Source

Patch Changes
  • a1c725eaf Thanks @​trevor-scheer! - Ensure API keys are valid header values on startup

    Apollo Server previously performed no sanitization or validation of API keys on startup. In the case that an API key was provided which contained characters that are invalid as header values, Apollo Server could inadvertently log the API key in cleartext.

    This only affected users who:

    • Provide an API key with characters that are invalid as header values
    • Use either schema or usage reporting
    • Use the default fetcher provided by Apollo Server or configure their own node-fetch fetcher

    Apollo Server now trims whitespace from API keys and validates that they are valid header values. If an invalid API key is provided, Apollo Server will throw an error on startup.

    For more details, see the security advisory:
    GHSA-j5g3-5c8r-7qfx

v4.9.2

Compare Source

Patch Changes
  • #​7699 62e7d940d Thanks @​trevor-scheer! - Fix error path attachment for list items

    Previously, when errors occurred while resolving a list item, the trace builder would fail to place the error at the correct path and just default to the root node with a warning message:

    Could not find node with path x.y.1, defaulting to put errors on root node.

    This change places these errors at their correct paths and removes the log.

v4.9.1

Compare Source

Patch Changes

v4.9.0

Compare Source

Minor Changes
  • #​7617 4ff81ca50 Thanks @​trevor-scheer! - Introduce new ApolloServerPluginSubscriptionCallback plugin. This plugin implements the subscription callback protocol which is used by Apollo Router. This feature implements subscriptions over HTTP via a callback URL which Apollo Router registers with Apollo Server. This feature is currently in preview and is subject to change.

    You can enable callback subscriptions like so:

    import { ApolloServerPluginSubscriptionCallback } from '@&#8203;apollo/server/plugin/subscriptionCallback';
    import { ApolloServer } from '@&#8203;apollo/server';
    
    const server = new ApolloServer({
      // ...
      plugins: [ApolloServerPluginSubscriptionCallback()],
    });

    Note that there is currently no tracing or metrics mechanism in place for callback subscriptions. Additionally, this plugin "intercepts" callback subscription requests and bypasses some of Apollo Server's internals. The result of this is that certain plugin hooks (notably executionDidStart and willResolveField) will not be called when handling callback subscription requests or when sending subscription events.

    For more information on the subscription callback protocol, visit the docs:
    https://www.apollographql.com/docs/router/executing-operations/subscription-callback-protocol/

Patch Changes

v4.8.1

Compare Source

Patch Changes

v4.8.0

Compare Source

Minor Changes
  • #​7634 f8a8ea08f Thanks @​dfperry5! - Updating the ApolloServer constructor to take in a stringifyResult function that will allow a consumer to pass in a function that formats the result of an http query.

    Usage:

    const server = new ApolloServer({
      typeDefs,
      resolvers,
      stringifyResult: (value: FormattedExecutionResult) => {
        return JSON.stringify(value, null, 2);
      },
    });

v4.7.5

Compare Source

Patch Changes

v4.7.4

Compare Source

Patch Changes
  • 0adaf80d1 Thanks @​trevor-scheer! - Address Content Security Policy issues

    The previous implementation of CSP nonces within the landing pages did not take full advantage of the security benefit of using them. Nonces should only be used once per request, whereas Apollo Server was generating one nonce and reusing it for the lifetime of the instance. The reuse of nonces degrades the security benefit of using them but does not pose a security risk on its own. The CSP provides a defense-in-depth measure against a potential XSS, so in the absence of a known XSS vulnerability there is likely no risk to the user.

    The mentioned fix also coincidentally addresses an issue with using crypto functions on startup within Cloudflare Workers. Crypto functions are now called during requests only, which resolves the error that Cloudflare Workers were facing. A recent change introduced a precomputedNonce configuration option to mitigate this issue, but it was an incorrect approach given the nature of CSP nonces. This configuration option is now deprecated and should not be used for any reason since it suffers from the previously mentioned issue of reusing nonces.

    Additionally, this change adds other applicable CSPs for the scripts, styles, images, manifest, and iframes that the landing pages load.

    A final consequence of this change is an extension of the renderLandingPage plugin hook. This hook can now return an object with an html property which returns a Promise<string> in addition to a string (which was the only option before).

v4.7.3

Compare Source

Patch Changes
  • #​7601 75b668d9e Thanks @​trevor-scheer! - Provide a new configuration option for landing page plugins precomputedNonce which allows users to provide a nonce and avoid calling into uuid functions on startup. This is useful for Cloudflare Workers where random number generation is not available on startup (only during requests). Unless you are using Cloudflare Workers, you can ignore this change.

    The example below assumes you've provided a PRECOMPUTED_NONCE variable in your wrangler.toml file.

    Example usage:

    const server = new ApolloServer({
      // ...
      plugins: [
        ApolloServerPluginLandingPageLocalDefault({
          precomputedNonce: PRECOMPUTED_NONCE,
        }),
      ],
    });

v4.7.2

Compare Source

Patch Changes
  • #​7599 c3f04d050 Thanks @​trevor-scheer! - Update @apollo/utils.usagereporting dependency. Previously, installing @apollo/gateway and @apollo/server could result in duplicate / differently versioned installs of @apollo/usage-reporting-protobuf. This is because the @apollo/server-gateway-interface package was updated to use the latest protobuf, but the @apollo/utils.usagereporting package was not. After this change, users should always end up with a single install of the protobuf package when installing both @apollo/server and @apollo/gateway latest versions.

v4.7.1

Compare Source

Patch Changes
  • #​7539 5d3c45be9 Thanks @​mayakoneval! - 🐛 Bug Fix for Apollo Server Landing Pages on Safari. A Content Security Policy was added to our landing page html so that Safari can run the inline scripts we use to call the Embedded Sandbox & Explorer.

v4.7.0

Compare Source

Minor Changes
  • #​7504 22a5be934 Thanks @​mayakoneval! - In the Apollo Server Landing Page Local config, you can now opt out of the telemetry that Apollo Studio runs in the
    embedded Sandbox & Explorer landing pages. This telemetry includes Google Analytics for event tracking and
    Sentry for error tracking.

    Example of the new config option:

    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        process.env.NODE_ENV === 'production'
          ? ApolloServerPluginLandingPageProductionDefault({
              graphRef: 'my-graph-id@my-graph-variant',
              embed: {
                runTelemetry: false
              },
            })
          : ApolloServerPluginLandingPageLocalDefault({
              embed: {
                runTelemetry: false
              },
            }),
      ],
    });
    

v4.6.0

Compare Source

Minor Changes
  • #​7465 1e808146a Thanks @​trevor-scheer! - Introduce new opt-in configuration option to mitigate v4 status code regression

    Apollo Server v4 accidentally started responding to requests with an invalid variables object with a 200 status code, where v3 previously responded with a 400. In order to not break current behavior (potentially breaking users who have creatively worked around this issue) and offer a mitigation, we've added the following configuration option which we recommend for all users.

    new ApolloServer({
      // ...
      status400ForVariableCoercionErrors: true,
    });

    Specifically, this regression affects cases where input variable coercion fails. Variables of an incorrect type (i.e. String instead of Int) or unexpectedly null are examples that fail variable coercion. Additionally, missing or incorrect fields on input objects as well as custom scalars that throw during validation will also fail variable coercion. For more specifics on variable coercion, see the "Input Coercion" sections in the GraphQL spec.

    This will become the default behavior in Apollo Server v5 and the configuration option will be ignored / no longer needed.

Patch Changes
  • #​7454 f6e3ae021 Thanks @​trevor-scheer! - Start building packages with TS 5.x, which should have no effect for users

  • #​7433 e0db95b96 Thanks @​KGAdamCook! - Previously, when users provided their own documentStore, Apollo Server used a random prefix per schema in order to guarantee there was no shared state from one schema to the next. Now Apollo Server uses a hash of the schema, which enables the provided document store to be shared if you choose to do so.

v4.5.0

Compare Source

Minor Changes
  • #​7431 7cc163ac8 Thanks @​mayakoneval! - In the Apollo Server Landing Page Local config, you can now automatically turn off autopolling on your endpoints as well as pass headers used to introspect your schema, embed an operation from a collection, and configure whether the endpoint input box is editable. In the Apollo Server Landing Page Prod config, you can embed an operation from a collection & we fixed a bug introduced in release 4.4.0

    Example of all new config options:

    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        process.env.NODE_ENV === 'production'
          ? ApolloServerPluginLandingPageProductionDefault({
              graphRef: 'my-graph-id@my-graph-variant',
              collectionId: 'abcdef',
              operationId: '12345'
              embed: true,
              footer: false,
            })
          : ApolloServerPluginLandingPageLocalDefault({
              collectionId: 'abcdef',
              operationId: '12345'
              embed: {
                initialState: {
                  pollForSchemaUpdates: false,
                  sharedHeaders: {
                    "HeaderNeededForIntrospection": "ValueForIntrospection"
                  },
                },
                endpointIsEditable: true,
              },
              footer: false,
            }),
      ],
    });
    
    
  • #​7430 b694bb1dd Thanks @​mayakoneval! - We now send your @​apollo/server version to the embedded Explorer & Sandbox used in the landing pages for analytics.

Patch Changes
  • #​7432 8cbc61406 Thanks @​mayakoneval! - Bug fix: TL;DR revert a previous change that stops passing includeCookies from the prod landing page config.

    Who was affected?

    Any Apollo Server instance that passes a graphRef to a production landing page with a non-default includeCookies value that does not match the Include cookies setting on your registered variant on studio.apollographql.com.

    How were they affected?

    From release 4.4.0 to this patch release, folks affected would have seen their Explorer requests being sent with cookies included only if they had set Include cookies on their variant. Cookies would not have been included by default.

v4.4.1

Compare Source

Patch Changes

v4.4.0

Compare Source

Minor Changes

v4.3.3

Compare Source

Patch Changes
  • #​7331 9de18b34c Thanks @​trevor-scheer! - Unpin node-abort-controller and update to latest unbreaking patch

  • #​7136 8c635d104 Thanks @​trevor-scheer! - Errors reported by subgraphs (with no trace data in the response) are now accurately reflected in the numeric error stats.

    Operations that receive errors from subgraphs (with no trace data in the response) are no longer sent as incomplete, error-less traces.

    Note: in order for this fix to take effect, your @apollo/gateway version must be updated to v2.3.1 or later.

v4.3.2

Compare Source

Patch Changes
  • #​7314 f246ddb71 Thanks @​trevor-scheer! - Add an __identity property to HeaderMap class to disallow standard Maps (in TypeScript).

    This ensures that typechecking occurs on fields which are declared to accept a
    HeaderMap (notably, the httpGraphQLRequest.headers option to
    ApolloServer.executeHTTPGraphQLRequest and the http.headers option to
    ApolloServer.executeOperation). This might be a breaking change for
    integration authors, but should be easily fixed by switching from new Map<string, string>() to new HeaderMap().

  • #​7326 e25cb58ff Thanks @​trevor-scheer! - Pin node-abort-controller version to avoid breaking change. Apollo Server users can enter a broken state if they update their package-lock.json due to a breaking change in a minor release of the mentioned package.

    Ref: https://github.com/southpolesteve/node-abort-controller/issues/39

  • Updated dependencies [e0f959a63]:

v4.3.1

Compare Source

Patch Changes
  • #​7313 ec28b4b33 Thanks @​vtipparam! - Allow case insensitive lookup on headers. Use HeaderMap instead of plain Map for headers in expressMiddleware.

  • #​7311 322b5ebbc Thanks @​axe-me! - Export intermediate ApolloServerOptions* types

  • #​7274 3b0ec8529 Thanks @​patrick91! - The subgraph spec has evolved in Federation v2 such that the type of
    _Service.sdl (formerly nullable) is now non-nullable. Apollo Server now
    detects both cases correctly in order to determine whether to:

    1. install / enable the ApolloServerPluginInlineTrace plugin
    2. throw on startup if ApolloServerPluginSchemaReporting should not be installed
    3. warn when ApolloServerPluginUsageReporting is installed and configured with the __onlyIfSchemaIsNotSubgraph option

v4.3.0

Compare Source

Minor Changes
  • #​7241 d7e9b9759 Thanks @​glasser! - If the cache you provide to the persistedQueries.cache option is created with PrefixingKeyValueCache.cacheDangerouslyDoesNotNeedPrefixesForIsolation (new in @apollo/[email protected]), the apq: prefix will not be added to cache keys. Providing such a cache to new ApolloServer() throws an error.
Patch Changes
  • #​7232 3a4823e0d Thanks @​glasser! - Refactor the implementation of ApolloServerPluginDrainHttpServer's grace period. This is intended to be a no-op.

  • #​7229 d057e2ffc Thanks @​dnalborczyk! - Improve compatibility with Cloudflare workers by avoiding the use of the Node util package. This change is intended to be a no-op.

  • #​7228 f97e55304 Thanks @​dnalborczyk! - Improve compatibility with Cloudflare workers by avoiding the use of the Node url package. This change is intended to be a no-op.

  • #​7241 d7e9b9759 Thanks @​glasser! - For ease of upgrade from the recommended configuration of Apollo Server v3.9+, you can now pass new ApolloServer({ cache: 'bounded' }), which is equivalent to not providing the cache option (as a bounded cache is now the default in AS4).

v4.2.2

Compare Source

Patch Changes
  • #​7203 2042ee761 Thanks @​glasser! - Fix v4.2.0 (#​7171) regression where "operationName": null, "variables": null, and "extensions": null in POST bodies were improperly rejected.

v4.2.1

Compare Source

Patch Changes

v4.2.0

Compare Source

Minor Changes
  • #​7171 37b3b7fb5 Thanks @​glasser! - If a POST body contains a non-string operationName or a non-object variables or extensions, fail with status code 400 instead of ignoring the field.

    In addition to being a reasonable idea, this provides more compliance with the "GraphQL over HTTP" spec.

    This is a backwards incompatible change, but we are still early in the Apollo Server 4 adoption cycle and this is in line with the change already made in Apollo Server 4 to reject requests providing variables or extensions as strings. If this causes major problems for users who have already upgraded to Apollo Server 4 in production, we can consider reverting or partially reverting this change.

  • #​7184 b1548c1d6 Thanks @​glasser! - Don't automatically install the usage reporting plugin in servers that appear to be hosting a federated subgraph (based on the existence of a field _Service.sdl: String). This is generally a misconfiguration. If an API key and graph ref are provided to the subgraph, log a warning and do not enable the usage reporting plugin. If the usage reporting plugin is explicitly installed in a subgraph, log a warning but keep it enabled.

Patch Changes

v4.1.1

Compare Source

Patch Changes

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot force-pushed the renovate/npm-@apollo/server-vulnerability branch from cabd006 to be4145e Compare September 21, 2023 12:41
@renovate renovate bot force-pushed the renovate/npm-@apollo/server-vulnerability branch 5 times, most recently from fab6c2b to 59f7acc Compare October 16, 2023 07:17
@renovate renovate bot force-pushed the renovate/npm-@apollo/server-vulnerability branch from 59f7acc to d9d2096 Compare October 16, 2023 07:18
@renovate renovate bot changed the title chore(deps): update dependency @apollo/server to v4.9.3 [security] chore(deps): update dependency @apollo/server to v4.9.3 [security] - autoclosed Oct 16, 2023
@renovate renovate bot closed this Oct 16, 2023
@renovate renovate bot deleted the renovate/npm-@apollo/server-vulnerability branch October 16, 2023 07:22
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.

0 participants