Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loglist3: JSON (un)marshalling for log list v3 schema #867

Merged
merged 2 commits into from
Jan 6, 2022

Conversation

smeiklej
Copy link
Contributor

@smeiklej smeiklej commented Dec 3, 2021

This code takes into account two new (optional) fields in the v3 schema:

  • LogListTimestamp
  • PreviousOperators (per log)
    They have been added in and the tests have been modified accordingly. Otherwise the code is identical to the code in loglist2.

@smeiklej smeiklej requested a review from taknira December 3, 2021 11:29
@google-cla google-cla bot added the cla: yes label Dec 3, 2021
@mhutchinson
Copy link
Contributor

I checked this out locally and confirmed the salients diffs are as follows:

diff loglist2/loglist2.go loglist3/loglist3.go
1c1
< // Copyright 2018 Google LLC. All Rights Reserved.
---
> // Copyright 2021 Google LLC. All Rights Reserved.
15,17c15,17
< // Package loglist2 allows parsing and searching of the master CT Log list.
< // It expects the log list to conform to the v2beta schema.
< package loglist2
---
> // Package loglist3 allows parsing and searching of the master CT Log list.
> // It expects the log list to conform to the v3 schema.
> package loglist3
39c39
< 	LogListURL = "https://www.gstatic.com/ct/log_list/v2/log_list.json"
---
> 	LogListURL = "https://www.gstatic.com/ct/log_list/v3/log_list.json"
41c41
< 	LogListSignatureURL = "https://www.gstatic.com/ct/log_list/v2/log_list.sig"
---
> 	LogListSignatureURL = "https://www.gstatic.com/ct/log_list/v3/log_list.sig"
43c43
< 	AllLogListURL = "https://www.gstatic.com/ct/log_list/v2/all_logs_list.json"
---
> 	AllLogListURL = "https://www.gstatic.com/ct/log_list/v3/all_logs_list.json"
46c46
< // Manually mapped from https://www.gstatic.com/ct/log_list/v2beta/log_list_schema.json
---
> // Manually mapped from https://www.gstatic.com/ct/log_list/v3/log_list_schema.json
49a50,53
> 	// Version is the version of the log list.
> 	Version string `json:"version,omitempty"`
> 	// LogListTimestamp is the time at which the log list was published.
> 	LogListTimestamp time.Time `json:"log_list_timestamp,omitempty"`
80a85,87
> 	// PreviousOperators is a list of previous operators and the timestamp
> 	// of when they stopped running the log.
> 	PreviousOperators []*PreviousOperator `json:"previous_operators,omitempty"`
90a98,106
> // PreviousOperator holds information about a log operator and the time at which
> // they stopped running a log.
> type PreviousOperator struct {
> 	// Name is the name of the CT log operator.
> 	Name string `json:"name"`
> 	// EndTime is the time at which the operator stopped running a log.
> 	EndTime time.Time `json:"end_time"`
> }
>


diff loglist2/loglist2_test.go loglist3/loglist3_test.go                                                                                                                                                     19ms
1c1
< // Copyright 2018 Google LLC. All Rights Reserved.
---
> // Copyright 2021 Google LLC. All Rights Reserved.
15c15
< package loglist2
---
> package loglist3
42a43,44
> 	Version:          "1.1.1c",
> 	LogListTimestamp: mustParseTime(time.UnixDate, "Fri Dec 3 11:06:00 UTC 2021"),
137a140,145
> 					PreviousOperators: []*PreviousOperator{
> 						{
> 							Name:    "Alice's Shady Log",
> 							EndTime: mustParseTime(time.UnixDate, "Thu Nov 6 12:00:00 UTC 2014"),
> 						},
> 					},
153c161
< 			want: `{"operators":[` +
---
> 			want: `{"version":"1.1.1c","log_list_timestamp":"2021-12-03T11:06:00Z","operators":[` +
161c169
< 				`{"description":"Bob's Dubious Log","log_id":"zbUXm3/BwEb+6jETaj+PAC5hgvr4iW/syLL1tatgSQA=","key":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECyPLhWKYYUgEc+tUXfPQB4wtGS2MNvXrjwFCCnyYJifBtd2Sk7Cu+Js9DNhMTh35FftHaHu6ZrclnNBKwmbbSA==","url":"https://log.bob.io","dns":"dubious-bob.ct.googleapis.com","mmd":86400,"state":{"retired":{"timestamp":"2016-04-15T00:00:00Z"}},"temporal_interval":{"start_inclusive":"2014-11-07T12:00:00Z","end_exclusive":"2015-03-07T12:00:00Z"}}]}]}`,
---
> 				`{"description":"Bob's Dubious Log","log_id":"zbUXm3/BwEb+6jETaj+PAC5hgvr4iW/syLL1tatgSQA=","key":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECyPLhWKYYUgEc+tUXfPQB4wtGS2MNvXrjwFCCnyYJifBtd2Sk7Cu+Js9DNhMTh35FftHaHu6ZrclnNBKwmbbSA==","url":"https://log.bob.io","dns":"dubious-bob.ct.googleapis.com","mmd":86400,"previous_operators":[ {"name":"Alice's Shady Log","end_time":"2014-11-06T12:00:00Z"}],"state":{"retired":{"timestamp":"2016-04-15T00:00:00Z"}},"temporal_interval":{"start_inclusive":"2014-11-07T12:00:00Z","end_exclusive":"2015-03-07T12:00:00Z"}}]}]}`,

@smeiklej smeiklej merged commit b3e43c4 into google:master Jan 6, 2022
@smeiklej smeiklej deleted the loglist3 branch January 6, 2022 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants