aws-sdk-go-v2: github.com/aws/aws-sdk-go-v2/aws/signer/internal/v4 Index | Files

package v4

import "github.com/aws/aws-sdk-go-v2/aws/signer/internal/v4"

Index

Package Files

const.go header_rules.go headers.go util.go

Constants

const (
    // EmptyStringSHA256 is the hex encoded sha256 value of an empty string
    EmptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`

    // UnsignedPayload indicates that the request payload body is unsigned
    UnsignedPayload = "UNSIGNED-PAYLOAD"

    // AmzAlgorithmKey indicates the signing algorithm
    AmzAlgorithmKey = "X-Amz-Algorithm"

    // AmzSecurityTokenKey indicates the security token to be used with temporary credentials
    AmzSecurityTokenKey = "X-Amz-Security-Token"

    // AmzDateKey is the UTC timestamp for the request in the format YYYYMMDD'T'HHMMSS'Z'
    AmzDateKey = "X-Amz-Date"

    // AmzExpiresKey indicates the interval of time the presigned is valid for
    AmzExpiresKey = "X-Amz-Expires"

    // AmzCredentialKey is the access key ID and credential scope
    AmzCredentialKey = "X-Amz-Credential"

    // AmzSignedHeadersKey is the set of headers signed for the request
    AmzSignedHeadersKey = "X-Amz-SignedHeaders"

    // AmzSignatureKey is the query parameter to store the SigV4 signature
    AmzSignatureKey = "X-Amz-Signature"

    // TimeFormat is the time format to be used in the X-Amz-Date header or query parameter
    TimeFormat = "20060102T150405Z"

    // ShortTimeFormat is the shorten time format used in the credential scope
    ShortTimeFormat = "20060102"
)

Variables

var AllowedQueryHoisting = InclusiveRules{
    Blacklist{RequiredSignedHeaders},
    Patterns{"X-Amz-"},
}

AllowedQueryHoisting is a whitelist for Build query headers. The boolean value represents whether or not it is a pattern.

var IgnoredHeaders = Rules{
    Blacklist{
        MapRule{
            "Authorization":   struct{}{},
            "User-Agent":      struct{}{},
            "X-Amzn-Trace-Id": struct{}{},
        },
    },
}

IgnoredHeaders is a list of headers that are ignored during signing

var RequiredSignedHeaders = Rules{
    Whitelist{
        MapRule{
            "Cache-Control":                         struct{}{},
            "Content-Disposition":                   struct{}{},
            "Content-Encoding":                      struct{}{},
            "Content-Language":                      struct{}{},
            "Content-Md5":                           struct{}{},
            "Content-Type":                          struct{}{},
            "Expires":                               struct{}{},
            "If-Match":                              struct{}{},
            "If-Modified-Since":                     struct{}{},
            "If-None-Match":                         struct{}{},
            "If-Unmodified-Since":                   struct{}{},
            "Range":                                 struct{}{},
            "X-Amz-Acl":                             struct{}{},
            "X-Amz-Copy-Source":                     struct{}{},
            "X-Amz-Copy-Source-If-Match":            struct{}{},
            "X-Amz-Copy-Source-If-Modified-Since":   struct{}{},
            "X-Amz-Copy-Source-If-None-Match":       struct{}{},
            "X-Amz-Copy-Source-If-Unmodified-Since": struct{}{},
            "X-Amz-Copy-Source-Range":               struct{}{},
            "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": struct{}{},
            "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key":       struct{}{},
            "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5":   struct{}{},
            "X-Amz-Grant-Full-control":                                    struct{}{},
            "X-Amz-Grant-Read":                                            struct{}{},
            "X-Amz-Grant-Read-Acp":                                        struct{}{},
            "X-Amz-Grant-Write":                                           struct{}{},
            "X-Amz-Grant-Write-Acp":                                       struct{}{},
            "X-Amz-Metadata-Directive":                                    struct{}{},
            "X-Amz-Mfa":                                                   struct{}{},
            "X-Amz-Request-Payer":                                         struct{}{},
            "X-Amz-Server-Side-Encryption":                                struct{}{},
            "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id":                 struct{}{},
            "X-Amz-Server-Side-Encryption-Customer-Algorithm":             struct{}{},
            "X-Amz-Server-Side-Encryption-Customer-Key":                   struct{}{},
            "X-Amz-Server-Side-Encryption-Customer-Key-Md5":               struct{}{},
            "X-Amz-Storage-Class":                                         struct{}{},
            "X-Amz-Website-Redirect-Location":                             struct{}{},
            "X-Amz-Content-Sha256":                                        struct{}{},
        },
    },
    Patterns{"X-Amz-Meta-"},
}

RequiredSignedHeaders is a whitelist for Build canonical headers.

func GetURIPath Uses

func GetURIPath(u *url.URL) string

GetURIPath returns the escaped URI component from the provided URL

func StripExcessSpaces Uses

func StripExcessSpaces(vals []string)

StripExcessSpaces will rewrite the passed in slice's string values to not contain muliple side-by-side spaces.

type Blacklist Uses

type Blacklist struct {
    Rule
}

Blacklist is a generic Rule for blacklisting

func (Blacklist) IsValid Uses

func (b Blacklist) IsValid(value string) bool

IsValid for Whitelist checks if the value is within the Whitelist

type InclusiveRules Uses

type InclusiveRules []Rule

InclusiveRules rules allow for rules to depend on one another

func (InclusiveRules) IsValid Uses

func (r InclusiveRules) IsValid(value string) bool

IsValid will return true if all rules are true

type MapRule Uses

type MapRule map[string]struct{}

MapRule generic Rule for maps

func (MapRule) IsValid Uses

func (m MapRule) IsValid(value string) bool

IsValid for the map Rule satisfies whether it exists in the map

type Patterns Uses

type Patterns []string

Patterns is a list of strings to match against

func (Patterns) IsValid Uses

func (p Patterns) IsValid(value string) bool

IsValid for Patterns checks each pattern and returns if a match has been found

type Rule Uses

type Rule interface {
    IsValid(value string) bool
}

Rule interface allows for more flexible rules and just simply checks whether or not a value adheres to that Rule

type Rules Uses

type Rules []Rule

Rules houses a set of Rule needed for validation of a string value

func (Rules) IsValid Uses

func (r Rules) IsValid(value string) bool

IsValid will iterate through all rules and see if any rules apply to the value and supports nested rules

type Whitelist Uses

type Whitelist struct {
    Rule
}

Whitelist is a generic Rule for whitelisting

func (Whitelist) IsValid Uses

func (w Whitelist) IsValid(value string) bool

IsValid for Whitelist checks if the value is within the Whitelist

Package v4 imports 3 packages (graph) and is imported by 1 packages. Updated 2020-04-29. Refresh now. Tools for package owners.