diff --git a/Cargo.lock b/Cargo.lock index e8256f21..d74d554f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1882,7 +1882,7 @@ dependencies = [ "thegraph", "thiserror", "tokio", - "toolshed 0.5.0 (git+https://github.com/edgeandnode/toolshed?tag=toolshed-v0.5.0)", + "toolshed", "tracing", "tracing-subscriber", ] @@ -1935,7 +1935,7 @@ dependencies = [ [[package]] name = "graph-gateway" -version = "16.1.2" +version = "16.1.3" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -1952,7 +1952,7 @@ dependencies = [ "gateway-framework", "graph-subscriptions", "graphql 0.3.0", - "graphql-http", + "graphql-http 0.1.1 (git+https://github.com/edgeandnode/toolshed?branch=main)", "hex", "hyper", "indexer-selection", @@ -1978,7 +1978,7 @@ dependencies = [ "thegraph", "thiserror", "tokio", - "toolshed 0.5.0 (git+https://github.com/edgeandnode/toolshed?tag=toolshed-v0.5.0)", + "toolshed", "tower", "tower-http", "tracing", @@ -2022,6 +2022,19 @@ dependencies = [ "serde", ] +[[package]] +name = "graphql-http" +version = "0.1.1" +source = "git+https://github.com/edgeandnode/toolshed?tag=toolshed-v0.5.0#211f7d7c4ede10f35b6ebd123a4d3ec8342c9f5e" +dependencies = [ + "anyhow", + "async-trait", + "reqwest", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "graphql-http" version = "0.1.1" @@ -2372,7 +2385,7 @@ dependencies = [ "siphasher 1.0.0", "thegraph", "tokio", - "toolshed 0.5.0 (git+https://github.com/edgeandnode/toolshed?tag=toolshed-v0.5.0)", + "toolshed", "tracing", "tracing-subscriber", ] @@ -4767,7 +4780,7 @@ dependencies = [ [[package]] name = "thegraph" version = "0.2.0" -source = "git+https://github.com/edgeandnode/toolshed?branch=main#89bcc61b5ed9c2001bb8556b08e6f481afad9d42" +source = "git+https://github.com/edgeandnode/toolshed?tag=toolshed-v0.5.0#211f7d7c4ede10f35b6ebd123a4d3ec8342c9f5e" dependencies = [ "alloy-chains", "alloy-primitives", @@ -4777,7 +4790,7 @@ dependencies = [ "bs58", "ethers", "ethers-core", - "graphql-http", + "graphql-http 0.1.1 (git+https://github.com/edgeandnode/toolshed?tag=toolshed-v0.5.0)", "indoc", "lazy_static", "reqwest", @@ -4787,7 +4800,7 @@ dependencies = [ "serde_with 3.4.0", "sha3", "thiserror", - "toolshed 0.5.0 (git+https://github.com/edgeandnode/toolshed?branch=main)", + "toolshed", "tracing", ] @@ -5006,15 +5019,6 @@ dependencies = [ "url", ] -[[package]] -name = "toolshed" -version = "0.5.0" -source = "git+https://github.com/edgeandnode/toolshed?branch=main#89bcc61b5ed9c2001bb8556b08e6f481afad9d42" -dependencies = [ - "tokio", - "url", -] - [[package]] name = "tower" version = "0.4.13" diff --git a/Cargo.toml b/Cargo.toml index accd7930..b1526b6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ lto = "thin" inherits = "release" debug = true - [workspace.dependencies] anyhow = "1.0" alloy-primitives = { version = "0.5.3", features = ["serde"] } @@ -47,7 +46,7 @@ tokio = { version = "1.24", features = [ "time", ] } toolshed = { git = "https://github.com/edgeandnode/toolshed", tag = "toolshed-v0.5.0" } -thegraph = { git = "https://github.com/edgeandnode/toolshed", branch = "main" } +thegraph = { git = "https://github.com/edgeandnode/toolshed", tag = "toolshed-v0.5.0" } tracing = { version = "0.1", default-features = false } tracing-subscriber = { version = "0.3", features = [ "env-filter", diff --git a/graph-gateway/Cargo.toml b/graph-gateway/Cargo.toml index 58592709..c29ddd83 100644 --- a/graph-gateway/Cargo.toml +++ b/graph-gateway/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "graph-gateway" -version = "16.1.2" +version = "16.1.3" [dependencies] alloy-primitives.workspace = true diff --git a/graph-gateway/src/auth/subscriptions.rs b/graph-gateway/src/auth/subscriptions.rs index c9ebdfc7..ff6bf411 100644 --- a/graph-gateway/src/auth/subscriptions.rs +++ b/graph-gateway/src/auth/subscriptions.rs @@ -6,7 +6,6 @@ use alloy_primitives::Address; use eventuals::{Eventual, Ptr}; use graph_subscriptions::subscription_tier::{SubscriptionTier, SubscriptionTiers}; use thegraph::subscriptions::auth::{parse_auth_token, verify_auth_token_claims, AuthTokenClaims}; -use thegraph::types::{DeploymentId, SubgraphId}; use tokio::sync::RwLock; use crate::subscriptions::Subscription; @@ -81,29 +80,13 @@ pub async fn check_token( deployments: &[Arc], domain: &str, ) -> anyhow::Result<()> { - // Check deployment allowlist - let allowed_deployments: Vec = auth_token - .allowed_deployments - .iter() - .flat_map(|s| s.split(',')) - .filter_map(|s| s.parse::().ok()) - .collect(); - tracing::debug!(?allowed_deployments); - - if !are_deployments_authorized(&allowed_deployments, deployments) { + tracing::debug!(allowed_deployments = ?auth_token.allowed_deployments); + if !are_deployments_authorized(&auth_token.allowed_deployments, deployments) { return Err(anyhow::anyhow!("Deployment not authorized by user")); } - // Check subgraph allowlist - let allowed_subgraphs: Vec = auth_token - .allowed_subgraphs - .iter() - .flat_map(|s| s.split(',')) - .filter_map(|s| s.parse::().ok()) - .collect(); - tracing::debug!(?allowed_subgraphs); - - if !are_subgraphs_authorized(&allowed_subgraphs, deployments) { + tracing::debug!(allowed_subgraphs = ?auth_token.allowed_subgraphs); + if !are_subgraphs_authorized(&auth_token.allowed_subgraphs, deployments) { return Err(anyhow::anyhow!("Subgraph not authorized by user")); } @@ -126,7 +109,7 @@ pub async fn check_token( return Ok(()); } - let chain_id = auth_token.chain_id.id(); + let chain_id = auth_token.chain_id(); let contract = auth_token.contract; let signer = auth_token.signer; let user = auth_token.user();