-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add full reader verification #1457
base: main
Are you sure you want to change the base?
Conversation
Before this change, the SOCI snapshotter would verify files on read. After this change, SOCI will verify all files after the background fetcher is done, whether their read or not. Signed-off-by: Kern Walster <walster@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to leave some comments for now, overall seems good but I need to look a little closer at the verifier tomorrow.
@@ -246,10 +247,19 @@ func NewFilesystem(ctx context.Context, root string, cfg config.FSConfig, opts . | |||
} | |||
go bgFetcher.Run(context.Background()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't looked too closely and unrelated, but any chance we might want to pass ctx
into here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we probably should.
} | ||
|
||
var readerVerifier *reader.Verifier | ||
if !cfg.DisableVerification { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So currently this is using the TOML config variable for disabling tar header verification. I think there's a world where one might want tar header integrity per file read (a somewhat hefty but not super resource-intensive process, particularly for lighter workloads) but not want to verify the entire image (a pretty resource-intensive process).
TL;DR I think this should be its own config variable.
m, _ := binary.Uvarint(b.Get(bucketKeyMode)) | ||
if !os.FileMode(uint32(m)).IsRegular() { | ||
return fmt.Errorf("%q is not a regular file", id) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this chunk of code get removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prevented calling metadataReader.OpenFile
on a non-regular file. That's probably not the right thing to do because a metadata.File
is the information about a file's uncompressed offset/size and tar header offset/size within the uncompressed layer. That applied to all files, not just regular files.
In a practical sense, the big issue is that reader.Verify
can't verify directories without this change.
WIP: needs test
Issue #, if available:
Description of changes:
Before this change, the SOCI snapshotter would verify files on read. After this change, SOCI will verify all files after the background fetcher is done, whether their read or not.
Testing performed:
make
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.