Skip to content

Commit 60b1915

Browse files
authored
Merge pull request #112 from MPritsch/proxy-variables
feat: provide option to set http_proxy variable
2 parents 63f7aff + 6c7000a commit 60b1915

5 files changed

Lines changed: 17 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ For a local development setup, please take a look at
119119
| `defectDojoVerified` | `"false"` | Specifies whether findings should be marked as verified in DefectDojo. |
120120
| `defectDojoDoNotReactivate` | `"true"` | If true the importing/reimporting will ignore uploaded active findings and not reactivate previously closed findings, while still creating new findings if there are new ones |
121121
| `reports` | `"vulnerabilityreports"` | Comma-separated list of reports that should be sent to DefectDojo. Possibilities: vulnerabilityreports, rbacassessmentreports, infraassessmentreports, configauditreports, exposedsecretreports |
122+
| `http_proxy` | `""` | Option to set http_proxy variable |
123+
| `https_proxy` | `""` | Option to set https_proxy variable |
122124

123125
### A note on eval
124126

charts/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ spec:
9797
value: {{ quote .Values.operator.trivyDojoReportOperator.env.reports }}
9898
- name: KUBERNETES_CLUSTER_DOMAIN
9999
value: {{ quote .Values.kubernetesClusterDomain }}
100+
- name: HTTP_PROXY
101+
value: {{ quote .Values.operator.trivyDojoReportOperator.env.http_proxy }}
102+
- name: HTTPS_PROXY
103+
value: {{ quote .Values.operator.trivyDojoReportOperator.env.https_proxy }}
100104
image: {{ .Values.operator.trivyDojoReportOperator.image.repository }}:{{ .Values.operator.trivyDojoReportOperator.image.tag | default .Chart.AppVersion }}
101105
livenessProbe:
102106
httpGet:

charts/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ operator:
5252
defectDojoTestTitle: Kubernetes
5353
defectDojoVerified: "false"
5454
reports: vulnerabilityreports
55+
http_proxy: ""
56+
https_proxy: ""
5557
image:
5658
repository: ghcr.io/telekom-mms/docker-trivy-dojo-operator
5759
tag: 0.8.7

src/handlers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
c = prometheus.Counter("requests_total", "HTTP Requests", ["status"])
1818

19+
if settings.HTTP_PROXY or settings.HTTPS_PROXY:
20+
proxies = {
21+
"http": settings.HTTP_PROXY,
22+
"https": settings.HTTPS_PROXY,
23+
}
1924

2025
def check_allowed_reports(report: str):
2126
allowed_reports: list[str] = [
@@ -162,6 +167,7 @@ def send_to_dojo(body, meta, logger, **_):
162167
data=data,
163168
files=report_file,
164169
verify=True,
170+
proxies=proxies,
165171
)
166172
response.raise_for_status()
167173
except HTTPError as http_err:

src/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@
7474
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO").upper()
7575

7676
REPORTS: list = os.getenv("REPORTS", "vulnerabilityreports").split(",")
77+
78+
HTTP_PROXY: str = os.getenv("HTTP_PROXY") or os.getenv("http_proxy")
79+
HTTPS_PROXY: str = os.getenv("HTTPS_PROXY") or os.getenv("https_proxy")

0 commit comments

Comments
 (0)