diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2025-10-31 20:59:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-31 20:59:44 -0700 |
| commit | b7e3284fc531f1d1c2aced0c6baf29301ff41b43 (patch) | |
| tree | f73ceceb565a4b1ad0056c95b3ba3b42108dcce1 /weed/s3api/chunked_reader_v4_test.go | |
| parent | f096b067fd2171919810d6e9536e9068b899f7db (diff) | |
| download | seaweedfs-b7e3284fc531f1d1c2aced0c6baf29301ff41b43.tar.xz seaweedfs-b7e3284fc531f1d1c2aced0c6baf29301ff41b43.zip | |
S3: fix TestSignedStreamingUploadInvalidSignature test (#7421)
* Added continue statements after all state transitions in the state machine to ensure immediate state processing
* simplify
* remove redundant continue clause
* ensure wrong signature
Diffstat (limited to 'weed/s3api/chunked_reader_v4_test.go')
| -rw-r--r-- | weed/s3api/chunked_reader_v4_test.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/weed/s3api/chunked_reader_v4_test.go b/weed/s3api/chunked_reader_v4_test.go index c9bad1d8a..b797bf340 100644 --- a/weed/s3api/chunked_reader_v4_test.go +++ b/weed/s3api/chunked_reader_v4_test.go @@ -285,7 +285,16 @@ func TestSignedStreamingUploadInvalidSignature(t *testing.T) { // Build the chunked payload with INTENTIONALLY WRONG chunk signature // We'll use a modified signature to simulate a tampered request - wrongChunkSignature := strings.Replace(chunk1Signature, "a", "b", 1) + wrongChunkSignatureBytes := []byte(chunk1Signature) + if len(wrongChunkSignatureBytes) > 0 { + // Flip the first hex character to guarantee a different signature + if wrongChunkSignatureBytes[0] == '0' { + wrongChunkSignatureBytes[0] = '1' + } else { + wrongChunkSignatureBytes[0] = '0' + } + } + wrongChunkSignature := string(wrongChunkSignatureBytes) payload := fmt.Sprintf("400;chunk-signature=%s\r\n%s\r\n", wrongChunkSignature, chunk1Data) + fmt.Sprintf("0;chunk-signature=%s\r\n\r\n", finalSignature) |
