The DataStore is now unused and can be safely removed. See b/407940468
for more details on why this preferences file was removed.
Fixes: 407940468
Test: atest NetworkSecurityUnitTests
Flag: com.android.net.ct.flags.certificate_transparency_service
Change-Id: Ic4427958acef94984f728398bdb9a6f7e53a9cbe
We are trying to reduce the usage of the DataStore, as
it has caused the occasional headache in the past (see
for example ag/32804820).
This CL removes the storing download IDs on disk. Storing
the download IDs is unnecessary anyway, we schedule a new
download on a system_server or device reboot anyway.
Bug: 407940468
Test: atest NetworkSecurityUnitTests
Flag: com.android.net.ct.flags.certificate_transparency_service
Change-Id: I18bc752aa26978f877f669d343d5432f83a36ae4
Test with connectivity/tethering module only, to catch integration issues with older versions of other modules.
Only the unit test are added to the test_mapping for now. The CTS tests are not compatible with older dessert releases.
The min_sdk_version in the test build target should help preventing the
regressions from b/398885474.
Bug: 397130276
Test: on go/abtd
Change-Id: I215758a34901ff048a8279b4a417ef9f4797db0f
This CL adds a check to make sure the public key downloaded by the CTDownloader
matches a known allowlist of keys. If the key does not appear in the allowlist,
we cannot make guarantee that the key has not been tampered with, so we will not
proceed with the downloads of the CT log list and its signature.
Bug: 374719543
Test: atest NetworkSecurityUnitTests
Change-Id: I185a2330d9a4d138c93522cd4b22920e8a2412a2
The signature should be logged _before_ decoded from the Base64
encoding in order to properly compare with what is published on gstatic.
Bug: 391327942
Bug: 378626065
Flag: com.android.net.ct.flags.certificate_transparency_service
Test: atest NetworkSecurityUnitTests
Change-Id: Ibde2d4f45b998f764e2cb8d0772a0536ff763a4a
This CL adds the parsed log list timestamp from the JSON log list, as
well as logging a SUCCESS event (with timestamp and signature) when the
log list has been successfully updated.
Fixes: 391327942
Fixes: 394278886
Bug: 378626065
Flag: com.android.net.ct.flags.certificate_transparency_service
Test: atest NetworkSecurityUnitTests
Change-Id: I8f0d96ca96cd89dce5da588cb478f9332537df48
individually passed parameters
This CL also moves the DataStore updates of the failure count into
CTLogger directly (CTDownloader will only modify the failure count on
complete success).
Note: due to limitations with Mockito (not being able to mock static
classes like the auto-generated CTStatsLog), there is no test class for
CTLoggerImpl.
Bug: 394278886
Bug: 378626065
Flag: com.android.net.ct.flags.certificate_transparency_service
Test: atest NetworkSecurityUnitTests
Change-Id: I4498bfe75e84c6ba1654cfa55912c46836f61e03
As previously discussed, we will be logging the signature to help with
on-path attacker detection. See go/ct-android-notes for summary of the past
discussions. SignatureVerifier has been modified to return a status
object to better capture the various potential signature verification
failure statuses.
The log list timestamp will be added in a later change as
this will require modifying CompatibilityVersion's logic.
Bug: 378626065
Bug: 391327942
Bug: 394278886
Flag: com.android.net.ct.flags.certificate_transparency_service
Test: atest NetworkSecurityUnitTests
Change-Id: I33d08b2d8c0260237bb3c5a66770fdf409adf8b1
All of the auto-generated enum naming in CTStatsLog is over 100+ chars
long, causing there to be numerous lint errors. This CL creates an
intermediate enum to make it easier to reference these status enums
without introducing lint warning fatigue.
Bug: 378626065
Flag: com.android.net.ct.flags.certificate_transparency_service
Test: atest NetworkSecurityUnitTests
Change-Id: I451a006961ee5d801b3fbf702d3f5282d0b02242
The current implementation does not delete the CompatibilityVersion
directory if the killswitch is activated while the device is powered
off.
This CL fixes the bug and centralizes the handling of the killswitch
inside the CertificateTransparencyJob class, instead of spreading it
among multiple classes. Hopefully this change makes the killswitch
logic easier to follow and less-prone to mistakes.
Bug: 384688420
Test: adb shell device_config put network_security CertificateTransparencyLogList__service_enabled true/false
Flag: com.android.net.ct.flags.certificate_transparency_service
Change-Id: Ic1d0d78879753abc42829be18ce15f32a86532c5
The atom no longer just represents log list update failures, and will
instead be representing the entire log list update result regardless of
success or failure.
Flag: com.android.net.ct.flags.certificate_transparency_service
Bug: 378626065
Test: atest NetworkSecurityUnitTests
Change-Id: Ide254542aeb9c9657e79a154e53f651478bb1a54
Previously, we would only log to statsd if a default threshold of 10 had
been met to avoid noise in the logs. Because we will instead be logging
every time a log list update happens (success or failure), we are
removing this threshold logic.
Flag: com.android.net.ct.flags.certificate_transparency_service
Bug: 378626065
Test: atest NetworkSecurityUnitTests
Change-Id: Id3ad2c75fcceb3c15add70d4263f6c443f145348
This CL updates all usages of the atom FKA CertificateTransparencyLogListUpdateFailed, as it's now been renamed to CertificateTransparencyLogListUpdateStatusChanged to include more generic status updates beyond failures.
Change-Id: I32ac454a46d0dd2e10d1ac6388d25c8d5d199f79
Flag: com.android.net.ct.flags.certificate_transparency_service
Bug: 378626065
Test: atest NetworkSecurityUnitTests
To simplify debugging, we are planning to publish the log list signature
as a Base64 encoded string.
It might take a while for the changes to the signature publishing pipeline
to reach prod, and we do not know exactly when that will happen. To avoid
accidental crashes, I added a fallback path to the verifier code that
reverts to use the signature as raw (not Base64 encoded) bytes. I will
remove the fallback path once the signature publishing changes are
finalized.
Bug: 374719543
Test: atest NetworkSecurityUnitTests
Change-Id: Ia785b554b840940dc81b47ac9bc2121c0b410ab0
update failures to statsd
This will allow it easier to debug the logging logic, without needing to
hit the default threshold of 10.
Flag: com.android.net.ct.flags.certificate_transparency_service
Bug: 378626065
Test: atest NetworkSecurityUnitTests && tested flag behavior manually
Change-Id: I10c652615e78a700bb84aabaa37ddc850e031e56
CTLogger
This CL adds a new API that will convert the
DownloadManager.COLUMN_REASON into the relevant proto failure reason
enum value. The reason why it is a new API rather than reusing an
existing one is because the parameter type is the same (int), so a
separate API will keep it clearer when the DownloadManager value vs. proto enum value is directly used.
Flag: com.android.net.ct.flags.certificate_transparency_service
Bug: 378626065
Test: atest NetworkSecurityUnitTests
Change-Id: I9028ba8f2cb95ccc6d21b19c58e0d15a9405c3f7
The task of installing a new log list is now performed by the
CompatibilityVersion class.
Also, each CompatibilityVersion provides the URLs hosting the signature
and log list files. We do not store that information in the DataStore.
Change-Id: I36b585dc6984278de1ab3e6f3dc872e22f06ebea
Flag: com.android.net.ct.flags.certificate_transparency_service
Bug: 377276991
Test: atest NetworkSecurityUnitTests
verification
Note: InvalidKeyExceptions may be thrown for other reasons (e.g.
signature algorithm not matching), hence the addition of a new Exception
to specify when the public key is missing.
Flag: com.android.net.ct.flags.certificate_transparency_service
Fixes: 384931263
Bug: 378626065
Test: atest NetworkSecurityUnitTests
Change-Id: I67341b1e2d169cf634e45ca84eb24e3a1f6d887e
The failure count for CTLogListUpdateFailed is an integer, not a long.
We need APIs in DataStore to handle this different data type, as
otherwise it will result in an unnecessary cast from long <-> int, which
is a lossy conversion.
Bug: 384473786
Test: atest NetworkSecurityUnitTests
Change-Id: I3b31fc9faef4ac0dec77bc5adb8235a155a4a3d1
We plan on only logging failure metrics after 10
consecutive failures, so we need some way of storing it.
Fixes: 384473786
Test: atest NetworkSecurityUnitTests
Change-Id: Ib316309864c536893d08be2dc59b8a70965ebde6
Since we are moving away from runtime flags, the CT URLs for the log
list, signature, and public key will be hardcoded. I took the occasion
to simplify the logic for handling the Android CT properties and removed
the various "_PENDING" properties. They were making everything much
harder to follow.
Flag: com.android.net.ct.flags.certificate_transparency_job
Bug: 319829948
Test: NetworkSecurityUnitTests
Change-Id: I74bb946eccb5f376ee161ace2f151bf6ea1bdcff
The SignatureVerifier class allows setting a public key either as a
string or as a file. The former method is used when the key is read from
a flag via the CertificateTransparencyFlagsListener. The latter method
is used when the key is downloaded as a file by the daily
CertificateTransparencyJob.
This CL also adds an additional step to download a public key from a
URL via the CertificateTransparencyDownloader. Now the class goes
through the following steps:
1. Download a public key from the public key url,
2. If successful, download a log list signature from the metadata url,
3. If successful, download log list from the content url,
4. If successful, verifiy the log list using signature and public key,
5. If successufl, install the log list.
I also realized the CertificateTransparencyDownloaderTest was really
hard to understand, even for me that I wrote it xD
I attempted to clean up the test, hopefully it is a bit clearer now.
I'll probably make a second simplification pass in a follow-up CL.
Flag: com.android.net.ct.flags.certificate_transparency_job
Bug: 319829948
Test: NetworkSecurityUnitTests
Change-Id: I2be3e8b5895182d2afd8161aa44e54e1a6021685
This CL adds a DownloadStatus class inside the DownloadHelper. The class
acts as a thin wrapper around the status and reason Ids returned by the
DownloadManager, with some utility methods to help with the
interpretation of the download status.
Bug: 319829948
Test: atest NetworkSecurityUnitTests
Change-Id: I111388ee37c09e30c02bb9bc9b3d65273961b91d
Introduce a CompatibilityVersion class to group installing operations on
log list related to the same compatibility version (e.g, v3).
Add support for multiple compatibility versions to the
CertificateTransparencyInstaller, although at the moment of writing
there exists only one compatibility version.
Test: atest NetworkSecurityUnitTests
Bug: 319829948
Change-Id: I503dd30cea93d2b1ba57e5ac91b8427394c453f8
Instead of hard-coding the public key value in code.
Flag: com.android.net.ct.flags.certificate_transparency_service
Bug: 319829948
Test: atest NetworkSecurityUnitTests
Change-Id: Ided9a9402241d91cae3cee25f5511c3a881e087d
modules should specify the submodule of java_sdk_library that the module
actually depends on
Test: CI
Bug: 358613520
Change-Id: I0367068c901df98483f6cf95160d3e7801881b0a
The verification step assumes the metadata file, downloaded together with
the log list data, contains a signature generated using the public key
available at the certificate-transparency-community-site from Google
https://github.com/google/certificate-transparency-community-site/blob/master/docs/google/known-logs.md
Flag: com.android.net.ct.flags.certificate_transparency_service
Bug: 319829948
Test: atest NetworkSecurityUnitTests
Change-Id: If5fefb33b00c49a8f043d9b030f344f7917affbc
Add the CertificateTransparencyInstaller, that is in charge of
atomically update the log list file that is read by SCT verification in
Conscrypt.
Flag: com.android.net.ct.flags.certificate_transparency_service
Bug: 319829948
Test: atest NetworkSecurityUnitTests
Change-Id: I7c82e36820256bc0df11e44fd973b25a64d69f54
Add the CertificateTransparencyDownloader to download the data and
metadata needed by Certificate Transparency.
The download is triggered when either the content URL, the metadata URL,
or the log list flags change.
The version numbers and URLs are stored in an on-disk DataStore to make
sure the same files are not downloaded on repeated flag updates.
Flag: com.android.ct.flags.certificate_transparency_service
Bug: 319829948
Test: atest NetworkSecurityUnitTests
Change-Id: Ic30e2973fdce99ea861d13f7777128161dd4003e