Skip to content

Resolve ExternalName services to non-externalname services, even across namespaces. - #11747

Closed
evankanderson wants to merge 3 commits into
knative:mainfrom
evankanderson:resolve-cve
Closed

evankanderson wants to merge 3 commits into
knative:mainfrom
evankanderson:resolve-cve

Conversation

@evankanderson

Copy link
Copy Markdown
Member

Proposed Changes

  • Have DomainMapping resolve externalName Services to their destinations when constructing KIngress objects.
  • This should avoid CVE-2021-32783 mitigations by Contour (blocking ExternalName services in HTTPProxy objects).
  • Also enables resolution of shorter service names (foo.ns.svc, foo.ns, foo).
  • May have improved handling of URLs with ports, though most of that is still TODO.

/hold

The current cross-namespace Service reference probably breaks KIngress today. Figuring out what to do about that.

Release Note

* Enables DomainMapping to resolve cluster-local addressables that don't end in svc.cluster.local
* DomainMapping now avoids off-cluster redirects via ExternalName. This mitigates CVE-2021-32783

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 29, 2021
@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 29, 2021
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 29, 2021
@knative-prow-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evankanderson

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-robot knative-prow-robot added area/API API objects and controllers approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 29, 2021
@evankanderson

Copy link
Copy Markdown
Member Author

cc @julz @dprotaso @nak3

I may do some of this in net-contour for now as an immediate mitigation, but I wanted to get your take on this PR (and the work that we'd need to do on KIngress to support cross-namespace Service references).

Another option would be to create the KIngress in the target namespace rather than the DomainMapping's namespace. WDYT?

@codecov

codecov Bot commented Jul 29, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #11747 (daa71a4) into main (1d1cd79) will decrease coverage by 0.03%.
The diff coverage is 92.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11747      +/-   ##
==========================================
- Coverage   87.83%   87.79%   -0.04%     
==========================================
  Files         196      196              
  Lines        9364     9401      +37     
==========================================
+ Hits         8225     8254      +29     
- Misses        886      891       +5     
- Partials      253      256       +3     
Impacted Files Coverage Δ
pkg/reconciler/domainmapping/controller.go 0.00% <0.00%> (ø)
pkg/reconciler/domainmapping/reconciler.go 92.47% <96.00%> (+0.36%) ⬆️
pkg/reconciler/domainmapping/resources/ingress.go 100.00% <100.00%> (ø)
pkg/reconciler/configuration/configuration.go 84.61% <0.00%> (-1.54%) ⬇️
pkg/autoscaler/statforwarder/leases.go 75.53% <0.00%> (-1.44%) ⬇️
cmd/queue/execprobe.go 100.00% <0.00%> (ø)
pkg/queue/health/probe.go 53.24% <0.00%> (ø)
pkg/apis/serving/fieldmask.go 95.03% <0.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d1cd79...daa71a4. Read the comment docs.

@knative-prow-robot

Copy link
Copy Markdown
Contributor

@evankanderson: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Rerun command
pull-knative-serving-istio-stable-no-mesh-tls daa71a4 link /test pull-knative-serving-istio-stable-no-mesh-tls
pull-knative-serving-istio-stable-no-mesh daa71a4 link /test pull-knative-serving-istio-stable-no-mesh

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@evankanderson

Copy link
Copy Markdown
Member Author

I just realized that moving the KIngress to the targeted namespace introduces a pair of problems:

  1. We also need to move the TLS cert for autotls (which is what broke the tests). We could do that, but that means exposing the cert to a different namespace than we originally did, which seems unexpected.
  2. The KIngress (and any cert request) now has a cross-namespace OwnerReference. This doesn't seem intrinsically wrong, but I suspect that cleanup won't be as automatic as it used to be, at a minimum.

@dprotaso

dprotaso commented Aug 9, 2021

Copy link
Copy Markdown
Member

The KIngress (and any cert request) now has a cross-namespace OwnerReference.

cross namespace owner references aren't valid/don't clean up I believe

@dprotaso

dprotaso commented Aug 9, 2021

Copy link
Copy Markdown
Member

this discussion is sorta related to 2)

knative/networking#421

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 24, 2021
@knative-prow-robot

Copy link
Copy Markdown
Contributor

@evankanderson: PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@evankanderson

Copy link
Copy Markdown
Member Author

/close

Moving these to a different namespace will introduce cleanup problems (and possibly access control problems, though I think the later are probably an artifact of an unclear permissions model).

@knative-prow-robot

Copy link
Copy Markdown
Contributor

@evankanderson: Closed this PR.

Details

In response to this:

/close

Moving these to a different namespace will introduce cleanup problems (and possibly access control problems, though I think the later are probably an artifact of an unclear permissions model).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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. area/API API objects and controllers cla: yes Indicates the PR's author has signed the CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

3 participants