Skip to content

feat: pass proxy url to admission webhook#2718

Merged
wilsonrivera merged 4 commits intomainfrom
wilson/eng-9322-add-proxy-to-admission-webhook
Apr 1, 2026
Merged

feat: pass proxy url to admission webhook#2718
wilsonrivera merged 4 commits intomainfrom
wilson/eng-9322-add-proxy-to-admission-webhook

Conversation

@wilsonrivera
Copy link
Copy Markdown
Contributor

@wilsonrivera wilsonrivera commented Mar 31, 2026

Summary by CodeRabbit

  • New Features
    • Added support for configuring a webhook proxy URL across graph composition/deployment, schema checks, subgraph/monograph operations, proposals, and webhook/admission flows so webhook traffic can be routed through a proxy.
  • Chores
    • Added runtime proxy agent dependency to enable HTTP/HTTPS proxying for webhook clients.

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.
  • Documentation has been updated on https://github.com/wundergraph/docs-website.
  • I have read the Contributors Guide.

Open Source AI Manifesto

This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

Walkthrough

Threads a new optional webhookProxyUrl through controlplane handlers, repositories, Composer, schema checks, and webhook controllers; adds HTTP(S) proxy agent handling to webhook clients and a runtime dependency for an HTTP proxy agent.

Changes

Cohort / File(s) Summary
Contract handlers
controlplane/src/core/bufservices/contract/createContract.ts, controlplane/src/core/bufservices/contract/updateContract.ts
Forward opts.webhookProxyUrl into fedGraphRepo.composeAndDeployGraphs(); updateContract also forwards it into fedGraphRepo.update().
Feature-flag handlers
controlplane/src/core/bufservices/feature-flag/createFeatureFlag.ts, controlplane/src/core/bufservices/feature-flag/deleteFeatureFlag.ts, controlplane/src/core/bufservices/feature-flag/enableFeatureFlag.ts, controlplane/src/core/bufservices/feature-flag/updateFeatureFlag.ts
Pass opts.webhookProxyUrl into fedGraphRepo.composeAndDeployGraphs() on create/delete/enable/update flows.
Federated-graph handlers
controlplane/src/core/bufservices/federated-graph/createFederatedGraph.ts, controlplane/src/core/bufservices/federated-graph/migrateFromApollo.ts, controlplane/src/core/bufservices/federated-graph/moveFederatedGraph.ts, controlplane/src/core/bufservices/federated-graph/updateFederatedGraph.ts
Thread opts.webhookProxyUrl into composeAndDeployGraphs() and update()/move() call sites; moveFederatedGraph adds an inserted undefined positional arg before the proxy param.
Graph handlers
controlplane/src/core/bufservices/graph/recomposeGraph.ts, controlplane/src/core/bufservices/graph/setGraphRouterCompatibilityVersion.ts
Forward opts.webhookProxyUrl into composeAndDeployGraphs() call options.
Monograph handlers
controlplane/src/core/bufservices/monograph/publishMonograph.ts, controlplane/src/core/bufservices/monograph/updateMonograph.ts
Pass opts.webhookProxyUrl into subgraphRepo.update() and fedGraphRepo.update() calls (with undefined insertion where applicable).
Proposal handlers
controlplane/src/core/bufservices/proposal/createProposal.ts, controlplane/src/core/bufservices/proposal/updateProposal.ts
Add opts.webhookProxyUrl argument to Composer construction and include webhookProxyUrl in schemaCheckRepo.checkMultipleSchemas() options.
Subgraph handlers
controlplane/src/core/bufservices/subgraph/checkSubgraphSchema.ts, controlplane/src/core/bufservices/subgraph/deleteFederatedSubgraph.ts, controlplane/src/core/bufservices/subgraph/fixSubgraphSchema.ts, controlplane/src/core/bufservices/subgraph/moveSubgraph.ts, controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts, controlplane/src/core/bufservices/subgraph/updateSubgraph.ts
Propagate opts.webhookProxyUrl into performSchemaCheck(), subgraphRepo.update(), subgraphRepo.move() and Composer calls used by schema/check flows.
Composition and services
controlplane/src/core/composition/composer.ts, controlplane/src/core/services/AdmissionWebhookController.ts
Composer gains optional proxyUrl parameter; AdmissionWebhookController accepts proxyUrl, attempts to construct HttpProxyAgent/HttpsProxyAgent, sets Axios httpAgent/httpsAgent and proxy: false, and logs on agent creation failure.
Repositories
controlplane/src/core/repositories/FederatedGraphRepository.ts, controlplane/src/core/repositories/SubgraphRepository.ts, controlplane/src/core/repositories/SchemaCheckRepository.ts
Extend method signatures (update, move, composeAndDeployGraphs, performSchemaCheck, checkMultipleSchemas) to accept optional webhookProxyUrl and forward it into Composer/compose/deploy and schema check flows.
Webhook service & deps
controlplane/src/core/webhooks/OrganizationWebhookService.ts, controlplane/package.json
Configure separate httpAgent and httpsAgent using http-proxy-agent and https-proxy-agent; set Axios proxy: false; add http-proxy-agent@8.0.0 dependency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: pass proxy url to admission webhook' directly aligns with the primary objective and implementation: threading the webhookProxyUrl through the codebase to configure proxy behavior in the AdmissionWebhookController.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@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)
controlplane/src/core/bufservices/monograph/publishMonograph.ts (1)

