Registry Mirror
Skip to content

Conversation

@divyani-22

Copy link
Copy Markdown
Contributor

Description

Building cleanly on top of #4198, this PR addresses remaining validation gaps in both pkg/functions/function_volumes.go and cmd/config_volumes.go:

  1. Relative, empty, and root / mount paths: validateVolumes previously only verified vol.Path != nil and duplicate paths, allowing empty strings (""), relative paths ("etc/config"), or root ("/") to pass Function.Validate() / Function.Write() and fail later during Kubernetes admission (or shadow the container rootfs if mounted at /). Both validateVolumes and cmd/config_volumes.go (runAddVolumesPrompt, runAddVolume, runRemoveVolume) now reject root / (including normalized paths such as ///).
  2. Empty resource names: validateVolumes checked PersistentVolumeClaim.ClaimName == nil but did not check empty strings for *Secret == "", *ConfigMap == "", or *PersistentVolumeClaim.ClaimName == "".

Changes

  • pkg/functions/function_volumes.go: In validateVolumes, reject empty/relative paths, root / mount paths (path.Clean(*vol.Path) == "/"), and empty secret/configMap/PVC claim names.
  • cmd/config_volumes.go: Reject root / mount paths in runAddVolumesPrompt, runAddVolume, and runRemoveVolume.
  • pkg/functions/function_volumes_unit_test.go: Updated Test_validateVolumes fixtures to absolute paths (/path) and added cases for relative path, empty path, root / & /// paths, and empty secret/configMap/PVC claim names.
  • cmd/config_volumes_test.go: Added TestConfigVolumesAdd_MountPathValidation and TestConfigVolumesRemove_MountPathValidation testing relative, root /, and clean root /// rejection.

Testing

  • Test_validateVolumes in pkg/functions/function_volumes_unit_test.go
  • TestConfigVolumesAdd_MountPathValidation and TestConfigVolumesRemove_MountPathValidation in cmd/config_volumes_test.go

Copilot AI balanced review requested due to automatic review settings December 1, 2026 03:23
@knative-prow

knative-prow Bot commented Dec 1, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: divyani-22
Once this PR has been reviewed and has the lgtm label, please assign jrangelramos for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@knative-prow knative-prow Bot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels Dec 1, 2026
@knative-prow

knative-prow Bot commented Dec 1, 2026

Copy link
Copy Markdown

Hi @divyani-22. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

…uire non-empty sources

Signed-off-by: Divyani <divyanipapalkar22@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test 🤖 Needs an org member to approve testing size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants