From c7c2bd7df95f5bc9ef2da2fa9e60ac0b53574a62 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 09:27:53 +0100 Subject: [PATCH] ax(ueps): rename tag to tagByte in ReadAndVerify loop (AX-1 predictable names) `tag` is not in the accepted single-letter exception list (i, _, t, c). `tagByte` is self-describing: the byte value of the TLV tag field. Co-Authored-By: Charon --- pkg/ueps/reader.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/ueps/reader.go b/pkg/ueps/reader.go index bba43f6..289562b 100644 --- a/pkg/ueps/reader.go +++ b/pkg/ueps/reader.go @@ -35,13 +35,13 @@ func ReadAndVerify(reader *bufio.Reader, sharedSecret []byte) (*ParsedPacket, er // Loop through TLVs until we hit Payload (0xFF) or EOF for { // 1. Read Tag - tag, err := reader.ReadByte() + tagByte, err := reader.ReadByte() if err != nil { return nil, err } // 2. Handle Payload Tag (0xFF) - The Exit Condition - if tag == TagPayload { + if tagByte == TagPayload { // Payload is length-prefixless; caller frames the stream. // HMAC covers signedData (header TLVs) + raw payload bytes, not the 0xFF tag. remaining, err := io.ReadAll(reader) @@ -65,31 +65,31 @@ func ReadAndVerify(reader *bufio.Reader, sharedSecret []byte) (*ParsedPacket, er return nil, err } - switch tag { + switch tagByte { case TagVersion: header.Version = tagValue[0] // Reconstruct signed data: Tag + Len + Val - signedData.WriteByte(tag) + signedData.WriteByte(tagByte) signedData.WriteByte(byte(tagLength)) signedData.Write(tagValue) case TagCurrentLayer: header.CurrentLayer = tagValue[0] - signedData.WriteByte(tag) + signedData.WriteByte(tagByte) signedData.WriteByte(byte(tagLength)) signedData.Write(tagValue) case TagTargetLayer: header.TargetLayer = tagValue[0] - signedData.WriteByte(tag) + signedData.WriteByte(tagByte) signedData.WriteByte(byte(tagLength)) signedData.Write(tagValue) case TagIntent: header.IntentID = tagValue[0] - signedData.WriteByte(tag) + signedData.WriteByte(tagByte) signedData.WriteByte(byte(tagLength)) signedData.Write(tagValue) case TagThreatScore: header.ThreatScore = binary.BigEndian.Uint16(tagValue) - signedData.WriteByte(tag) + signedData.WriteByte(tagByte) signedData.WriteByte(byte(tagLength)) signedData.Write(tagValue) case TagHMAC: @@ -97,7 +97,7 @@ func ReadAndVerify(reader *bufio.Reader, sharedSecret []byte) (*ParsedPacket, er // We do NOT add the HMAC itself to signedData default: // Unknown tag (future proofing), verify it but ignore semantics - signedData.WriteByte(tag) + signedData.WriteByte(tagByte) signedData.WriteByte(byte(tagLength)) signedData.Write(tagValue) }