159-160: Consider replacing sentinel undefined positional args with an options object.

Line 159 uses undefined only to reach the new webhookProxyUrl positional parameter. This is easy to break on future signature changes. A single options object (or overload) for trailing optional params would make call sites safer.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@controlplane/src/core/bufservices/monograph/publishMonograph.ts` around lines
159 - 160, The call in publishMonograph.ts is using a sentinel undefined to skip
a positional parameter (currently passing "undefined, opts.webhookProxyUrl");
change the call to pass a single options object (e.g. { webhookProxyUrl:
opts.webhookProxyUrl }) instead and update the callee's signature to accept an
options parameter (or overload) so trailing optional parameters are named
properties; specifically modify the function that is being invoked at this call
site to accept and destructure an options object (including webhookProxyUrl) and
update all call sites accordingly to remove the fragile undefined placeholder.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@controlplane/src/core/services/AdmissionWebhookController.ts`:
- Around line 45-57: The proxy agent setup currently uses HttpsProxyAgent for
both protocols and swallows initialization errors; update the initialization to
create two agents—an HttpProxyAgent for plain HTTP and an HttpsProxyAgent for
HTTPS—using the provided proxyUrl, and if construction fails throw the error
instead of just logging (refer to the existing agent variable creation and
try/catch around new HttpsProxyAgent). Then pass both agents into axios.create
as httpAgent and httpsAgent respectively, set proxy: false in the axios config,
and ensure any caught exceptions during agent creation are re-thrown so the
service fails fast.

---

Nitpick comments:
In `@controlplane/src/core/bufservices/monograph/publishMonograph.ts`:
- Around line 159-160: The call in publishMonograph.ts is using a sentinel
undefined to skip a positional parameter (currently passing "undefined,
opts.webhookProxyUrl"); change the call to pass a single options object (e.g. {
webhookProxyUrl: opts.webhookProxyUrl }) instead and update the callee's
signature to accept an options parameter (or overload) so trailing optional
parameters are named properties; specifically modify the function that is being
invoked at this call site to accept and destructure an options object (including
webhookProxyUrl) and update all call sites accordingly to remove the fragile
undefined placeholder.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a15adbe4-4833-4813-bad4-6eff37dce94e

📥 Commits

Reviewing files that changed from the base of the PR and between 1a182a7 and 51f1d9f.

