Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So swagger-ui is vulnerable. We don't directly rely on it. We rely on github.com/swaggo/files, which submodules in swagger-ui. Javascript code but not through npm. I'm not kidding -- that took a minute to figure out.
So anyway, looks like someone bumped the v2 branch of swaggo/files to have a non-vulnerable swagger-ui a few months back. But the v2 branch of swaggo/files is incompatible with swaggo/gin-swagger. Ugh. So we have to adapt the
fs.FS
that swaggo/files now provides with thewebdav.FileSystem
/webdav.Handler
that swaggo/gin-swagger expects. It's not that bad because it's just a stub.Fun fact, the newer swagger-ui now uses React to apply inline styles imperatively. So it started failing Sherlock's hash-based CSP. Whatever. Sarah Gibson directly confirmed that including
unsafe-inline
forstyle-src
is okay so that's what I'm doing.Testing
We have tests that check that Sherlock can boot the router properly. This is also trivial to test locally because you can just load up the Swagger page and if it works then we can be pretty sure that the files making up the page are there.
Risk
Low. Even if this goes super-super sideways somehow, we're still behind IAP and nothing depends on Swagger.