Commit Graph

1585 Commits

Author SHA1 Message Date
Diogo Mónica 2dfd22dbef Merge pull request #401 from cyli/list-targets-lists-role
When listing targets, the role the target belongs to is also listed
2016-01-04 19:18:38 -08:00
Ying Li 61bbf7be49 Change ListTargetes and GetTargetsByName to return TargetWithRole.
This object has both the target and the role in which the target was found.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-04 17:15:44 -08:00
Riyaz Faizullabhoy 53bf7a943f Merge pull request #394 from docker/style-cleanup
fix up style according to comments
2016-01-04 16:35:41 -08:00
Riyaz Faizullabhoy 077c28b65d Use path operation for delegation role check, update RoleTargetsPath to
use path for role name URL

Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-04 16:23:02 -08:00
Riyaz Faizullabhoy dbb8c1065f use path instead of filepath to express TUF roles
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-04 16:23:02 -08:00
Riyaz Faizullabhoy a1178bfc96 improved slice copying and appending
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-04 16:20:19 -08:00
Riyaz Faizullabhoy 385bd5aa11 fix up style according to comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-04 16:20:19 -08:00
Ying Li 2f2a0b9c9f Display the role when listing targets using the Notary CLI.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-04 15:20:06 -08:00
Ying Li ecd96c8218 Fix potential infinite loop in tuf/Client.TargetMeta
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-04 10:50:35 -08:00
Ying Li 9252d9d892 Update client.Target to include a RoleName, so we know where the target is when listed.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-04 10:49:54 -08:00
Ying Li 0014348991 Merge pull request #390 from HuKeping/injecting
Stop injecting to the helper function
2016-01-04 09:07:28 -08:00
HuKeping 74d4af37a3 Stop injecting to the helper function
GetCryptoService is a helper function and we have injected a specific
http.ResponseWriter object for it to write back error message. Meanwhile
the caller for that function checks whether the cryptoService is nil
or not and return immediately if it is nil.

I think it's not a good idea to write back HTTP response in the helper function,
it's the caller's work and thus there is no need to inject the specific
ResponseWriter object into it.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-12-30 09:42:51 +08:00
David Lawrence 0c11a97082 Merge pull request #392 from hqhq/update_panicwrap
Update github.com/bugsnag/panicwrap
2015-12-28 20:14:57 -08:00
Diogo Mónica fc4fae6b8a Merge pull request #391 from hqhq/dont_use_strings_compare
Do not use strings.Compare
2015-12-28 12:02:53 -08:00
Qiang Huang f8ef61fe82 Update github.com/bugsnag/panicwrap
With this, we can build notary on ARM64.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-12-26 15:28:43 +00:00
Qiang Huang a7cc3926dd Do not use strings.Compare
According to https://golang.org/src/strings/compare.go?s=491:520#L3
It's suggested to use the built-in string comparison operators.

And also, seems like this function does not exist in some arch
such as arm64. So we better not use it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-12-26 13:50:52 +00:00
Ying Li 6028de0dd1 Merge pull request #387 from docker/backwards-compatibility
Tests for backwards-compatibility reading/writing/exporting/importing old repo format
2015-12-23 12:15:03 -08:00
Ying Li 785b2527b1 Test import/export of old repo format.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-23 11:47:37 -08:00
Diogo Mónica ffca6fb522 Merge pull request #388 from docker/cleanup
Rebased cleanup/remove PEM headers
2015-12-23 11:36:25 -08:00
Diogo Mónica e87d2aa196 Merge pull request #386 from docker/errors-fix
fixes errors in notary for testing
2015-12-23 11:32:50 -08:00
Ying Li 0465365fb6 Return an error if unable to encrypt a key as a valid PEM file
Also address review comments and fix semantic conflict after rebase.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-23 09:44:51 -08:00
David Lawrence fa788cb2a9 make x509 certs viable as delegated public key object
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-23 09:41:03 -08:00
David Lawrence 2bf5d4b09a test for legacy keys and some bugfixes for same
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-23 09:41:03 -08:00
David Lawrence e516dd88f2 cleaning up tests by converting t.Fatal to assert.___
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-23 09:41:03 -08:00
David Lawrence f2ec72b5b6 aliases removed from file names
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-23 09:41:03 -08:00
David Lawrence 6d5b8ff54a add role into PEM headers
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-23 09:41:03 -08:00
David Lawrence 1f329868e8 making filestores consistent so you can Get, Remove, etc... the paths returned by ListFiles
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-23 09:41:03 -08:00
David Lawrence 8f7fddd5d5 breaking up low level storage into logical files
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-23 09:41:03 -08:00
Ying Li 9573252ace Add backwards-compatbility test for client reading-writing 0.1-style repos.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 18:01:36 -08:00
Ying Li 0c54c6caef Add an example of a 0.1 style repository for backwards compatibility tests
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 18:00:57 -08:00
Riyaz Faizullabhoy 9b0ae29427 ErrRepoNotInitialized test
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2015-12-22 16:53:31 -08:00
Riyaz Faizullabhoy 98b7dd7daf fixes to notary for docker integration
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2015-12-22 16:53:31 -08:00
Ying Li db9705dd97 Merge pull request #384 from docker/more-client-negative-tests
More client writing/publishing negative tests
2015-12-22 16:50:17 -08:00
Ying Li d1fa795f20 Merge pull request #382 from cyli/passphrase-tests
Add basic tests for passphrase retriever to make sure it handles delegations
2015-12-22 16:30:41 -08:00
Ying Li 2900423fa2 Minor error message changes
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 16:29:28 -08:00
Ying Li 9ca2200775 Update filestore to first remove existing metadata before setting metadata.
This would let it remove corrupt or bad-state metadata.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 16:29:28 -08:00
Ying Li 332621607e Add more comments and assertions as per review.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 16:29:28 -08:00
Ying Li 6423c16233 Test pushing an uninitialized repo as well.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 16:29:28 -08:00
Ying Li ebac6b158a Refactor tests to cover corrupt root/targets/delegations.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 16:29:28 -08:00
Ying Li ab97f9e12e Refactor some of the code to reduce creating temp notary repo directory boilerplate.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 16:23:19 -08:00
Ying Li d6234e5ef0 Add some simple failure cases where data is corrupt or we can't get server keys.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 16:23:19 -08:00
Ying Li c1eb344b89 Rotation tests now test reading from other (non-publishing) clients.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 16:23:19 -08:00
Ying Li 8128026459 Merge pull request #385 from docker/client-delegation-write-tests
Add more delegation writing/publishing tests.
2015-12-22 16:01:55 -08:00
Ying Li f794193382 Address review comments (renaming, extra code left in, etc.)
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 15:32:05 -08:00
Ying Li 203adfc13c Add basic tests for passphrase retriever to make sure it handles delegations.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 14:14:10 -08:00
Ying Li 66384edfc3 Add some more publishing tests.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 00:44:50 -08:00
Ying Li dcef24996e Add more delegation writing/publishing tests.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 00:23:32 -08:00
Ying Li 340a337c31 Merge pull request #378 from cyli/publish-delegations
Publishing delegation changes, and targets to delegations
2015-12-18 17:08:34 -08:00
Ying Li 34055f8cf7 Code cleanups as per review, and after rebasing.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-18 16:51:48 -08:00
Ying Li 0892ebb13f Add checks to TUFRepo to fail on updating a target if there are no signing keys.
So UpdateDelegation, DeleteDelegation, AddTargets, RemoveTargets now
all check for the role existence, not metadata existence.  And they
also check the role's signing keys - there's no point in adding if
we can't sign.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-18 16:37:24 -08:00