Skip to content

Prevent cross-service revision traffic routing#16294

Merged
knative-prow[bot] merged 1 commit intoknative:mainfrom
linkvt:fix-cross-service-revision-traffic
Dec 17, 2025
Merged

Prevent cross-service revision traffic routing#16294
knative-prow[bot] merged 1 commit intoknative:mainfrom
linkvt:fix-cross-service-revision-traffic

Conversation

@linkvt
Copy link
Contributor

@linkvt linkvt commented Dec 5, 2025

Fixes #11916

Services can no longer route traffic to revisions belonging to different services. When a Service-owned Route references a revision with a different serving.knative.dev/service label, the Route will show Ready=False with reason RevisionNotOwned.

Standalone Routes (not owned by a Service) are unaffected and can still reference any revision.

Changes

  • Validate revision ownership when building traffic configuration
  • New RevisionNotOwned condition reason when validation fails
  • Standalone Routes (not owned by a Service) are unaffected

Open Question

Should we also add validation at the webhook level for faster user feedback?

This would require using the revision informer in the webhook which would probably increase the memory footprint a bit (didn't test it).
The current implementation validates at reconciliation time only, which is consistent with how other traffic errors (e.g., RevisionMissing) are handled so I'm fine keeping the implementation like this.

Release Note

Services can no longer route traffic to revisions belonging to different services; attempting to do so will result in Ready=False with reason RevisionNotOwned.

Services can no longer route traffic to revisions belonging to
different services. When a Service-owned Route references a revision
with a different serving.knative.dev/service label, the Route will
show Ready=False with reason RevisionNotOwned.

Standalone Routes (not owned by a Service) are unaffected and can
still reference any revision.
@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 5, 2025
@knative-prow knative-prow bot requested review from dsimansk and skonto December 5, 2025 15:02
@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

❌ Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.12%. Comparing base (5fbd94e) to head (3ab7621).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
pkg/reconciler/route/traffic/errors.go 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16294      +/-   ##
==========================================
+ Coverage   80.10%   80.12%   +0.02%     
==========================================
  Files         215      215              
  Lines       13332    13360      +28     
==========================================
+ Hits        10679    10705      +26     
- Misses       2294     2296       +2     
  Partials      359      359              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@linkvt
Copy link
Contributor Author

linkvt commented Dec 5, 2025

/retest

1 similar comment
@linkvt
Copy link
Contributor Author

linkvt commented Dec 5, 2025

/retest

@dprotaso
Copy link
Member

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Dec 17, 2025
@knative-prow
Copy link

knative-prow bot commented Dec 17, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, linkvt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 17, 2025
@knative-prow knative-prow bot merged commit cc306d4 into knative:main Dec 17, 2025
154 of 155 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Service lets you point traffic at revisions it does not own

2 participants