1
0
mirror of https://github.com/docker/docs.git synced 2026-11-05 00:14:17 +03:00
Commit Graph

76 Commits

Author SHA1 Message Date
Ying Li
7404f4ff55 Embed SignedCommon in Root, Snapshot, and Timestamp, as it's already
embedded in Targets.  This way we can easily get a SignedCommon object
out after calling RootFromSigned, etc.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-07 17:27:13 -07:00
HuKeping
5e46a4aadc Update test
Use concrete error types rather than check the strings.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-04-04 02:07:37 +08:00
HuKeping
52ffe6172d Use concrete error types rather than generic errors
Use concrete error types for functions "CheckHashes"
and "CheckValidHashStructures".

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-04-04 01:30:13 +08:00
HuKeping
a20c92c85f Add some error types
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-04-04 01:30:08 +08:00
HuKeping
67b0ec3771 Use constant for snapshot
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-28 17:21:24 +08:00
David Lawrence
26fbc45780 fixing a panic in relation to the json.RawMessage updates
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-03-23 13:40:38 -07:00
David Lawrence
bfee37d471 update top level Signed.Signed to be a *json.RawMessage
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-03-18 16:18:53 -07:00
David Lawrence
127c4f26cf Merge pull request #620 from endophage/rawmessage_pointer
json.RawMessage needs to be a pointer
2016-03-17 09:27:02 -07:00
Ying Li
4022e97b08 Use 'require' instead of 'assert' in client and TUF client tests
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-15 13:52:48 -07:00
David Lawrence
2fd125c489 json.RawMessage needs to be a pointer when embedded in a larger JSON struct to avoid double encoding problems.
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)

Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-03-11 16:34:16 -08:00
HuKeping
9501cddc1d [MISC 3/4] Refactor: move test helper function to test package
The helper function "GetSupportedHashes" is only used in tests,
it's better to move it to the relevant test file.

Since it's for the test, remove the origin test code for it.

And it also a good idea to call "NewfileMeta" instead of implement
once again.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 17:24:43 +08:00
HuKeping
30c9cfc113 [MISC 2/4] Constant: use constant instead of some literal string
Replace the "sha256" by the constant defined in the notary-const file.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 16:44:14 +08:00
HuKeping
2f61b0a445 [PATCH 8/8] Add some test
For the added functions of this patch set.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 10:45:05 +08:00
HuKeping
206d02ab4d [PATCH 4/8] Add sha512 when updating
Actually there are two way to implement this.

One is check the present hash algorithm first and then only update
what we have.

The other is update/add both sha256 and sha512 no matter whether we
have the hash of sha512 or not.

Personally I prefer the latter, for it brings much less change of the
code and will also not affect the validate of the old clients.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 10:44:46 +08:00
HuKeping
6b96c7e56d [PATCH 3/8] Add sha512 when creating target, snapshot and timestamp
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 10:44:42 +08:00
HuKeping
30790aaa68 [PATCH 2/8] Add some helper functions
Include:
- A helper function to verify checksums generate by different hash algorithms.
- A helper function to generate checksums of all the supported hash algorithms.
- A helper fucntion to do a sanity check for every checksum.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 10:44:39 +08:00
HuKeping
7344f4e3da [PATCH 1/8] Create constants for sha256 and sha512
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 10:44:33 +08:00
HuKeping
f9681e6287 Cleanup: remove the unused function
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-02-25 21:48:32 +08:00
David Lawrence
cb2dd07edc the server was not setting the longer snapshot expiry time. When generating a timestamp it was also retriving the snapshot directly from the database and only validating the checksum still matched what was in the timestamp. Due to the addition of consistent downloads, this mean a new snapshot never got generated. It is necessary for GetOrCreateTimestamp to call GetOrCreateSnapshot to ensure a new snapshot is generated as and when required
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-24 15:51:31 -08:00
Riyaz Faizullabhoy
bde878cdb6 changing API for updating delegations
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:57:08 -08:00
Riyaz Faizullabhoy
729bb88537 addressing review comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Riyaz Faizullabhoy
fe1c8ea1d8 More robust errors for visitor and walker, improve comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Riyaz Faizullabhoy
456e5054a8 Currently always validate role names and restrict paths while walking
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Ying Li
8ca8f073fa Have isValidRootRoleStructure take both role names in order to construct an ErrInvalidMetadata
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:39:54 -08:00
Ying Li
191307fc07 specifying other non-base roles on the root metadata is not invalid
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
Ying Li
61dad28b1e Validate that snapshot and timestamp have required sha256 checksums
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
Ying Li
4b13e7d358 Refactor RootRole verification into a helper function used by root and targets validation
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
Ying Li
57e28e4f09 Rename the validation functions and add more tests
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
Ying Li
314cfb9a17 Add targets metadata validation to the targets data structure
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
Ying Li
4cae84bb29 Add snapshot metadata validation to the snapshot data structure
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
Ying Li
8335d194ce Add timestamp metadata validation to the timestamp data structure
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
Ying Li
36ea1f6901 Add root metadata validation to the root data structure
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
David Lawrence
e270795768 updates and bugfixes for go 1.6
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-18 16:45:40 -08:00
David Lawrence
d1ac37fd33 addressing review comments
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-17 16:31:48 -08:00
David Lawrence
1db128778d completely removing KeyDB
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-16 21:11:13 -08:00
Riyaz Faizullabhoy
b46391ee8f Remove RoleWithKeys
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-16 10:07:00 -08:00
Riyaz Faizullabhoy
c3c24be66b remove path restriction from getting delegations, use in future visitor
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -08:00
Riyaz Faizullabhoy
10865d2310 addressing review comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -08:00
Riyaz Faizullabhoy
1d9e375680 add delegation role methods, more tests
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -08:00
Riyaz Faizullabhoy
affd18f3d5 limit role methods
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -08:00
Riyaz Faizullabhoy
d379f9918c add GetBaseRole and GetDelegationRole with path validation
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -08:00
Riyaz Faizullabhoy
a754574b85 add stronger role types for internal use
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -08:00
Ying Li
ac265186ee Rename repo.GetRole to repo.GetRoleWithNames and use the Keys data structure more.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-11 09:51:08 -08:00
Ying Li
b7eea5f611 Refactor signed.Verify to no longer take a KeyDB, but a RoleWithKeys object.
Also removes several uncovered and unused functions (Unmarshal and UnmarshalTrusted)
of signed/verify.go.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-10 15:20:54 -08:00
Jessica Frazelle
a64db12c04 change url from jfrazelle/go to docker/go
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-01-26 08:43:38 -08:00
Riyaz Faizullabhoy
138d6cea09 Add, remove, and list delegation command. TUF changelist action change
for deletions (force vs. individual items)
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-18 16:24:45 -08:00
Ying Li
c65fc03ef9 Update test to make x509 keys start a day in the past.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-14 14:15:38 -08:00
Ying Li
f57f2beb08 Factor marshalling a SignedRoot into JSON into TUF/data/root.go, and
add an injectable serializer (so we can test JSON marshalling/unmarshalling
error propagation).

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-14 10:51:24 -08:00
Ying Li
cf4b77b760 Revert "switching out to consistently use canonical json for all marshalling of TUF data"
This reverts commit f417c834c4.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-08 14:53:09 -08:00
David Lawrence
11795a4573 rename data.ValidRoles to data.BaseRoles
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-07 17:38:52 -08:00