diff --git a/client/changelist/change.go b/client/changelist/change.go index 3307189c81..dab0ed3129 100644 --- a/client/changelist/change.go +++ b/client/changelist/change.go @@ -42,7 +42,7 @@ type TufRootData struct { RoleName string `json:"role"` } -// NewTufChange initializes a tufChange object +// NewTufChange initializes a TufChange object func NewTufChange(action string, role, changeType, changePath string, content []byte) *TufChange { return &TufChange{ Actn: action, diff --git a/client/client.go b/client/client.go index 1d133ba611..300a46fc08 100644 --- a/client/client.go +++ b/client/client.go @@ -121,7 +121,7 @@ func repositoryFromKeystores(baseDir, gun, baseURL string, rt http.RoundTripper, } // Target represents a simplified version of the data TUF operates on, so external -// applications don't have to depend on tuf data types. +// applications don't have to depend on TUF data types. type Target struct { Name string // the name of the target Hashes data.Hashes // the hash of the target @@ -605,7 +605,7 @@ func (r *NotaryRepository) publish(cl changelist.Changelist) error { return err } - // these are the tuf files we will need to update, serialized as JSON before + // these are the TUF files we will need to update, serialized as JSON before // we send anything to remote updatedFiles := make(map[string][]byte) diff --git a/client/client_test.go b/client/client_test.go index f77208c64e..926f457db1 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -207,7 +207,7 @@ func createRepoAndKey(t *testing.T, rootType, tempBaseDir, gun, url string) ( // creates a new notary repository with the same gun and url as the previous // repo, in order to eliminate caches (for instance, cryptoservice cache) -// if a new directory is to be created, it also eliminates the tuf metadata +// if a new directory is to be created, it also eliminates the TUF metadata // cache func newRepoToTestRepo(t *testing.T, existingRepo *NotaryRepository, newDir bool) ( *NotaryRepository, *passRoleRecorder) { diff --git a/client/helpers.go b/client/helpers.go index 38f1b43cda..cd5cd1c6cb 100644 --- a/client/helpers.go +++ b/client/helpers.go @@ -214,7 +214,7 @@ func getRemoteKey(url, gun, role string, rt http.RoundTripper) (data.PublicKey, return pubKey, nil } -// signs and serializes the metadata for a canonical role in a tuf repo to JSON +// signs and serializes the metadata for a canonical role in a TUF repo to JSON func serializeCanonicalRole(tufRepo *tuf.Repo, role string) (out []byte, err error) { var s *data.Signed switch { diff --git a/server/integration_test.go b/server/integration_test.go index 99379d3c11..29eb6f3ef5 100644 --- a/server/integration_test.go +++ b/server/integration_test.go @@ -1,4 +1,4 @@ -// This makes sure that the server is compatible with the tuf httpstore. +// This makes sure that the server is compatible with the TUF httpstore. package server diff --git a/server/storage/rethinkdb.go b/server/storage/rethinkdb.go index 68c006820b..a354109204 100644 --- a/server/storage/rethinkdb.go +++ b/server/storage/rethinkdb.go @@ -12,7 +12,7 @@ import ( "gopkg.in/dancannon/gorethink.v2" ) -// RDBTUFFile is a tuf file record +// RDBTUFFile is a TUF file record type RDBTUFFile struct { rethinkdb.Timing GunRoleVersion []interface{} `gorethink:"gun_role_version"` @@ -269,7 +269,7 @@ func (rdb RethinkDB) deleteByTSChecksum(tsChecksum string) error { // Bootstrap sets up the database and tables, also creating the notary server user with appropriate db permission func (rdb RethinkDB) Bootstrap() error { if err := rethinkdb.SetupDB(rdb.sess, rdb.dbName, []rethinkdb.Table{ - TufFilesRethinkTable, + TUFFilesRethinkTable, PubKeysRethinkTable, }); err != nil { return err diff --git a/server/storage/rethinkdb_models.go b/server/storage/rethinkdb_models.go index 18df08c127..4cb46479aa 100644 --- a/server/storage/rethinkdb_models.go +++ b/server/storage/rethinkdb_models.go @@ -13,7 +13,7 @@ const ( var ( // TufFilesRethinkTable is the table definition of notary server's TUF metadata files - TufFilesRethinkTable = rethinkdb.Table{ + TUFFilesRethinkTable = rethinkdb.Table{ Name: RDBTUFFile{}.TableName(), PrimaryKey: "gun_role_version", SecondaryIndexes: map[string][]string{ diff --git a/server/storage/tuf_store_test.go b/server/storage/tuf_store_test.go index 026a9a3e97..2ce75d6106 100644 --- a/server/storage/tuf_store_test.go +++ b/server/storage/tuf_store_test.go @@ -46,23 +46,23 @@ func TestTUFSQLGetCurrent(t *testing.T) { defer os.RemoveAll(tempBaseDir) defer gormDB.Close() - initialRootTufFile := SampleTUF(1) + initialRootTUFFile := SampleTUF(1) - ConsistentEmptyGetCurrentTest(t, tufDBStore, initialRootTufFile) + ConsistentEmptyGetCurrentTest(t, tufDBStore, initialRootTUFFile) // put an initial piece of root metadata data in the database, // there isn't enough state to retrieve it since we require a timestamp and snapshot in our walk - query := gormDB.Create(&initialRootTufFile) + query := gormDB.Create(&initialRootTUFFile) require.NoError(t, query.Error, "Creating a row in an empty DB failed.") - ConsistentMissingTSAndSnapGetCurrentTest(t, tufDBStore, initialRootTufFile) + ConsistentMissingTSAndSnapGetCurrentTest(t, tufDBStore, initialRootTUFFile) // Note that get by checksum succeeds, since it does not try to walk timestamp/snapshot - _, _, err = tufDBStore.GetChecksum("testGUN", "root", initialRootTufFile.Sha256) + _, _, err = tufDBStore.GetChecksum("testGUN", "root", initialRootTUFFile.Sha256) require.NoError(t, err) - // Now setup a valid tuf repo and use it to ensure we walk correctly + // Now setup a valid TUF repo and use it to ensure we walk correctly validTUFRepo, _, err := testutils.EmptyRepo("testGUN") require.NoError(t, err) @@ -125,7 +125,7 @@ func ConsistentGetCurrentFoundTest(t *testing.T, s *TUFMetaStorage, rec TUFFile) require.Equal(t, rec.Data, byt) } -// Checks that both the walking metastore and underlying metastore do not contain the tuf file +// Checks that both the walking metastore and underlying metastore do not contain the TUF file func ConsistentEmptyGetCurrentTest(t *testing.T, s *TUFMetaStorage, rec TUFFile) { _, byt, err := s.GetCurrent(rec.Gun, rec.Role) require.Nil(t, byt) diff --git a/trustmanager/keyfilestore.go b/trustmanager/keyfilestore.go index 49a3938b3d..e2f1d48a25 100644 --- a/trustmanager/keyfilestore.go +++ b/trustmanager/keyfilestore.go @@ -408,7 +408,7 @@ func removeKey(s Storage, cachedKeys map[string]*cachedKey, name string) error { return nil } -// Assumes 2 subdirectories, 1 containing root keys and 1 containing tuf keys +// Assumes 2 subdirectories, 1 containing root keys and 1 containing TUF keys func getSubdir(alias string) string { if alias == data.CanonicalRootRole { return notary.RootKeysSubdir diff --git a/trustpinning/certs_test.go b/trustpinning/certs_test.go index ab9c05d544..4f26936d10 100644 --- a/trustpinning/certs_test.go +++ b/trustpinning/certs_test.go @@ -565,7 +565,7 @@ func testValidateSuccessfulRootRotation(t *testing.T, keyAlg, rootKeyType string memKeyStore := trustmanager.NewKeyMemoryStore(passphraseRetriever) cs := cryptoservice.NewCryptoService(memKeyStore) - // Tuf key with PEM-encoded x509 certificate + // TUF key with PEM-encoded x509 certificate origRootKey, err := testutils.CreateKey(cs, gun, data.CanonicalRootRole, keyAlg) require.NoError(t, err) @@ -593,7 +593,7 @@ func testValidateSuccessfulRootRotation(t *testing.T, keyAlg, rootKeyType string prevRoot, err := data.RootFromSigned(signedOrigTestRoot) require.NoError(t, err) - // Tuf key with PEM-encoded x509 certificate + // TUF key with PEM-encoded x509 certificate replRootKey, err := testutils.CreateKey(cs, gun, data.CanonicalRootRole, keyAlg) require.NoError(t, err) @@ -645,7 +645,7 @@ func testValidateRootRotationMissingOrigSig(t *testing.T, keyAlg, rootKeyType st memKeyStore := trustmanager.NewKeyMemoryStore(passphraseRetriever) cs := cryptoservice.NewCryptoService(memKeyStore) - // Tuf key with PEM-encoded x509 certificate + // TUF key with PEM-encoded x509 certificate origRootKey, err := testutils.CreateKey(cs, gun, data.CanonicalRootRole, keyAlg) require.NoError(t, err) @@ -673,7 +673,7 @@ func testValidateRootRotationMissingOrigSig(t *testing.T, keyAlg, rootKeyType st prevRoot, err := data.RootFromSigned(signedOrigTestRoot) require.NoError(t, err) - // Tuf key with PEM-encoded x509 certificate + // TUF key with PEM-encoded x509 certificate replRootKey, err := testutils.CreateKey(cs, gun, data.CanonicalRootRole, keyAlg) require.NoError(t, err) @@ -721,7 +721,7 @@ func testValidateRootRotationMissingNewSig(t *testing.T, keyAlg, rootKeyType str memKeyStore := trustmanager.NewKeyMemoryStore(passphraseRetriever) cs := cryptoservice.NewCryptoService(memKeyStore) - // Tuf key with PEM-encoded x509 certificate + // TUF key with PEM-encoded x509 certificate origRootKey, err := testutils.CreateKey(cs, gun, data.CanonicalRootRole, keyAlg) require.NoError(t, err) @@ -749,7 +749,7 @@ func testValidateRootRotationMissingNewSig(t *testing.T, keyAlg, rootKeyType str prevRoot, err := data.RootFromSigned(signedOrigTestRoot) require.NoError(t, err) - // Tuf key with PEM-encoded x509 certificate + // TUF key with PEM-encoded x509 certificate replRootKey, err := testutils.CreateKey(cs, gun, data.CanonicalRootRole, keyAlg) require.NoError(t, err) diff --git a/tuf/README.md b/tuf/README.md index 00a342e81e..636ae29dd2 100644 --- a/tuf/README.md +++ b/tuf/README.md @@ -12,7 +12,7 @@ from Docker should be considered the official CLI to be used with this implement - [X] Add Targets to existing repo - [X] Sign metadata files -- [X] Refactor TufRepo to take care of signing ~~and verification~~ +- [X] Refactor TUFRepo to take care of signing ~~and verification~~ - [ ] Ensure consistent capitalization in naming (TUF\_\_\_ vs Tuf\_\_\_) - [X] Make caching of metadata files smarter - PR #5 - [ ] ~~Add configuration for CLI commands. Order of configuration priority from most to least: flags, config file, defaults~~ Notary should be the official CLI diff --git a/tuf/testutils/repo.go b/tuf/testutils/repo.go index c5595787d7..d9e4499270 100644 --- a/tuf/testutils/repo.go +++ b/tuf/testutils/repo.go @@ -102,7 +102,7 @@ func EmptyRepo(gun string, delegationRoles ...string) (*tuf.Repo, signed.CryptoS // first sort.Strings(delegationRoles) for _, delgName := range delegationRoles { - // create a delegations key and a delegation in the tuf repo + // create a delegations key and a delegation in the TUF repo delgKey, err := CreateKey(cs, gun, delgName, data.ECDSAKey) if err != nil { return nil, nil, err