Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for validatePathNoBacksteps (0.26 sec)

  1. pkg/volume/validation/pv_validation.go

    	}
    	return allErrs
    }
    
    // ValidatePathNoBacksteps will make sure the targetPath does not have any element which is ".."
    func ValidatePathNoBacksteps(targetPath string) error {
    	parts := strings.Split(filepath.ToSlash(targetPath), "/")
    	for _, item := range parts {
    		if item == ".." {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Nov 09 11:14:08 UTC 2017
    - 2.2K bytes
    - Viewed (0)
  2. pkg/volume/validation/pv_validation_test.go

    	}{
    		"valid path": {
    			path: "/foo/bar",
    		},
    		"invalid path": {
    			path:        "/foo/bar/..",
    			expectedErr: true,
    		},
    	}
    
    	for name, tc := range testCases {
    		err := ValidatePathNoBacksteps(tc.path)
    
    		if err == nil && tc.expectedErr {
    			t.Fatalf("expected test `%s` to return an error but it didn't", name)
    		}
    
    		if err != nil && !tc.expectedErr {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Sep 16 11:12:06 UTC 2022
    - 3.2K bytes
    - Viewed (0)
  3. pkg/volume/hostpath/host_path.go

    		Managed:        false,
    		SELinuxRelabel: false,
    	}
    }
    
    // SetUp does nothing.
    func (b *hostPathMounter) SetUp(mounterArgs volume.MounterArgs) error {
    	err := validation.ValidatePathNoBacksteps(b.GetPath())
    	if err != nil {
    		return fmt.Errorf("invalid HostPath `%s`: %v", b.GetPath(), err)
    	}
    
    	if *b.pathType == v1.HostPathUnset {
    		return nil
    	}
    	if b.noTypeChecker {
    		return nil
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue May 14 06:17:25 UTC 2024
    - 15.3K bytes
    - Viewed (0)
  4. pkg/volume/local/local.go

    	defer m.plugin.volumeLocks.UnlockKey(m.globalPath)
    
    	if m.globalPath == "" {
    		return fmt.Errorf("LocalVolume volume %q path is empty", m.volName)
    	}
    
    	err := validation.ValidatePathNoBacksteps(m.globalPath)
    	if err != nil {
    		return fmt.Errorf("invalid path: %s %v", m.globalPath, err)
    	}
    
    	notMnt, err := mount.IsNotMountPoint(m.mounter, dir)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue May 14 06:17:25 UTC 2024
    - 22.2K bytes
    - Viewed (0)
  5. pkg/apis/core/validation/validation.go

    	if path.IsAbs(targetPath) {
    		allErrs = append(allErrs, field.Invalid(fldPath, targetPath, "must be a relative path"))
    	}
    
    	allErrs = append(allErrs, validatePathNoBacksteps(targetPath, fldPath)...)
    
    	return allErrs
    }
    
    // validatePathNoBacksteps makes sure the targetPath does not have any `..` path elements when split
    //
    // This assumes the OS of the apiserver and the nodes are the same. The same check should be done
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 22:40:29 UTC 2024
    - 349.5K bytes
    - Viewed (0)
  6. pkg/kubelet/kubelet_pods.go

    			}
    		}
    
    		if subPath != "" {
    			if utilfs.IsAbs(subPath) {
    				return nil, cleanupAction, fmt.Errorf("error SubPath `%s` must not be an absolute path", subPath)
    			}
    
    			err = volumevalidation.ValidatePathNoBacksteps(subPath)
    			if err != nil {
    				return nil, cleanupAction, fmt.Errorf("unable to provision SubPath `%s`: %v", subPath, err)
    			}
    
    			volumePath := hostPath
    			hostPath = filepath.Join(volumePath, subPath)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jun 14 16:09:17 UTC 2024
    - 101.2K bytes
    - Viewed (0)
Back to top