Skip to content

Commit 6401227

Browse files
authored
Feature/aws auth fixes (#64)
* Added support for http_timeout_seconds for HTTP calls to allow more time for Artifactory * Fixed secret_ttl_seconds in AWS configmap - Issue #51 * Removed host header from requests to Artifactory to prevent 403 failure
1 parent 32bfdf9 commit 6401227

6 files changed

Lines changed: 35 additions & 5 deletions

File tree

build/build-binary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ for p in "${PLATFORMS[@]}"; do
3030
final_name+='.exe'
3131
fi
3232

33-
env GOOS="$GOOS" GOARCH="$GOARCH" go build -ldflags "-X 'main.Version=$VERSION'" -o $BUILD_DIR/$final_name ../ || errorExit "Building $final_name failed"
33+
env GOOS="$GOOS" GOARCH="$GOARCH" CGO_ENABLED=0 go build -ldflags "-X 'main.Version=$VERSION'" -o $BUILD_DIR/$final_name ../ || errorExit "Building $final_name failed"
3434
done
3535

3636
echo -e "\nDone!\nThe following binaries were created in the bin/ directory:"

helm/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22

33
All notable changes to this Helm chart will be documented in this file.
44

5+
## [1.1.0] - 7th April, 2026
6+
* Added KEP-4412 - Pod Level Identity Support For JFrog Artifactory on GCP
7+
* Added support for `http_timeout_seconds` for HTTP calls
8+
* Fixed `secret_ttl_seconds` in configmap to handle quotes
9+
* Removed `host` header from AWS Signed requests to Artifactory to prevent from overriding host issues on webserver
10+
511
## [1.0.1] - 25th Mar, 2026
612
* Added support for disabling auto-upgrade of binary through `autoUpgrade`
713
* Added support for `aws_region` for `assume_role` authentication method
8-
* Added KEP-4412 - Pod Level Identity Support For JFrog Artifactory on GCP
914

1015
## [1.0.0] - 23rd Feb, 2026
1116
* Allow using an existing ServiceAccount when `serviceAccount.create=false`

helm/templates/configmap-provider.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ data:
7575
"name": "disable_provider_autoupdate",
7676
"value": "{{ not $.Values.autoUpgrade }}"
7777
},
78+
{{- if .http_timeout_seconds }}
79+
{
80+
"name": "http_timeout_seconds",
81+
"value": "{{ .http_timeout_seconds | toJson }}"
82+
},
83+
{{- end }}
7884
{{- if .aws.aws_region }}
7985
{
8086
"name": "aws_region",
@@ -111,7 +117,7 @@ data:
111117
},
112118
{
113119
"name": "secret_ttl_seconds",
114-
"value": {{- if .aws.secret_ttl_seconds }}{{ .aws.secret_ttl_seconds | toJson }}{{ else }}"14400"{{ end }}
120+
"value": {{- if .aws.secret_ttl_seconds }}{{ .aws.secret_ttl_seconds | toString | quote }}{{ else }}"14400"{{ end }}
115121
}
116122
]
117123
}
@@ -130,6 +136,10 @@ data:
130136
value: "{{ .gcp.jfrog_oidc_provider_name }}"
131137
- name: disable_provider_autoupdate
132138
value: "{{ not $.Values.autoUpgrade }}"
139+
{{- if .http_timeout_seconds }}
140+
- name: http_timeout_seconds
141+
value: "{{ .http_timeout_seconds }}"
142+
{{- end }}
133143
{{- end }}
134144

135145
{{- if eq $cloudProvider "azure" }}
@@ -148,6 +158,10 @@ data:
148158
value: "{{ .azure.jfrog_oidc_provider_name }}"
149159
- name: disable_provider_autoupdate
150160
value: "{{ not $.Values.autoUpgrade }}"
161+
{{- if .http_timeout_seconds }}
162+
- name: http_timeout_seconds
163+
value: "{{ .http_timeout_seconds }}"
164+
{{- end }}
151165
{{- end }}
152166
{{- end }}
153167

helm/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ additionalResources: |
6767
providerConfig:
6868
- name: jfrog-credentials-provider
6969
artifactoryUrl: your-org.jfrog.io
70+
# http_timeout_seconds: 30
7071
matchImages:
7172
- "*.jfrog.io"
7273
defaultCacheDuration: 15m

internal/sign/signer.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,5 +427,9 @@ func SignV4a(method string, url string, service string, awsCreds AwsCredentials)
427427
if err != nil {
428428
return nil, err
429429
}
430+
// removing host only from the headers to avoid 403 Forbidden error
431+
// It does exist in CanonicalSignature, Artifactory adds this themseleves so we don't need to add it
432+
// specifically to the headers in the request.
433+
req.Header.Del("Host")
430434
return req, nil
431435
}

main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"jfrog-credential-provider/internal/provider"
2222
"log"
2323
"os"
24+
"strconv"
2425
"time"
2526
)
2627

@@ -71,8 +72,13 @@ func main() {
7172
return
7273

7374
default:
74-
// Default behavior
75-
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
75+
httpTimeout := 30 * time.Second
76+
if v := os.Getenv("http_timeout_seconds"); v != "" {
77+
if n, err := strconv.Atoi(v); err == nil && n > 0 {
78+
httpTimeout = time.Duration(n) * time.Second
79+
}
80+
}
81+
ctx, cancel := context.WithTimeout(context.Background(), httpTimeout)
7682
defer cancel()
7783
provider.StartProvider(ctx, Version)
7884
}

0 commit comments

Comments
 (0)