Repository: google/certificate-transparency-go
Pull request #1095 (2023-06-23 09:08:15)

Add support for "is_all_logs" field in loglist3
Support all_logs_list

### Checklist
- [x] I have updated the [CHANGELOG](CHANGELOG.md).
  - Adjust the draft version number according to [semantic versioning](https://semver.org/) rules.
- [ ] I have updated [documentation](docs/) accordingly.


phbnf: @carlosjoan91 PTAL
carlosjoan91: LGTM, thanks!

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 99e7b88d..f9ea426c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,9 @@
 ### Chrome CT Policy Update
  * #906: Update chromepolicy.go to follow the updated Chrome CT policy.
 
+### LogList
+ * Add support for "is_all_logs" field
+
 ### Misc
  * #1059: Escape forward slashes in certificate Subject names when used as user quota id strings.
 
diff --git a/loglist3/loglist3.go b/loglist3/loglist3.go
index 6c3b23d8..c8172651 100644
--- a/loglist3/loglist3.go
+++ b/loglist3/loglist3.go
@@ -47,6 +47,9 @@ const (
 
 // LogList holds a collection of CT logs, grouped by operator.
 type LogList struct {
+	// IsAllLogs is set to true if the list contains all known logs, not
+	// only usable ones.
+	IsAllLogs bool `json:"is_all_logs,omitempty"`
 	// Version is the version of the log list.
 	Version string `json:"version,omitempty"`
 	// LogListTimestamp is the time at which the log list was published.


Test patch:
diff --git a/loglist3/loglist3_test.go b/loglist3/loglist3_test.go
index 7e214479..56c65d01 100644
--- a/loglist3/loglist3_test.go
+++ b/loglist3/loglist3_test.go
@@ -40,6 +40,7 @@ func mustParseTime(format string, sTime string) time.Time {
 }
 
 var sampleLogList = LogList{
+	IsAllLogs:        true,
 	Version:          "1.1.1c",
 	LogListTimestamp: mustParseTime(time.UnixDate, "Fri Dec 3 11:06:00 UTC 2021"),
 	Operators: []*Operator{
@@ -158,7 +159,7 @@ func TestJSONMarshal(t *testing.T) {
 		{
 			name: "MultiValid",
 			in:   sampleLogList,
-			want: `{"version":"1.1.1c","log_list_timestamp":"2021-12-03T11:06:00Z","operators":[` +
+			want: `{"is_all_logs":true,"version":"1.1.1c","log_list_timestamp":"2021-12-03T11:06:00Z","operators":[` +
 				`{"name":"Google","email":["google-ct-logs@googlegroups.com"],"logs":[` +
 				`{"description":"Google 'Aviator' log","log_id":"aPaY+B9kgr46jO65KB1M/HFRXWeT1ETRCmesu09P+8Q=","key":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1/TMabLkDpCjiupacAlP7xNi0I1JYP8bQFAHDG1xhtolSY1l4QgNRzRrvSe8liE+NPWHdjGxfx3JhTsN9x8/6Q==","url":"https://ct.googleapis.com/aviator/","dns":"aviator.ct.googleapis.com","mmd":86400,"state":{"readonly":{"timestamp":"2016-11-30T13:24:18.33Z","final_tree_head":{"sha256_root_hash":"LcGcZRsm+LGYmrlyC5LXhV1T6OD8iH5dNlb0sEJl9bA=","tree_size":46466472}}},"temporal_interval":{"start_inclusive":"2014-03-07T11:06:00Z","end_exclusive":"2015-03-07T12:00:00Z"}},` +
 				`{"description":"Google 'Icarus' log","log_id":"KTxRllTIOWW6qlD8WAfUt2+/WHopctykwwz05UVH9Hg=","key":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAETtK8v7MICve56qTHHDhhBOuV4IlUaESxZryCfk9QbG9co/CqPvTsgPDbCpp6oFtyAHwlDhnvr7JijXRD9Cb2FA==","url":"https://ct.googleapis.com/icarus/","dns":"icarus.ct.googleapis.com","mmd":86400,"state":{"usable":{"timestamp":"2018-02-27T00:00:00Z"}}},` +