pipe subcommand ignores --sse-kms-encryption-context flag

Open Beginner friendly
#41 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
aws, go
Domain
cli

Research direction

Read command/pipe.go around lines 71 and 197, then compare the flag lookup with command/cp.go around line 379. Inspect e2e/pipe_test.go and the helpers in e2e/util_test.go to see how encryption context is checked; run the pipe end-to-end test. Done when the flag value reaches the upload request and the test verifies the context.

Written by the indexing model from the issue text.

Description

Description of Bug & Impact

In command/pipe.go, the flag for KMS encryption context is defined as:

cli.StringFlag{
    Name:  "sse-kms-encryption-context",
    Usage: "an optional KMS encryption context",
}

(see command/pipe.go#L71).

However, in command/pipe.go#L197, the value is read via:

kmsKeyContext := c.String("sse-context")

Because "sse-context" is not a registered flag name on the subcommand, c.String("sse-context") always evaluates to an empty string. Consequently, any --sse-kms-encryption-context passed to s5cmd pipe is silently ignored and omitted from the S3 upload request.

(In contrast, command/cp.go#L379 correctly queries c.String("sse-kms-encryption-context").)

Root Cause & Test Coverage Gap

In e2e/pipe_test.go#L487-L532, ensureEncryptionContext(...) is called, but in e2e/util_test.go#L589 and L642-L645, the mock/check helper never compares or verifies the KMS encryption context on the resulting S3 object. The existing end-to-end test passes even with the flag name mismatch present.

Proposed Fix

In command/pipe.go:

-	kmsKeyContext := c.String("sse-context")
+	kmsKeyContext := c.String("sse-kms-encryption-context")

And update e2e/util_test.go so ensureS3Object / ensureEncryptionContext actively asserts the context received by the fake/mock S3 backend.

Dominant language
Go
Stars
46
Forks
13
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anthropics/s5cmd

All issues in anthropics/s5cmd

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.