Skip to content

Require signed copy source headers in SigV4 requests - #85

Open
zhijian-pro wants to merge 1 commit into
new-basefrom
require-signed-copy-headers
Open

Require signed copy source headers in SigV4 requests#85
zhijian-pro wants to merge 1 commit into
new-basefrom
require-signed-copy-headers

Conversation

@zhijian-pro

Copy link
Copy Markdown

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused validation change is correct and comprehensively covered across supported SigV4 request paths.

Pull request overview

Requires all x-amz-copy-source* headers in SigV4 requests to be signed.

Changes:

  • Rejects unsigned copy-source headers.
  • Adds direct, streaming, presigned, and routed copy tests.
  • Updates existing copy tests to sign headers after setting them.
File summaries
File Description
cmd/signature-v4-utils.go Enforces signed copy-source headers.
cmd/signature-v4-copy_test.go Adds comprehensive authorization coverage.
cmd/object-handlers_test.go Signs complete copy requests.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/signature-v4-utils.go
}
// Copy headers can turn an upload into a read of another object, or change
// the source range and conditions. Require them to be covered by the signature.
for header := range reqHeaders {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

根据sigv4定义, 所有x-amz都需要. 另外这个检测逻辑应该前置, 放到函数host判断之后吧

X-Amz-SignedHeaders
Lists the headers that you used to calculate the signature.
The following headers are required in the signature calculations:

The HTTP host header.
Any x-amz- headers that you plan to add to the request.*
(Note: For added security, you should sign all the request headers that you plan to include in your request.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants