Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions verifier_tools/verify/cmd/verifier/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ import (
// Domain separation prefix for Merkle tree hashing with second preimage
// resistance similar to that used in RFC 6962.
const (
LeafHashPrefix = 0
KeyNameForVerifierPixel = "pixel_transparency_log"
KeyNameForVerifierG1PJWT = "developers.google.com/android/binary_transparency/google1p/0"
KeyNameForVerifierG1PAPK = "gstatic.com/android/binary_transparency/google1p/apk/2026/0"
LogBaseURLPixel = "https://developers.google.com/android/binary_transparency"
LogBaseURLG1PJWT = "https://developers.google.com/android/binary_transparency/google1p"
LogBaseURLG1PAPK = "https://www.gstatic.com/android/binary_transparency/google1p/apk/2026/01"
ImageInfoFilename = "image_info.txt"
PackageInfoFilename = "package_info.txt"
LeafHashPrefix = 0
KeyNameForVerifierPixel = "pixel_transparency_log"
KeyNameForVerifierG1PJWT = "developers.google.com/android/binary_transparency/google1p/0"
KeyNameForVerifierG1PAPK = "gstatic.com/android/binary_transparency/google1p/apk/2026/0"
KeyNameForVerifierMainlineModule = "gstatic.com/android/binary_transparency/mainline/modules/2026/0"
LogBaseURLPixel = "https://developers.google.com/android/binary_transparency"
LogBaseURLG1PJWT = "https://developers.google.com/android/binary_transparency/google1p"
LogBaseURLG1PAPK = "https://www.gstatic.com/android/binary_transparency/google1p/apk/2026/01"
LogBaseURLMainlineModule = "https://www.gstatic.com/android/binary_transparency/mainline/2026/01"
ImageInfoFilename = "image_info.txt"
PackageInfoFilename = "package_info.txt"
ModuleInfoFilename = "module_info.txt"
)

// See https://developers.google.com/android/binary_transparency/pixel_tech_details#log_implementation.
Expand All @@ -57,12 +60,19 @@ var pixelLogPubKey []byte
//go:embed log_pub_key.google_system_apk.pem
var googleSystemAppLogPubKey []byte

// See https://developers.google.com/android/binary_transparency/google_apk/log_details#log_implementation.
//
//go:embed log_pub_key.google_apk.pem
var googleAPKLogPubKey []byte

// See https://developers.google.com/android/binary_transparency/mainline_modules/log_details#log_implementation.
//
//go:embed log_pub_key.mainline_module.pem
var mainlineModuleLogPubKey []byte

var (
payloadPath = flag.String("payload_path", "", "Path to the payload describing the binary of interest.")
logType = flag.String("log_type", "", "Which log: 'pixel' or 'google_1p_code' or 'google_1p_apk'.")
logType = flag.String("log_type", "", "Which log: 'pixel' or 'google_1p_code' or 'google_1p_apk' or 'mainline_module'.")
)

func main() {
Expand Down Expand Up @@ -91,7 +101,7 @@ func main() {
var tileHeight int
switch *logType {
case "":
slog.Error("must specify which log to verify against: 'pixel' or 'google_1p_code' or 'google_1p_apk'")
slog.Error("must specify which log to verify against using '--log_type' flag: {pixel, google_1p_code, google_1p_apk, mainline_module}")
os.Exit(1)
case "pixel":
logPubKey = pixelLogPubKey
Expand All @@ -111,6 +121,12 @@ func main() {
keyNameForVerifier = KeyNameForVerifierG1PAPK
binaryInfoFilename = PackageInfoFilename
tileHeight = 8
case "mainline_module":
logPubKey = mainlineModuleLogPubKey
logBaseURL = LogBaseURLMainlineModule
keyNameForVerifier = KeyNameForVerifierMainlineModule
binaryInfoFilename = ModuleInfoFilename
tileHeight = 8
default:
slog.Error("unsupported log type")
os.Exit(1)
Expand Down
4 changes: 4 additions & 0 deletions verifier_tools/verify/internal/checkpoint/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const (
originIDG1P = "developers.google.com/android/binary_transparency/google1p/0\n"
// originIDG1PAPK identifies a checkpoint for the Google 1P APK Transparency Log.
originIDG1PAPK = "gstatic.com/android/binary_transparency/google1p/apk/2026/0\n"
// originIDMainlineModule identifies a checkpoint for the Android Mainline Module Transparency Log.
originIDMainlineModule = "gstatic.com/android/binary_transparency/mainline/modules/2026/0\n"
)

type verifier interface {
Expand Down Expand Up @@ -119,6 +121,8 @@ func parseCheckpoint(ckpt string) (Root, error) {
body = ckpt[len(originIDG1P):]
case strings.HasPrefix(ckpt, originIDG1PAPK):
body = ckpt[len(originIDG1PAPK):]
case strings.HasPrefix(ckpt, originIDMainlineModule):
body = ckpt[len(originIDMainlineModule):]
Comment on lines +124 to +125

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The error message in the default case of parseCheckpoint (line 127) was not updated to include the new originIDMainlineModule. It should be updated to list all four supported origins to avoid misleading error messages when an invalid checkpoint is parsed.

For example:

	default:
		return Root{}, fmt.Errorf("invalid checkpoint - unknown origin, must be either %s, %s, %s, or %s", originIDPixel, originIDG1P, originIDG1PAPK, originIDMainlineModule)

default:
return Root{}, fmt.Errorf("invalid checkpoint - unknown origin, must be either %s, %s, or %s", originIDPixel, originIDG1P, originIDG1PAPK)
}
Expand Down