-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
#806 Part 2: Cleanup KeyStore Implementations #808
Conversation
045624d
to
4d55f19
Compare
890112a
to
0771aa3
Compare
bfc90c9
to
1ff0f8c
Compare
@@ -682,7 +682,7 @@ func (r *NotaryRepository) bootstrapRepo() error { | |||
logrus.Debugf("Loading trusted collection.") | |||
|
|||
for _, role := range data.BaseRoles { | |||
jsonBytes, err := r.fileStore.GetMeta(role, store.NoSizeLimit) | |||
jsonBytes, err := r.fileStore.GetSized(role, store.NoSizeLimit) |
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.
we can do this in a separate PR, but should we phase out store.NoSizeLimit
and change these calls to Get()
instead of GetSized()
?
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.
Yeah. I figured we'd do that in a different PR. There's already so much in here and that's an important change with meaningful TUF security implications if we change it somewhere we shouldn't, so a smaller PR with just that seems more sensible.
@@ -26,14 +158,14 @@ func TestAddFile(t *testing.T) { | |||
expectedFilePath := filepath.Join(tempBaseDir, testName+testExt) | |||
|
|||
// Create our SimpleFileStore |
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.
nit: out of date comments for SimpleFileStore
(161, 193, 229)
Signed-off-by: David Lawrence <dclwrnc@gmail.com> (github: endophage)
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
1ff0f8c
to
1e67617
Compare
} | ||
|
||
// Error implements error interface | ||
func (e ErrWrongHash) Error() string { |
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.
I think all these errors can also be removed, since I can't seem to find anywhere they're being used?
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.
Removed in #825
LGTM! I think there are some minor cleanups that can happen in a future PR, but this an awesome improvement and simplification of the keystore code! |
this is great, parts 1&2 LGTM |
Depends on #807 (the actual diff after merging that PR will be about +1400 -1800)
There are a lot of changes here, my apologies for the size of the commit but a good chunk of it is 1:1 changes that just deal with imports that moved around.
Main items:
/tuf/store/*
moved tostorage/
trustmanager.KeyFileStore
andtrustmanager.KeyMemoryStore
merged intotrustmanager.GenericKeyStore
. They had identical functionality with different underlying storage.trustmanager.SimpleFileStore
unified withtuf.store.FilesystemStore
and now lives atstorage.FilesystemStore
.trustmanager.SimpleFileStore
tests have been preserved instorage/filestore_test.go
and point atFilesystemStore
.trustmanager.MemoryStore
unified withtuf.store.MemoryStore
and now lives atstorage.MemoryStore
.trustmanager.MemoryStore
had no tests.tuf.utils
having a dependency (an import) ontrustmanager
. Thetrustmanager/x509utils.go
code it was depending on for theutils.CanonicalKeyID
was standalone (it had dependencies only on golang std lib packages) and has been moved intotuf.utils
General Cleanup:
LocalStorage
,GetTarget
(legacy from original flynn/go-tuf storage interface, notary does not provide a way to get targets).httpstore
tests were doing verification of signatures. Where possible those tests have been moved intotuf.signed
. In other places the verification has been replaced with a simple equality tests that more directly testshttpstore
behaviour.tuf/utils/util.go
andtuf/utils/utils.go
into a single file of the latter name. Similarly unified test files.