Closed amirmalka closed 4 weeks ago
A different approach for fixing this issue is to use the SARIF format which already implements the yaml parsing.
Hey @amirmalka, I'm currently working on this issue. I will update the progress soon. Hope to contribute more.
Hey @amirmalka , I went through the yamlParse process and how we are highlighting and scanning in VS Code.
The issue seems to be in the config YAML file. There it is written runAsRoot: value
in securityContext. It should be runAsNonRoot: value
Now, for why it doesn't show on problems tab is, The fix path obtained through controls in scan results , is spec.template.spec.containers[0].securityContext.runAsNonRoot
which mean when it is broken down into steps and we find startIndex, it particularly searches for runAsNonRoot in all lines, as no found is matched it returns -1
.
I have tested with other scenario, the VS Code extension works fine. Please let me know, if you need any change in code.
Root cause: A bug in
getStartIndexAcc
fails to detect fixPath location (returns -1), and as a result, failed controls are not added to the report collection (see https://github.com/kubescape/vscode-kubescape/blob/master/src/Kubescape/scan.ts#L27)Steps to reproduce:
runAsRoot: true
fails due to C-0013A fix should be made in https://github.com/kubescape/node-yamlparse so that fixedPath is parsed correctly