Skip to content

Conversation

@aojea
Copy link
Contributor

@aojea aojea commented Mar 1, 2025

Change-Id: I466f51dd29f6e4a93849102da27d4a0fba3afb42

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 1, 2025
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 1, 2025
@aojea aojea force-pushed the initial branch 2 times, most recently from ebfe1db to e570e76 Compare March 1, 2025 09:57
Change-Id: I466f51dd29f6e4a93849102da27d4a0fba3afb42
Comment on lines +163 to +164
if !cache.WaitForCacheSync(ctx.Done(), podController.HasSynced) {
return fmt.Errorf("timed out waiting for caches to sync")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this exploitable? I don't think so...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WaitForCacheSync returns false only if the context is cancelled


namespace, name, err := cache.SplitMetaNamespaceKey(key)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

This can only fail in the event of programmer error. I would just remove the error check (since we don't recover properly anyway if an error does occur here).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer to keep it this way for consistency

return true, nil
})
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

context.Background() can't be cancelled, so it should not be possible to get an error here...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, but better to be correct

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just trying to enumerate possible ways this could fail and possibly allow the bug to be exploited.

}
patchBytes, err := json.Marshal(patch)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

can only fail in the event of a programmer error, and would introduce an exploitable scenario if it did


patchBytes, err := json.Marshal(patch)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto


c.queue.Forget(key)
utilruntime.HandleError(err)
klog.Infof("Dropping network policy %q out of the queue: %v", key, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this exploitable? I guess you'd have to do something like ensure a long network outage occurred while the NetworkPolicy you wanted to later subvert was being created... Seems unlikely.

@danwinship
Copy link
Contributor

I assume the lack of README is (temporarily) intentional?

aojea and others added 5 commits March 2, 2025 17:40
Co-authored-by: Dan Winship <[email protected]>
Co-authored-by: Dan Winship <[email protected]>
Co-authored-by: Dan Winship <[email protected]>
Change-Id: I13797a962aa2521b148516d93956c62487b4dd3a
Change-Id: Id1b256e250c66d7b3fe01f1fb278d1ffaae807cc
@aojea
Copy link
Contributor Author

aojea commented Mar 2, 2025

I assume the lack of README is (temporarily) intentional?

added README, this will no longer be required after kubernetes/kubernetes#130035 is implemented, it is being backported to all stable branches

Change-Id: I0c28b4de7961358cf0d5ac1694b6c035fba64a74
@danwinship
Copy link
Contributor

lgtm but the tests are failing

@aojea
Copy link
Contributor Author

aojea commented Mar 5, 2025

failing tests are #3 nd #2

@aojea aojea merged commit c3c704b into main Mar 5, 2025
4 of 7 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants