rich7420 commented on code in PR #11061:
URL: https://github.com/apache/ozone/pull/11061#discussion_r3843847624


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/SignedChunksInputStream.java:
##########
@@ -72,10 +77,22 @@
 public class SignedChunksInputStream extends InputStream {
 
   private final Pattern signatureLinePattern =
-      Pattern.compile("([0-9A-Fa-f]+);chunk-signature=.*");
+      Pattern.compile("([0-9A-Fa-f]+);chunk-signature=(.*)");
 
   private final InputStream originalStream;
 
+  /** Verifies each chunk signature, or {@code null} to skip verification. */
+  private ChunksValidator validator;
+
+  /** SHA-256 of the current chunk payload; {@code null} when not verifying. */
+  private MessageDigest chunkDigest;
+
+  /** Set on the first read; blocks attaching a validator once reading began. 
*/
+  private boolean readStarted;

Review Comment:
   The signing key is derived by OM and only available after openKey 
(HDDS-15140), while this stream is built earlier from the request body. It is 
attached after openKey and before the first read, so it is never attached once 
reading has started. The readStarted guard only rejects a caller that does.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to