CVE-2024-32971 (Rust, published 2024-05-02T07:15Z)
Description: value: Apollo Router is a configurable, graph router written in Rust to run a federated supergraph that uses Apollo Federation 2. The affected versions of Apollo Router contain a bug that in limited circumstances, could lead to unexpected operations being executed which can result in unintended data or effects. This only affects Router instances configured to use distributed query plan caching. The root cause of this defect is a bug in Apollo Router’s cache retrieval logic: When this defect is present and distributed query planning caching is enabled, asking the Router to execute an operation (whether it is a query, a mutation, or a subscription) may result in an unexpected variation of that operation being executed or the generation of unexpected errors. The issue stems from inadvertently executing a modified version of a previously executed operation, whose query plan is stored in the underlying cache (specifically, Redis). Depending on the type of the operation, the result may vary. For a query, results may be fetched that don’t match what was requested (e.g., rather than running `fetchUsers(type: ENTERPRISE)` the Router may run `fetchUsers(type: TRIAL)`. For a mutation, this may result in incorrect mutations being sent to underlying subgraph servers (e.g., rather than sending `deleteUser(id: 10)` to a subgraph, the Router may run `deleteUser(id: 12)`. Users who are using distributed query plan caching, are advised to either upgrade to version 1.45.1 or above or downgrade to version 1.43.2 of the Apollo Router. Apollo Router versions 1.44.0 or 1.45.0 are not recommended for use and have been withdrawn. Users unable to upgrade can disable distributed query plan caching to mitigate this issue.
Severity: nan (CVSS v3 base score: )
Weakness: NVD-CWE-noinfo \u2014 Insufficient Information
There is insufficient information about the issue to classify it; details are unkown or unspecified.
Repository: https://github.com/apollographql/router
Files changed:
.circleci/config.yml
CHANGELOG.md
Cargo.lock
apollo-router-benchmarks/Cargo.toml
apollo-router-scaffold/Cargo.toml
apollo-router-scaffold/templates/base/Cargo.toml
apollo-router-scaffold/templates/base/xtask/Cargo.toml
apollo-router/Cargo.toml
apollo-router/src/plugins/progressive_override/snapshots/apollo_router__plugins__progressive_override__tests__non_overridden_field_yields_expected_query_plan.snap
apollo-router/src/plugins/progressive_override/snapshots/apollo_router__plugins__progressive_override__tests__overridden_field_yields_expected_query_plan.snap
apollo-router/src/plugins/snapshots/apollo_router__plugins__expose_query_plan__tests__it_expose_query_plan-2.snap
apollo-router/src/plugins/snapshots/apollo_router__plugins__expose_query_plan__tests__it_expose_query_plan.snap
apollo-router/src/plugins/telemetry/apollo_exporter.rs
apollo-router/src/plugins/telemetry/tracing/datadog.rs
apollo-router/src/query_planner/bridge_query_planner.rs
apollo-router/src/query_planner/caching_query_planner.rs
apollo-router/src/query_planner/fetch.rs
apollo-router/src/query_planner/plan.rs
apollo-router/src/query_planner/snapshots/apollo_router__query_planner__bridge_query_planner__tests__plan_root.snap
apollo-router/src/spec/query.rs
apollo-router/src/spec/query/change.rs
apollo-router/tests/integration/redis.rs
apollo-router/tests/integration/snapshots/integration_tests__integration__redis__test__query_planner.snap
dockerfiles/tracing/docker-compose.datadog.yml
dockerfiles/tracing/docker-compose.jaeger.yml
dockerfiles/tracing/docker-compose.zipkin.yml
helm/chart/router/Chart.yaml
helm/chart/router/README.md
licenses.html
scripts/install.sh
Commit message: release: v1.45.1 (#5009)



Vulnerable code:
      xcode: 14.2
      xcode: 14.2
            TARGET_BRANCH=$(git rev-parse --abbrev-ref origin/HEAD)    
                  docker save -o built-containers/router_${VERSION}.tar ${ROUTER_TAG}:${VERSION}  
                 
          # Toggle off to prevent any CI failures OR 
          # contact Apollo's Security team to adjust what violates the 
  
version = "1.45.0"
version = "1.45.0"
version = "1.45.0"
version = "1.45.0"
version = "1.45.0"
apollo-router = "1.45.0"
apollo-router-scaffold = { git = "https://github.com/apollographql/router.git", tag = "v1.45.0" }
version = "1.45.0"
          "schemaAwareHash": "9358047754b11522aac502a3c6a668cd4286c07d489680834e63d6e033db4eb5",
              "schemaAwareHash": "8f445761c0bcdda90b8da35ccd13fd98e474514f3efc071bd2c39495b5af94e5",
                "schemaAwareHash": "9a1feab7ee8c57c8a4ab4db29712412a9cfe94009bfcb40dc0d22ea54c410865",
              "schemaAwareHash": "34be619a78867ab9d0670048f4c93574e38cd9253e9cc032f567078355b25086",
                "schemaAwareHash": "f1582d942020b23347d84f6ae46c018492ae7c59c9b1472e0b442121ddf16368",
                    "schemaAwareHash": "6fa5a74c5af2b18f343e9e69bbcbc9335e9faaa46c3d8964d199002dfeb0026f",
                    "schemaAwareHash": "6fa5a74c5af2b18f343e9e69bbcbc9335e9faaa46c3d8964d199002dfeb0026f",
              "schemaAwareHash": "34be619a78867ab9d0670048f4c93574e38cd9253e9cc032f567078355b25086",
                "schemaAwareHash": "f1582d942020b23347d84f6ae46c018492ae7c59c9b1472e0b442121ddf16368",
                    "schemaAwareHash": "6fa5a74c5af2b18f343e9e69bbcbc9335e9faaa46c3d8964d199002dfeb0026f",
                    "schemaAwareHash": "6fa5a74c5af2b18f343e9e69bbcbc9335e9faaa46c3d8964d199002dfeb0026f",

#[cfg(not(windows))] // git checkout converts \n to \r\n, making == below fail
#[test]
fn check_reports_proto_is_up_to_date() {
    let proto_url = "https://usage-reporting.api.apollographql.com/proto/reports.proto";
    let response = reqwest::blocking::get(proto_url).unwrap();
    let content = response.text().unwrap();
    // Not using assert_eq! as printing the entire file would be too verbose
    assert!(
        content == include_str!("proto/reports.proto"),
        "Protobuf file is out of date. Run this command to update it:\n\n    \
            curl -f {proto_url} > apollo-router/src/plugins/telemetry/proto/reports.proto\n\n"
    );
}
        map.insert("subgraph", "apollo.subgraph.name");
                plan.data.query_plan.hash_subqueries(&self.subgraph_schemas);
            let schema = &this.schema.api_schema().definitions;
            match add_defer_labels(schema, &doc.ast) {
                        .to_executable_validate(schema)
                        schema,
    fn hash_subqueries(&mut self, schemas: &HashMap<String, Arc<Valid<apollo_compiler::Schema>>>) {
            node.hash_subqueries(schemas);
    pub(crate) fn hash_subquery(&mut self, schema: &Valid<apollo_compiler::Schema>) {
        if let Ok(hash) = QueryHashVisitor::hash_query(schema, &doc, self.operation_name.as_deref())
        {
                    fetch_node.hash_subquery(schema);
                    node.hash_subqueries(schemas);
                    node.hash_subqueries(schemas);
            PlanNode::Flatten(flatten) => flatten.node.hash_subqueries(schemas),
                    node.hash_subqueries(schemas);
                        new_node.hash_subqueries(schemas);
                    node.hash_subqueries(schemas);
                    node.hash_subqueries(schemas);
                    node.hash_subqueries(schemas);
            "68a86d7602ea2876e77b84d7942f585ef6b6101887bb2979d1f0af3b28c9a0ed",
        let schema = &schema.api_schema().definitions;
        let executable_document = match ast.to_executable_validate(schema) {
        let hash = QueryHashVisitor::hash_query(schema, &executable_document, operation_name)
            .map_err(|e| SpecError::QueryHashing(e.to_string()))?;
        let mut visitor = QueryHashVisitor::new(&schema.definitions, document);
        let mut visitor = QueryHashVisitor::new(schema, executable);
    fn hash(schema: &str, query: &str) -> String {
        let schema = Schema::parse(schema, "schema.graphql")
        let mut visitor = QueryHashVisitor::new(&schema, &exec);
        hex::encode(visitor.finish())
    fn hash_subgraph_query(schema: &str, query: &str) -> String {
        let schema = Valid::assume_valid(Schema::parse(schema, "schema.graphql").unwrap());
        let mut visitor = QueryHashVisitor::new(&schema, &exec);
        assert_eq!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_eq!(hash(schema1, query), hash(schema2, query));
        assert_ne!(
            hash(schema1, "query { me { id name } }"),
            hash(schema1, "query { me { name id } }")
        );
        assert_eq!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_eq!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        assert_ne!(hash(schema1, query), hash(schema2, query));
        let known_cache_key = "plan:v2.7.2:af1ee357bc75cfbbcc6adda41089a56e7d1d52f6d44c049739dde2c259314f58:3973e022e93220f9212c18d0d0c543ae7c309e46640da93a4a0314de999f5112:2bf7810d3a47b31d8a77ebb09cdc784a3f77306827dc55b06770030a858167c7";
        let config = RedisConfig::from_url("redis://127.0.0.1:6379")?;
        client.wait_for_connect().await?;
            }))?
            .await?;
            .build()?;
        let _ = supergraph.oneshot(request).await?.next_response().await;
            }))?
            .await?;
            .build()?;
        let _ = supergraph.oneshot(request).await?.next_response().await;
        client.quit().await?;
        let config = RedisConfig::from_url("redis://127.0.0.1:6379")?;
        client.wait_for_connect().await?;
            .configuration_json(config.clone())?
            .await?;
            .build()?
            .await?
            .unwrap()?;
            .build()?
            .await?
            .unwrap()?;
            .configuration_json(config.clone())?
            .await?;
            .build()?
            .await?
            .unwrap()?;
        client.quit().await?;
        let config = RedisConfig::from_url("redis://127.0.0.1:6379")?;
        client.wait_for_connect().await?;
            }))?
            .build()?;
            .await?
          .get("subgraph:products:Query:07bd08ba4eb8b85451edd3b3aae3c3ad3dc0892d86deedde6e6d53f6415f807f:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c")
        let s: String = client.get("subgraph:reviews:Product:4911f7a9dbad8a47b8900d65547503a2f3c0359f65c0bc5652ad9b9843281f66:826d5cf03645266e30655c7475530e2d40e0d5978595b0ab16318b1ce87c0fe1:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c").await.unwrap();
            }))?
            .build()?;
            .await?
        .get("subgraph:reviews:Product:d9a4cd73308dd13ca136390c10340823f94c335b9da198d2339c886c738abf0d:826d5cf03645266e30655c7475530e2d40e0d5978595b0ab16318b1ce87c0fe1:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c")
        client.quit().await?;
        let config = RedisConfig::from_url("redis://127.0.0.1:6379")?;
        client.wait_for_connect().await?;
            }))?
            .build()?;
            .await?
          .get("subgraph:products:Query:07bd08ba4eb8b85451edd3b3aae3c3ad3dc0892d86deedde6e6d53f6415f807f:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c")
        .get("subgraph:reviews:Product:4911f7a9dbad8a47b8900d65547503a2f3c0359f65c0bc5652ad9b9843281f66:826d5cf03645266e30655c7475530e2d40e0d5978595b0ab16318b1ce87c0fe1:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c")
            .build()?;
            .await?
          .get("subgraph:reviews:Product:4911f7a9dbad8a47b8900d65547503a2f3c0359f65c0bc5652ad9b9843281f66:c75297b98da101021e30020db99a3a11c2f9ac2008de94ce410c47940162e304:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c")
            .build()?;
            .await?
        client.quit().await?;
  "schemaAwareHash": "af1ee357bc75cfbbcc6adda41089a56e7d1d52f6d44c049739dde2c259314f58",
    image: ghcr.io/apollographql/router:v1.45.0
    image: ghcr.io/apollographql/router:v1.45.0
    image: ghcr.io/apollographql/router:v1.45.0
