deislabs / mystikos

Tools and runtime for launching unmodified container images in Trusted Execution Environments
142 stars 49 forks source link

Fix Code scanning filesystem TOCTOU #1526

Closed vtikoo closed 4 months ago

vtikoo commented 4 months ago

There is a stat(pathname) followed by open(pathname). Code scanning alerts this as a possible TOCTOU if the file was modified between these two calls. This patch removes the stat(), as it is only used for validating file existence, which open() also performs.

https://github.com/deislabs/mystikos/security/code-scanning/4137