Skip to content

Commit 585cb80

Browse files
committed
timestamp is more useful
1 parent 4a4dccb commit 585cb80

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

ui/app/search/[domain]/page.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ async function getSearchResults(
3939
certificate_sha256,
4040
log_id,
4141
log_index,
42+
entry_timestamp,
4243
not_after,
4344
subject_common_name,
4445
issuer_common_name,
4546
issuer_organization
4647
FROM ct_log_entries_by_name
4748
WHERE name_rev = reverse({query:String}) OR
4849
name_rev LIKE reverse({wildcard:String})
49-
ORDER BY not_after DESC
50+
ORDER BY entry_timestamp DESC
5051
LIMIT {limit:UInt32}
5152
SETTINGS max_execution_time = 10, max_threads = 1, max_memory_usage = 134217728`;
5253
additionalParams.wildcard = `%.${query}`;
@@ -71,6 +72,7 @@ async function getSearchResults(
7172
certificate_sha256,
7273
not_before,
7374
not_after,
75+
entry_timestamp,
7476
subject_common_name,
7577
issuer_common_name,
7678
issuer_organization,
@@ -79,7 +81,7 @@ async function getSearchResults(
7981
FROM ct_log_entries
8082
WHERE ${whereClause}
8183
AND entry_type = 'x509_entry'
82-
ORDER BY not_after DESC
84+
ORDER BY entry_timestamp DESC
8385
LIMIT {limit:UInt32}
8486
SETTINGS max_execution_time = 10, max_threads = 1, max_memory_usage = 134217728
8587
`;
@@ -110,6 +112,10 @@ async function getSearchResults(
110112

111113
if (certMap.has(sha256)) {
112114
// Add this log entry to the existing certificate
115+
const existing = certMap.get(sha256)!;
116+
if (current.entry_timestamp < existing.cert.entry_timestamp) {
117+
existing.cert.entry_timestamp = current.entry_timestamp;
118+
}
113119
certMap.get(sha256)!.logEntries.add(logKey);
114120
} else {
115121
// Create new entry
@@ -125,6 +131,11 @@ async function getSearchResults(
125131
...cert,
126132
ct_log_count: logEntries.size,
127133
}));
134+
data.sort(
135+
(a, b) =>
136+
new Date(b.entry_timestamp).getTime() -
137+
new Date(a.entry_timestamp).getTime(),
138+
);
128139

129140
const headers = resultSet.response_headers;
130141
const summaryHeader = headers["x-clickhouse-summary"];

ui/components/certificate-list.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default function CertificateList(
5858
className="text-left py-1 pr-4 font-medium"
5959
style={{ color: "var(--muted-foreground)" }}
6060
>
61-
Valid Until (UTC)
61+
Timestamp (UTC)
6262
</th>
6363
<th
6464
className="text-left py-1 pr-4 font-medium"
@@ -90,7 +90,7 @@ export default function CertificateList(
9090
{`${cert.issuer_organization} ${cert.issuer_common_name}`}
9191
</td>
9292
<td className="py-0.5 pr-4">
93-
{cert.not_after}
93+
{cert.entry_timestamp}
9494
</td>
9595
<td className="py-0.5 pr-4">
9696
{cert.ct_log_count !== undefined

0 commit comments

Comments
 (0)