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

218 Commits

Author SHA1 Message Date
Riyaz Faizullabhoy
f7f8a961b5 Unit test for verifying invalid key ID
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-11 17:28:14 -07:00
Riyaz Faizullabhoy
7fe11bd102 Add key ID verification to Verify
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-11 17:26:08 -07:00
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
Ying Li
79238e087f Change assert to require in tuf/* packages
Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-05 11:21:14 -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
0a60261fab Use constant for root role
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-29 07:08:23 +08:00
HuKeping
ddff581bd8 Use constant for targets role
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-29 07:08:16 +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
Riyaz Faizullabhoy
9ecd899e25 Removing key import and gun from cryptoservice
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:31:03 -07:00
Riyaz Faizullabhoy
7bd550a39a import refactor
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:06:40 -07:00
Riyaz Faizullabhoy
2a37590ea6 update interface and comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:06:37 -07:00
Riyaz Faizullabhoy
97e845e295 AddKey for cryptoservice
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:04:04 -07:00
Riyaz Faizullabhoy
95af5d4800 try cleaning up removekey, debugging tests
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:04:00 -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
David Lawrence
e09bdd5630 remove signatures that are no longer valid during signing, either because the key is no longer a valid signing key for the role, or the signature is invalid.
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)

Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-03-16 16:03:22 -07:00
Miloslav Trmač
4898d252ee Don't silently ignore swizzler errors
These calls can fail, and errors would cause false failures later in the
tests.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-03-16 18:33:48 +01: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
cd0b43a6b8 Merge pull request #617 from docker/no-keys-canonical-id
Message canonical key ids on error
2016-03-14 15:18:46 -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
2136ca54ba [MISC 4/4] distinguish nil and empty map
Since the function len(X) will return 0 no matter X is nil or
an empty map.

We should distinguish that.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 17:24:47 +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
bf97855897 [PATCH 6/8] Add sha512 check when downloading TUF roles
Since the timestamp role need not the hash checking during the downloading,
thi patch only includes:
- snapshot.json
- root.json
- target.json

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 10:44:56 +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
Riyaz Faizullabhoy
06ba32ea47 Message canonical key ids on error
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-09 21:30:46 -08:00
Ying Li
1bfafa0b77 Add test to check that if a key is rotated, but the requisite piece of
metadata hasn't been resigned, that an update fails because the
cached version is no longer valid.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-03 09:22:26 -08:00
Diogo Monica
79c692a7c6 Cary and close #293
Signed-off-by: Mary Anthony <mary@docker.com>
2016-02-29 12:58:55 -08:00
HuKeping
8455f9fb5a Kind of cleanup
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-02-29 19:27:56 +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
06e34e825a walk for updating/creating delegations, validate changes to paths
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
22c220d4d2 RemoveTargets with walker
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
Riyaz Faizullabhoy
5398bcf4fd AddTargets uses walk and visitor
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Riyaz Faizullabhoy
e279c99daf use walker for GetDelegationRole
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Riyaz Faizullabhoy
a7153aeccb WalkTargets on tuf repo, use in getting targets/roles
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
David Lawrence
9e9802bdd0 Merge pull request #573 from docker/validate-meta-on-parse
Adds extra validation when calling `XFromSigned` functions
2016-02-23 10:17:02 -08:00
David Lawrence
1e99830716 check validity of children during download and don't overwrite already loaded children
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-22 20:47:58 -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