From f592201e4ca9d3dc0cbd83553b42faa09cb027e4 Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Mon, 10 Jul 2023 11:18:50 -0400 Subject: [PATCH] Limit attachment controller tags to UA platform (instead of platform and version) --- .../textsecuregcm/controllers/AttachmentControllerV2.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV2.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV2.java index cd9ade9a0..3a3177b0f 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV2.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV2.java @@ -11,6 +11,7 @@ import com.codahale.metrics.annotation.Timed; import com.google.common.net.HttpHeaders; import io.dropwizard.auth.Auth; import io.micrometer.core.instrument.Metrics; +import io.micrometer.core.instrument.Tags; import io.swagger.v3.oas.annotations.tags.Tag; import java.security.SecureRandom; import java.time.ZoneOffset; @@ -60,10 +61,10 @@ public class AttachmentControllerV2 { ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC); long attachmentId = generateAttachmentId(); String objectName = String.valueOf(attachmentId); - Pair policy = policyGenerator.createFor(now, String.valueOf(objectName), 100 * 1024 * 1024); + Pair policy = policyGenerator.createFor(now, objectName, 100 * 1024 * 1024); String signature = policySigner.getSignature(now, policy.second()); - Metrics.counter(CREATE_UPLOAD_COUNTER_NAME, UserAgentTagUtil.getUserAgentTags(userAgent)).increment(); + Metrics.counter(CREATE_UPLOAD_COUNTER_NAME, Tags.of(UserAgentTagUtil.getPlatformTag(userAgent))).increment(); return new AttachmentDescriptorV2(attachmentId, objectName, policy.first(), "private", "AWS4-HMAC-SHA256",