mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 18:09:55 +00:00
Add YAML validation
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com>
This commit is contained in:
@@ -416,7 +416,15 @@ func loadHostSensorFromFile(hostSensorYAMLFile string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// TODO - Add file validation
|
||||
|
||||
if len(dat) == 0 {
|
||||
return "", fmt.Errorf("empty file")
|
||||
}
|
||||
|
||||
if !cautils.IsYaml(hostSensorYAMLFile) {
|
||||
return "", fmt.Errorf("invalid file format")
|
||||
}
|
||||
|
||||
return string(dat), err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user