📒 Files selected for processing (27)
  • controlplane/src/core/bufservices/contract/createContract.ts
  • controlplane/src/core/bufservices/contract/updateContract.ts
  • controlplane/src/core/bufservices/feature-flag/createFeatureFlag.ts
  • controlplane/src/core/bufservices/feature-flag/deleteFeatureFlag.ts
  • controlplane/src/core/bufservices/feature-flag/enableFeatureFlag.ts
  • controlplane/src/core/bufservices/feature-flag/updateFeatureFlag.ts
  • controlplane/src/core/bufservices/federated-graph/createFederatedGraph.ts
  • controlplane/src/core/bufservices/federated-graph/migrateFromApollo.ts
  • controlplane/src/core/bufservices/federated-graph/moveFederatedGraph.ts
  • controlplane/src/core/bufservices/federated-graph/updateFederatedGraph.ts
  • controlplane/src/core/bufservices/graph/recomposeGraph.ts
  • controlplane/src/core/bufservices/graph/setGraphRouterCompatibilityVersion.ts
  • controlplane/src/core/bufservices/monograph/publishMonograph.ts
  • controlplane/src/core/bufservices/monograph/updateMonograph.ts
  • controlplane/src/core/bufservices/proposal/createProposal.ts
  • controlplane/src/core/bufservices/proposal/updateProposal.ts
  • controlplane/src/core/bufservices/subgraph/checkSubgraphSchema.ts
  • controlplane/src/core/bufservices/subgraph/deleteFederatedSubgraph.ts
  • controlplane/src/core/bufservices/subgraph/fixSubgraphSchema.ts
  • controlplane/src/core/bufservices/subgraph/moveSubgraph.ts
  • controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts
  • controlplane/src/core/bufservices/subgraph/updateSubgraph.ts
  • controlplane/src/core/composition/composer.ts
  • controlplane/src/core/repositories/FederatedGraphRepository.ts
  • controlplane/src/core/repositories/SchemaCheckRepository.ts
  • controlplane/src/core/repositories/SubgraphRepository.ts
  • controlplane/src/core/services/AdmissionWebhookController.ts

@wilsonrivera wilsonrivera requested review from a team as code owners March 31, 2026 20:57
@wilsonrivera wilsonrivera requested a review from devsergiy March 31, 2026 20:57
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 79.71014% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.96%. Comparing base (8529b07) to head (addff64).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ne/src/core/services/AdmissionWebhookController.ts 50.00% 7 Missing ⚠️
...ne/src/core/webhooks/OrganizationWebhookService.ts 71.42% 2 Missing ⚠️
...e/bufservices/federated-graph/migrateFromApollo.ts 0.00% 1 Missing ⚠️
...rvices/graph/setGraphRouterCompatibilityVersion.ts 0.00% 1 Missing ⚠️
.../src/core/bufservices/monograph/updateMonograph.ts 66.66% 1 Missing ⚠️
...src/core/bufservices/subgraph/fixSubgraphSchema.ts 0.00% 1 Missing ⚠️
...ane/src/core/repositories/SchemaCheckRepository.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2718       +/-   ##
===========================================
- Coverage   63.14%   46.96%   -16.18%     
===========================================
  Files         249     1052      +803     
  Lines       26661   143453   +116792     
  Branches        0     9626     +9626     
===========================================
+ Hits        16835    67377    +50542     
- Misses       8449    74330    +65881     
- Partials     1377     1746      +369     
Files with missing lines Coverage Δ
...ne/src/core/bufservices/contract/createContract.ts 76.28% <100.00%> (ø)
...ne/src/core/bufservices/contract/updateContract.ts 78.24% <100.00%> (ø)
...core/bufservices/feature-flag/createFeatureFlag.ts 82.32% <100.00%> (ø)
...core/bufservices/feature-flag/deleteFeatureFlag.ts 83.03% <100.00%> (ø)
...core/bufservices/feature-flag/enableFeatureFlag.ts 76.47% <100.00%> (ø)
...core/bufservices/feature-flag/updateFeatureFlag.ts 81.46% <100.00%> (ø)
...ufservices/federated-graph/createFederatedGraph.ts 72.54% <100.00%> (ø)
.../bufservices/federated-graph/moveFederatedGraph.ts 85.23% <100.00%> (ø)
...ufservices/federated-graph/updateFederatedGraph.ts 84.69% <100.00%> (ø)
...plane/src/core/bufservices/graph/recomposeGraph.ts 80.57% <100.00%> (ø)
... and 18 more