version: 1.45.0
appVersion: "v1.45.0"
![Version: 1.45.0](https://img.shields.io/badge/Version-1.45.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.45.0](https://img.shields.io/badge/AppVersion-v1.45.0-informational?style=flat-square)
helm pull oci://ghcr.io/apollographql/helm-charts/router --version 1.45.0
helm upgrade --install [RELEASE_NAME] oci://ghcr.io/apollographql/helm-charts/router --version 1.45.0 --values my-values.yaml
            <li><a href="#Apache-2.0">Apache License 2.0</a> (508)</li>
</pre>
            </li>
            <li class="license">
                <h3 id="Apache-2.0">Apache License 2.0</h3>
                <h4>Used by:</h4>
                <ul class="license-used-by">
                    <li><a href=" https://github.com/yoshuawuyts/kv-log-macro ">kv-log-macro</a></li>
                </ul>
                <pre class="license-text">                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      &quot;License&quot; shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      &quot;Licensor&quot; shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      &quot;Legal Entity&quot; shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      &quot;control&quot; means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      &quot;You&quot; (or &quot;Your&quot;) shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      &quot;Source&quot; form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      &quot;Object&quot; form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      &quot;Work&quot; shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      &quot;Derivative Works&quot; shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      &quot;Contribution&quot; shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, &quot;submitted&quot;
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as &quot;Not a Contribution.&quot;

      &quot;Contributor&quot; shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a &quot;NOTICE&quot; text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an &quot;AS IS&quot; BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   Copyright 2019 Yoshua Wuyts

   Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
                    <li><a href=" https://github.com/smol-rs/async-channel ">async-channel</a></li>
                    <li><a href=" https://github.com/smol-rs/async-executor ">async-executor</a></li>
                    <li><a href=" https://github.com/Keruspe/async-global-executor ">async-global-executor</a></li>
                    <li><a href=" https://github.com/smol-rs/async-io ">async-io</a></li>
                    <li><a href=" https://github.com/smol-rs/async-io ">async-io</a></li>
                    <li><a href=" https://github.com/smol-rs/async-lock ">async-lock</a></li>
                    <li><a href=" https://github.com/smol-rs/async-lock ">async-lock</a></li>
                    <li><a href=" https://github.com/smol-rs/async-process ">async-process</a></li>
                    <li><a href=" https://github.com/smol-rs/async-signal ">async-signal</a></li>
                    <li><a href=" https://github.com/async-rs/async-std ">async-std</a></li>
                    <li><a href=" https://github.com/smol-rs/async-task ">async-task</a></li>
                    <li><a href=" https://github.com/smol-rs/atomic-waker ">atomic-waker</a></li>
                    <li><a href=" https://github.com/smol-rs/blocking ">blocking</a></li>
                    <li><a href=" https://github.com/smol-rs/event-listener ">event-listener</a></li>
                    <li><a href=" https://github.com/smol-rs/event-listener ">event-listener</a></li>
                    <li><a href=" https://github.com/smol-rs/event-listener ">event-listener-strategy</a></li>
                    <li><a href=" https://github.com/smol-rs/futures-lite ">futures-lite</a></li>
                    <li><a href=" https://github.com/sunfishcode/io-lifetimes ">io-lifetimes</a></li>
                    <li><a href=" https://github.com/sunfishcode/linux-raw-sys ">linux-raw-sys</a></li>
                    <li><a href=" https://github.com/notgull/piper ">piper</a></li>
                    <li><a href=" https://github.com/smol-rs/polling ">polling</a></li>
                    <li><a href=" https://github.com/bytecodealliance/rustix ">rustix</a></li>
                    <li><a href=" https://github.com/rust-lang/socket2 ">socket2</a></li>
                    <li><a href=" https://github.com/sval-rs/value-bag ">value-bag</a></li>
                    <li><a href=" https://github.com/smol-rs/polling ">polling</a></li>
                    <li><a href=" https://github.com/rustwasm/gloo/tree/master/crates/timers ">gloo-timers</a></li>
PACKAGE_VERSION="v1.45.0"

Fixed code:
      xcode: "14.2.0"
      xcode: "14.2.0"
            TARGET_BRANCH=$(git rev-parse --abbrev-ref origin/HEAD)
                  docker save -o built-containers/router_${VERSION}.tar ${ROUTER_TAG}:${VERSION}

          # Toggle off to prevent any CI failures OR
          # contact Apollo's Security team to adjust what violates the

# [1.45.1] - 2024-04-26

## 🐛 Fixes

### Correct v1.44.0 regression in query plan cache ([PR #5028](https://github.com/apollographql/router/pull/5028))

Correct a critical regression that was introduced in [v1.44.0](https://github.com/apollographql/router/pull/4883) which could lead to execution of an incorrect query plan.

By [@o0Ignition0o](https://github.com/o0Ignition0o) in https://github.com/apollographql/router/pull/5028

### Use entire schema when hashing an introspection query ([Issue #5006](https://github.com/apollographql/router/issues/5006))

Correct a _different_ hashing bug which impacted introspection queries which was also introduced in [v1.44.0](https://github.com/apollographql/router/pull/4883).  This other hashing bug failed to account for introspection queries, resulting in introspection results being misaligned to the current schema. 

This release fixes the hashing mechanism by adding the schema string to hashed data if an introspection field is encountered. As a result, the entire schema is taken into account and the correct introspection result is returned.

By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/5007

### Fix subgraph name mapping of Datadog exporter ([PR #5012](https://github.com/apollographql/router/pull/5012))

Previously in the router v1.45.0, subgraph name mapping didn't work correctly in the router's Datadog exporter. The exporter used the incorrect value `apollo.subgraph.name` for mapping attributes when it should have used the value `subgraph.name`. This issue has been fixed in this release.

By [@garypen](https://github.com/garypen) in https://github.com/apollographql/router/pull/5012


> **Warning**
>
> **This version has a critical bug impacting all users.  See the _Fixes_ in [v1.45.1](https://github.com/apollographql/router/releases/tag/v1.45.1) for details.  We highly recommend using v1.45.1 or v1.43.2 over v1.45.0.**

> **Warning**
>
> **This version has a critical bug impacting all users.  See the _Fixes_ in [v1.45.1](https://github.com/apollographql/router/releases/tag/v1.45.1) for details.  We highly recommend using v1.45.1 or v1.43.2 over v1.44.0.**


version = "1.45.1"
version = "1.45.1"
version = "1.45.1"
version = "1.45.1"
version = "1.45.1"
apollo-router = "1.45.1"
apollo-router-scaffold = { git = "https://github.com/apollographql/router.git", tag = "v1.45.1" }
version = "1.45.1"
          "schemaAwareHash": "12dda6193654ae4fe6e38bc09d4f81cc73d0c9e098692096f72d2158eef4776f",
              "schemaAwareHash": "00ad582ea45fc1bce436b36b21512f3d2c47b74fdbdc61e4b349289722c9ecf2",
                "schemaAwareHash": "a8ebdc2151a2e5207882e43c6906c0c64167fd9a8e0c7c4becc47736a5105096",
              "schemaAwareHash": "7245d488e97c3b2ac9f5fa4dd4660940b94ad81af070013305b2c0f76337b2f9",
                "schemaAwareHash": "6e0b4156706ea0cf924500cfdc99dd44b9f0ed07e2d3f888d4aff156e6a33238",
                    "schemaAwareHash": "ff649f3d70241d5a8cd5f5d03ff4c41ecff72b0e4129a480207b05ac92318042",
                    "schemaAwareHash": "bf9f3beda78a7a565e47c862157bad4ec871d724d752218da1168455dddca074",
              "schemaAwareHash": "7245d488e97c3b2ac9f5fa4dd4660940b94ad81af070013305b2c0f76337b2f9",
                "schemaAwareHash": "6e0b4156706ea0cf924500cfdc99dd44b9f0ed07e2d3f888d4aff156e6a33238",
                    "schemaAwareHash": "ff649f3d70241d5a8cd5f5d03ff4c41ecff72b0e4129a480207b05ac92318042",
                    "schemaAwareHash": "bf9f3beda78a7a565e47c862157bad4ec871d724d752218da1168455dddca074",
        map.insert("subgraph", "subgraph.name");
                plan.data
                    .query_plan
                    .hash_subqueries(&self.subgraph_schemas, &self.schema.raw_sdl);
            let api_schema = this.schema.api_schema();
            let api_schema_definitions = &api_schema.definitions;
            match add_defer_labels(api_schema_definitions, &doc.ast) {
                        .to_executable_validate(api_schema_definitions)
                        // Assume transformation creates a valid document: ignore conversion errors
                        api_schema_definitions,
                        &api_schema.raw_sdl,
                &self.schema.raw_sdl,
    fn hash_subqueries(
        &mut self,
        schemas: &HashMap<String, Arc<Valid<apollo_compiler::Schema>>>,
        supergraph_schema_hash: &str,
    ) {
            node.hash_subqueries(schemas, supergraph_schema_hash);
                            ..
                sdl: Arc::clone(&self.schema.raw_sdl),
            sdl: Arc::clone(&self.schema.raw_sdl),
    pub(crate) sdl: Arc<String>,
        hasher.update(&serde_json::to_vec(&self.sdl).expect("serialization should not fail"));
    pub(crate) fn hash_subquery(
        &mut self,
        schema: &Valid<apollo_compiler::Schema>,
        supergraph_schema_hash: &str,
    ) {
        if let Ok(hash) = QueryHashVisitor::hash_query(
            schema,
            supergraph_schema_hash,
            &doc,
            self.operation_name.as_deref(),
        ) {
        supergraph_schema_hash: &str,
                    fetch_node.hash_subquery(schema, supergraph_schema_hash);
                    node.hash_subqueries(schemas, supergraph_schema_hash);
                    node.hash_subqueries(schemas, supergraph_schema_hash);
            PlanNode::Flatten(flatten) => flatten
                .node
                .hash_subqueries(schemas, supergraph_schema_hash),
                    node.hash_subqueries(schemas, supergraph_schema_hash);
                        new_node.hash_subqueries(schemas, supergraph_schema_hash);
                    node.hash_subqueries(schemas, supergraph_schema_hash);
                    node.hash_subqueries(schemas, supergraph_schema_hash);
                    node.hash_subqueries(schemas, supergraph_schema_hash);
            "a4ab3ffe0fd7863aea8cd1e85d019d2c64ec0351d62f9759bed3c9dc707ea315",
        let api_schema = schema.api_schema();
        let api_schema_definitions = &api_schema.definitions;
        let executable_document = match ast.to_executable_validate(api_schema_definitions) {
        let hash = QueryHashVisitor::hash_query(
            api_schema_definitions,
            &api_schema.raw_sdl,
            &executable_document,
            operation_name,
        )
        .map_err(|e| SpecError::QueryHashing(e.to_string()))?;

        let mut visitor = QueryHashVisitor::new(&schema.definitions, &schema.raw_sdl, document);
    // TODO: remove once introspection has been moved out of query planning
    // For now, introspection is stiull handled by the planner, so when an
    // introspection query is hashed, it should take the whole schema into account
    schema_str: &'a str,
    seen_introspection: bool,
        schema_str: &'a str,
            schema_str,
            seen_introspection: false,
        schema_str: &'a str,
        let mut visitor = QueryHashVisitor::new(schema, schema_str, executable);
        executable.to_string().hash(&mut visitor);
        if !self.seen_introspection && (field_def.name == "__schema" || field_def.name == "__type")
        {
            self.seen_introspection = true;
            self.schema_str.hash(self);
        }

    #[derive(Debug)]
    struct HashComparator {
        from_visitor: String,
        from_hash_query: String,
    }

    impl From<(String, String)> for HashComparator {
        fn from(value: (String, String)) -> Self {
            Self {
                from_visitor: value.0,
                from_hash_query: value.1,
            }
        }
    }

    // The non equality check is not the same
    // as one would expect from PartialEq.
    // This is why HashComparator doesn't implement it.
    impl HashComparator {
        fn equals(&self, other: &Self) -> bool {
            self.from_visitor == other.from_visitor && self.from_hash_query == other.from_hash_query
        }
        fn doesnt_match(&self, other: &Self) -> bool {
            // This is intentional, we check to prevent BOTH hashes from being equal
            self.from_visitor != other.from_visitor && self.from_hash_query != other.from_hash_query
        }
    }

    fn hash(schema_str: &str, query: &str) -> HashComparator {
        let schema = Schema::parse(schema_str, "schema.graphql")
        let mut visitor = QueryHashVisitor::new(&schema, schema_str, &exec);
        (
            hex::encode(visitor.finish()),
            hex::encode(QueryHashVisitor::hash_query(&schema, schema_str, &exec, None).unwrap()),
        )
            .into()
    fn hash_subgraph_query(schema_str: &str, query: &str) -> String {
        let schema = Valid::assume_valid(Schema::parse(schema_str, "schema.graphql").unwrap());
        let mut visitor = QueryHashVisitor::new(&schema, schema_str, &exec);
        assert!(hash(schema1, query).equals(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).equals(&hash(schema2, query)));
        assert!(hash(schema1, "query { me { id name } }")
            .doesnt_match(&hash(schema1, "query { me { name id } }")));
        assert!(hash(schema1, query).equals(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).equals(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
    }

    #[test]
    fn introspection() {
        let schema1: &str = r#"
        schema {
          query: Query
        }
    
        type Query {
          me: User
          customer: User
        }
    
        type User {
          id: ID
          name: String
        }
        "#;

        let schema2: &str = r#"
        schema {
            query: Query
        }
    
        type Query {
          me: NotUser
        }
    
    
        type NotUser {
          id: ID!
          name: String
        }
        "#;

        let query = "{ __schema { types { name } } }";

        assert!(hash(schema1, query).doesnt_match(&hash(schema2, query)));
    }

    #[test]
    fn fields_with_different_arguments_have_different_hashes() {
        let schema: &str = r#"
        schema {
          query: Query
        }
    
        type Query {
          test(arg: Int): String
        }
        "#;

        let query_one = "query { a: test(arg: 1) b: test(arg: 2) }";
        let query_two = "query { a: test(arg: 1) b: test(arg: 3) }";

        // This assertion tests an internal hash function that isn't directly
        // used for the query hash, and we'll need to make it pass to rely
        // solely on the internal function again.
        //
        // assert!(hash(schema, query_one).doesnt_match(&hash(schema,
        // query_two)));
        assert!(hash(schema, query_one).from_hash_query != hash(schema, query_two).from_hash_query);
    }

    #[test]
    fn fields_with_different_aliases_have_different_hashes() {
        let schema: &str = r#"
        schema {
          query: Query
        }
    
        type Query {
          test(arg: Int): String
        }
        "#;

        let query_one = "query { a: test }";
        let query_two = "query { b: test }";

        // This assertion tests an internal hash function that isn't directly
        // used for the query hash, and we'll need to make it pass to rely
        // solely on the internal function again.
        //
        // assert!(hash(schema, query_one).doesnt_match(&hash(schema, query_two)));
        assert!(hash(schema, query_one).from_hash_query != hash(schema, query_two).from_hash_query);
        let known_cache_key = "plan:v2.7.2:121b9859eba2d8fa6dde0a54b6e3781274cf69f7ffb0af912e92c01c6bfff6ca:3973e022e93220f9212c18d0d0c543ae7c309e46640da93a4a0314de999f5112:5c7a72fa35639949328548d77b56dba2e77d0dfa90c19b69978da119e996bb92";
        let config = RedisConfig::from_url("redis://127.0.0.1:6379").unwrap();
        client.wait_for_connect().await.unwrap();
            }))
            .unwrap()
            .await
            .unwrap();
            .build()
            .unwrap();
        let _ = supergraph
            .oneshot(request)
            .await
            .unwrap()
            .next_response()
            .await;
            }))
            .unwrap()
            .await
            .unwrap();
            .build()
            .unwrap();
        let _ = supergraph
            .oneshot(request)
            .await
            .unwrap()
            .next_response()
            .await;
        client.quit().await.unwrap();
        let config = RedisConfig::from_url("redis://127.0.0.1:6379").unwrap();
        client.wait_for_connect().await.unwrap();
            .configuration_json(config.clone())
            .unwrap()
            .await
            .unwrap();
            .build()
            .unwrap()
            .await
            .unwrap()
            .unwrap()
            .unwrap();
            .build()
            .unwrap()
            .await
            .unwrap()
            .unwrap()
            .unwrap();
            .configuration_json(config.clone())
            .unwrap()
            .await
            .unwrap();
            .build()
            .unwrap()
            .await
            .unwrap()
            .unwrap()
            .unwrap();
        client.quit().await.unwrap();
        let config = RedisConfig::from_url("redis://127.0.0.1:6379").unwrap();
        client.wait_for_connect().await.unwrap();
            }))
            .unwrap()
            .build()
            .unwrap();
            .await
            .unwrap()
          .get("subgraph:products:Query:0df945dc1bc08f7fc02e8905b4c72aa9112f29bb7a214e4a38d199f0aa635b48:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c")
        let s: String = client.get("subgraph:reviews:Product:4911f7a9dbad8a47b8900d65547503a2f3c0359f65c0bc5652ad9b9843281f66:1de543dab57fde0f00247922ccc4f76d4c916ae26a89dd83cd1a62300d0cda20:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c").await.unwrap();
            }))
            .unwrap()
            .build()
            .unwrap();
            .await
            .unwrap()
        .get("subgraph:reviews:Product:d9a4cd73308dd13ca136390c10340823f94c335b9da198d2339c886c738abf0d:1de543dab57fde0f00247922ccc4f76d4c916ae26a89dd83cd1a62300d0cda20:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c")
        client.quit().await.unwrap();
        let config = RedisConfig::from_url("redis://127.0.0.1:6379").unwrap();
        client.wait_for_connect().await.unwrap();
            }))
            .unwrap()
            .build()
            .unwrap();
            .await
            .unwrap()
          .get("subgraph:products:Query:0df945dc1bc08f7fc02e8905b4c72aa9112f29bb7a214e4a38d199f0aa635b48:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c")
        .get("subgraph:reviews:Product:4911f7a9dbad8a47b8900d65547503a2f3c0359f65c0bc5652ad9b9843281f66:1de543dab57fde0f00247922ccc4f76d4c916ae26a89dd83cd1a62300d0cda20:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c")
            .build()
            .unwrap();
            .await
            .unwrap()
          .get("subgraph:reviews:Product:4911f7a9dbad8a47b8900d65547503a2f3c0359f65c0bc5652ad9b9843281f66:3b6ef3c8fd34c469d59f513942c5f4c8f91135e828712de2024e2cd4613c50ae:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c")
            .build()
            .unwrap();
            .await
            .unwrap()
        client.quit().await.unwrap();
  "schemaAwareHash": "121b9859eba2d8fa6dde0a54b6e3781274cf69f7ffb0af912e92c01c6bfff6ca",
    image: ghcr.io/apollographql/router:v1.45.1
    image: ghcr.io/apollographql/router:v1.45.1
    image: ghcr.io/apollographql/router:v1.45.1
version: 1.45.1
appVersion: "v1.45.1"
![Version: 1.45.1](https://img.shields.io/badge/Version-1.45.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.45.1](https://img.shields.io/badge/AppVersion-v1.45.1-informational?style=flat-square)
helm pull oci://ghcr.io/apollographql/helm-charts/router --version 1.45.1
helm upgrade --install [RELEASE_NAME] oci://ghcr.io/apollographql/helm-charts/router --version 1.45.1 --values my-values.yaml
            <li><a href="#Apache-2.0">Apache License 2.0</a> (481)</li>
PACKAGE_VERSION="v1.45.1"