... and 789 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-5b2852e4d49874dcdf471b1cbbb6b8a5802db0f2

Copy link
Copy Markdown
Contributor

@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

♻️ Duplicate comments (1)
controlplane/src/core/services/AdmissionWebhookController.ts (1)

49-54: ⚠️ Potential issue | 🟠 Major

Do not continue without proxy after proxy initialization failure.

Line 53 only logs and continues. With proxyUrl configured, this should throw (fail closed) so admission requests don’t silently bypass expected network controls.

Suggested fix
     if (proxyUrl) {
       try {
         httpAgent = new HttpProxyAgent(proxyUrl, {});
         httpsAgent = new HttpsProxyAgent(proxyUrl, {});
       } catch (e) {
-        logger.error(e, 'Failed to create proxy agent');
+        logger.error(e, 'Failed to create proxy agent');
+        throw new AdmissionError('Invalid webhook proxy URL configuration', e as Error);
       }
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@controlplane/src/core/services/AdmissionWebhookController.ts` around lines 49
- 54, The proxy agent creation swallows errors and continues, allowing requests
to bypass expected proxy controls; in the AdmissionWebhookController where
proxyUrl is used to construct HttpProxyAgent/HttpsProxyAgent, detect when
proxyUrl is configured and the agent constructors throw, log the error via
logger.error as now and then rethrow the exception (or throw a new Error) so
initialization fails fast instead of continuing; ensure the try/catch around new
HttpProxyAgent(proxyUrl, {}) and new HttpsProxyAgent(proxyUrl, {}) either lets
the error propagate or explicitly throws after logging to prevent the controller
from starting without a working proxy.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@controlplane/src/core/webhooks/OrganizationWebhookService.ts`:
- Around line 141-147: If a proxyUrl is provided but
HttpProxyAgent/HttpsProxyAgent creation fails, do not continue; after catching
the error in the proxy initialization block (where proxyUrl, httpAgent,
httpsAgent are set and HttpProxyAgent/HttpsProxyAgent are constructed) log the
error with logger.error and then rethrow or throw a new Error to abort
construction so requests cannot bypass the proxy (ensure the thrown error
includes the original error details).

---

Duplicate comments:
In `@controlplane/src/core/services/AdmissionWebhookController.ts`:
- Around line 49-54: The proxy agent creation swallows errors and continues,
allowing requests to bypass expected proxy controls; in the
AdmissionWebhookController where proxyUrl is used to construct
HttpProxyAgent/HttpsProxyAgent, detect when proxyUrl is configured and the agent
constructors throw, log the error via logger.error as now and then rethrow the
exception (or throw a new Error) so initialization fails fast instead of
continuing; ensure the try/catch around new HttpProxyAgent(proxyUrl, {}) and new
HttpsProxyAgent(proxyUrl, {}) either lets the error propagate or explicitly
throws after logging to prevent the controller from starting without a working
proxy.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 899c8c72-b671-4582-8d8f-0d778fe471e3

📥 Commits

Reviewing files that changed from the base of the PR and between 51f1d9f and b8f4a75.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • controlplane/package.json
  • controlplane/src/core/services/AdmissionWebhookController.ts
  • controlplane/src/core/webhooks/OrganizationWebhookService.ts
✅ Files skipped from review due to trivial changes (1)
  • controlplane/package.json

Copy link
Copy Markdown
Contributor

@StarpTech StarpTech left a comment

Choose a reason for hiding this comment

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

LGTM

@wilsonrivera wilsonrivera merged commit bcb4ed3 into main Apr 1, 2026
54 checks passed
@wilsonrivera wilsonrivera deleted the wilson/eng-9322-add-proxy-to-admission-webhook branch April 1, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants