Skip to content

Commit 9a8e857

Browse files
authored
Merge branch 'main' into fix/cluster-cache-list
2 parents 1a59006 + 20f5fc8 commit 9a8e857

31 files changed

Lines changed: 814 additions & 337 deletions

CHANGELOG/release-notes-v2.0.0.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## v2.0.0
2+
3+
## Enhancements
4+
- feat: Rollout 5.2.0 (#6889)
5+
- feat: Added support for tcp in virtual service and changed the apiVersion for externalSecrets (#6892)
6+
- feat: add helm_take_ownership and helm_redeployment_request columns to user_deployment_request table (#6888)
7+
- feat: Revamped Devtron UI with multiple dashboards (#6884)
8+
- feat: Added support to override container name (#6880)
9+
- feat: Increase max length for TeamRequest name field (#6876)
10+
- feat: Added namespace support for virtualService and destinationRule (#6868)
11+
- feat: feature flag for encryption (#6856)
12+
- feat: encryption for db credentials (#6852)
13+
## Bugs
14+
- fix: migrate proxy chart dependencies and refactor related functions (#6899)
15+
- fix: enhance validation and error handling in cluster update process (#6887)
16+
- fix: Invalid type casting error for custom charts (#6883)
17+
- fix: validation on team name (#6872)
18+
- fix: sql injection (#6861)
19+
- fix: user manager fix (#6854)
20+
## Others
21+
- misc: Add support for migrating plugin metadata to parent metadata (#6902)
22+
- misc: update UserDeploymentRequestWithAdditionalFields struct to include tableName for PostgreSQL compatibility (#6896)
23+
- chore: rename SQL migration files for consistency (#6885)
24+
- misc: Vc empty ns fix (#6871)
25+
- misc: added validation on create environment (#6859)
26+
- misc: migration unique constraint on mpc (#6851)
27+
- misc: helm app details API spec (#6850)
28+
- misc: api Spec Added for draft (#6849)
29+
- misc: api Specs added for lock config (#6847)
30+
31+

api/restHandler/ImageScanRestHandler.go

Lines changed: 47 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -428,99 +428,55 @@ func (impl ImageScanRestHandlerImpl) VulnerabilitySummary(w http.ResponseWriter,
428428
return
429429
}
430430

431-
// Create ImageScanRequest with filters for fetching deploy info
432-
request := &securityBean.ImageScanRequest{
433-
ImageScanFilter: bean.ImageScanFilter{
434-
EnvironmentIds: summaryRequest.EnvironmentIds,
435-
ClusterIds: summaryRequest.ClusterIds,
436-
},
437-
}
438-
439-
deployInfoList, err := impl.imageScanService.FetchAllDeployInfo(request)
440-
if err != nil {
441-
impl.logger.Errorw("service err, VulnerabilitySummary", "err", err)
442-
if util.IsErrNoRows(err) {
443-
emptySummary := &securityBean.VulnerabilitySummary{
444-
TotalVulnerabilities: 0,
445-
SeverityCount: &securityBean.SeverityCount{
446-
Critical: 0,
447-
High: 0,
448-
Medium: 0,
449-
Low: 0,
450-
Unknown: 0,
451-
},
452-
FixableVulnerabilities: 0,
453-
NotFixableVulnerabilities: 0,
454-
}
455-
common.WriteJsonResp(w, nil, emptySummary, http.StatusOK)
456-
} else {
457-
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
458-
}
459-
return
460-
}
461-
462-
filteredDeployInfoList, err := impl.imageScanService.FilterDeployInfoByScannedArtifactsDeployedInEnv(deployInfoList)
463-
if err != nil {
464-
impl.logger.Errorw("request err, FilterDeployInfoListForScannedArtifacts", "err", err)
465-
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
466-
return
467-
}
468-
469-
_, rbacSpan := otel.Tracer("imageScanRestHandler").Start(ctx, "RBACProcessing")
431+
// Check if user is super admin first - this determines the optimization path
432+
_, rbacSpan := otel.Tracer("imageScanRestHandler").Start(ctx, "RBACCheck")
470433
token := r.Header.Get("token")
471-
isSuperAdmin := false
472-
if ok := impl.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionGet, "*"); ok {
473-
isSuperAdmin = true
474-
}
434+
isSuperAdmin := impl.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionGet, "*")
435+
rbacSpan.End()
436+
475437
var ids []int
438+
476439
if isSuperAdmin {
477-
ids = sliceUtil.NewSliceFromFuncExec(filteredDeployInfoList, func(item *security2.ImageScanDeployInfo) int {
478-
return item.Id
479-
})
440+
// OPTIMIZATION: For super-admin users, skip deploy info fetching and filtering entirely
441+
// The GetVulnerabilityRawData query already handles all filtering (env, cluster, app) at DB level
442+
// When ids is empty, it doesn't apply RBAC filtering, which is correct for super-admins
443+
ids = nil
480444
} else {
445+
// OPTIMIZATION: For non-super-admin users, use optimized single query
446+
_, fetchSpan := otel.Tracer("imageScanRestHandler").Start(ctx, "FetchScannedDeployInfo")
447+
filteredDeployInfoList, err := impl.imageScanService.FetchScannedDeployInfoWithFilters(ctx, summaryRequest.EnvironmentIds, summaryRequest.ClusterIds)
448+
fetchSpan.End()
449+
if err != nil {
450+
impl.logger.Errorw("service err, VulnerabilitySummary", "err", err)
451+
if util.IsErrNoRows(err) {
452+
common.WriteJsonResp(w, nil, impl.getEmptyVulnerabilitySummary(), http.StatusOK)
453+
} else {
454+
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
455+
}
456+
return
457+
}
458+
459+
// Apply RBAC filtering
460+
_, rbacProcessSpan := otel.Tracer("imageScanRestHandler").Start(ctx, "RBACProcessing")
481461
ids, err = impl.getAuthorisedImageScanDeployInfoIds(token, filteredDeployInfoList)
462+
rbacProcessSpan.End()
482463
if err != nil {
483464
impl.logger.Errorw("error in getting authorised image scan deploy info ids", "err", err)
484465
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
485466
return
486467
}
487-
}
488-
rbacSpan.End()
489468

490-
if len(ids) == 0 {
491-
emptySummary := &securityBean.VulnerabilitySummary{
492-
TotalVulnerabilities: 0,
493-
SeverityCount: &securityBean.SeverityCount{
494-
Critical: 0,
495-
High: 0,
496-
Medium: 0,
497-
Low: 0,
498-
Unknown: 0,
499-
},
500-
FixableVulnerabilities: 0,
501-
NotFixableVulnerabilities: 0,
469+
if len(ids) == 0 {
470+
common.WriteJsonResp(w, nil, impl.getEmptyVulnerabilitySummary(), http.StatusOK)
471+
return
502472
}
503-
common.WriteJsonResp(w, nil, emptySummary, http.StatusOK)
504-
return
505473
}
506474

507475
summary, err := impl.imageScanService.FetchVulnerabilitySummary(ctx, summaryRequest, ids)
508476
if err != nil {
509477
impl.logger.Errorw("service err, VulnerabilitySummary", "err", err)
510478
if util.IsErrNoRows(err) {
511-
emptySummary := &securityBean.VulnerabilitySummary{
512-
TotalVulnerabilities: 0,
513-
SeverityCount: &securityBean.SeverityCount{
514-
Critical: 0,
515-
High: 0,
516-
Medium: 0,
517-
Low: 0,
518-
Unknown: 0,
519-
},
520-
FixableVulnerabilities: 0,
521-
NotFixableVulnerabilities: 0,
522-
}
523-
common.WriteJsonResp(w, nil, emptySummary, http.StatusOK)
479+
common.WriteJsonResp(w, nil, impl.getEmptyVulnerabilitySummary(), http.StatusOK)
524480
} else {
525481
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
526482
}
@@ -529,6 +485,22 @@ func (impl ImageScanRestHandlerImpl) VulnerabilitySummary(w http.ResponseWriter,
529485
common.WriteJsonResp(w, err, summary, http.StatusOK)
530486
}
531487

488+
// getEmptyVulnerabilitySummary returns an empty vulnerability summary response
489+
func (impl ImageScanRestHandlerImpl) getEmptyVulnerabilitySummary() *securityBean.VulnerabilitySummary {
490+
return &securityBean.VulnerabilitySummary{
491+
TotalVulnerabilities: 0,
492+
SeverityCount: &securityBean.SeverityCount{
493+
Critical: 0,
494+
High: 0,
495+
Medium: 0,
496+
Low: 0,
497+
Unknown: 0,
498+
},
499+
FixableVulnerabilities: 0,
500+
NotFixableVulnerabilities: 0,
501+
}
502+
}
503+
532504
func (impl ImageScanRestHandlerImpl) VulnerabilityListing(w http.ResponseWriter, r *http.Request) {
533505
ctx, span := otel.Tracer("imageScanRestHandler").Start(r.Context(), "VulnerabilityListing")
534506
defer span.End()

api/util/logger.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
"github.com/devtron-labs/devtron/internal/middleware"
2727
"github.com/devtron-labs/devtron/pkg/auth/user"
28+
"github.com/devtron-labs/devtron/util"
2829
)
2930

3031
type AuditLoggerDTO struct {
@@ -36,6 +37,7 @@ type AuditLoggerDTO struct {
3637
RequestPayload []byte `json:"requestPayload"`
3738
RequestMethod string `json:"requestMethod"`
3839
ResponseTime time.Duration `json:"responseTime"`
40+
ClientIp string `json:"clientIp"`
3941
}
4042

4143
type LoggingMiddlewareImpl struct {
@@ -56,13 +58,12 @@ type LoggingMiddleware interface {
5658
func (impl LoggingMiddlewareImpl) LoggingMiddleware(next http.Handler) http.Handler {
5759
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
5860
d := middleware.NewDelegator(w, nil)
59-
6061
token := r.Header.Get("token")
6162
userEmail, err := impl.userService.GetEmailFromToken(token)
6263
if err != nil {
6364
log.Printf("AUDIT_LOG: user does not exists")
6465
}
65-
66+
clientIp := util.GetClientIP(r)
6667
// Read the request body into a buffer
6768
var bodyBuffer bytes.Buffer
6869
_, err = io.Copy(&bodyBuffer, r.Body)
@@ -83,6 +84,7 @@ func (impl LoggingMiddlewareImpl) LoggingMiddleware(next http.Handler) http.Hand
8384
QueryParams: r.URL.Query().Encode(),
8485
RequestPayload: bodyBuffer.Bytes(),
8586
RequestMethod: r.Method,
87+
ClientIp: clientIp,
8688
}
8789
// Call the next handler in the chain.
8890
next.ServeHTTP(d, r)
@@ -95,5 +97,5 @@ func (impl LoggingMiddlewareImpl) LoggingMiddleware(next http.Handler) http.Hand
9597
}
9698

9799
func LogRequest(auditLogDto *AuditLoggerDTO) {
98-
log.Printf("AUDIT_LOG: requestMethod: %s, urlPath: %s, queryParams: %s, updatedBy: %s, updatedOn: %s, apiResponseCode: %d, responseTime: %s, requestPayload: %s", auditLogDto.RequestMethod, auditLogDto.UrlPath, auditLogDto.QueryParams, auditLogDto.UserEmail, auditLogDto.UpdatedOn, auditLogDto.ApiResponseCode, auditLogDto.ResponseTime, auditLogDto.RequestPayload)
100+
log.Printf("AUDIT_LOG: clientIp: %s, requestMethod: %s, urlPath: %s, queryParams: %s, updatedBy: %s, updatedOn: %s, apiResponseCode: %d, responseTime: %s, requestPayload: %s", auditLogDto.ClientIp, auditLogDto.RequestMethod, auditLogDto.UrlPath, auditLogDto.QueryParams, auditLogDto.UserEmail, auditLogDto.UpdatedOn, auditLogDto.ApiResponseCode, auditLogDto.ResponseTime, auditLogDto.RequestPayload)
99101
}

charts/devtron/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: devtron-operator
3-
appVersion: 1.8.2
3+
appVersion: 2.0.0
44
description: Chart to configure and install Devtron. Devtron is a Kubernetes Orchestration system.
55
keywords:
66
- Devtron
@@ -11,7 +11,7 @@ keywords:
1111
- argocd
1212
- Hyperion
1313
engine: gotpl
14-
version: 0.22.98
14+
version: 0.22.99
1515
sources:
1616
- https://github.com/devtron-labs/charts
1717
dependencies:

charts/devtron/devtron-bom.yaml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ global:
1515
PG_DATABASE: orchestrator
1616
extraManifests: []
1717
installer:
18-
release: "v1.8.2"
18+
release: "v2.0.0"
1919
registry: ""
2020
image: "inception"
2121
tag: "473deaa4-185-21582"
@@ -41,13 +41,13 @@ components:
4141
FEATURE_CODE_MIRROR_ENABLE: "true"
4242
FEATURE_GROUPED_APP_LIST_FILTERS_ENABLE: "true"
4343
registry: ""
44-
image: "dashboard:b00aa204-690-36533"
44+
image: "dashboard:b48d0910-690-38228"
4545
imagePullPolicy: IfNotPresent
4646
healthPort: 8080
4747
devtron:
4848
registry: ""
49-
image: "hyperion:261df88d-280-36531"
50-
cicdImage: "devtron:261df88d-434-36530"
49+
image: "hyperion:f0c18f20-280-38148"
50+
cicdImage: "devtron:f0c18f20-434-38146"
5151
imagePullPolicy: IfNotPresent
5252
customOverrides: {}
5353
podSecurityContext:
@@ -61,7 +61,7 @@ components:
6161
healthPort: 8080
6262
ciRunner:
6363
registry: ""
64-
image: "ci-runner:880420ac-138-36030"
64+
image: "ci-runner:6b408df4-138-38163"
6565
argocdDexServer:
6666
registry: ""
6767
image: "dex:v2.30.2"
@@ -70,7 +70,7 @@ components:
7070
authenticator: "authenticator:e414faff-393-13273"
7171
kubelink:
7272
registry: ""
73-
image: "kubelink:880420ac-564-36036"
73+
image: "kubelink:6b408df4-564-38159"
7474
imagePullPolicy: IfNotPresent
7575
configs:
7676
ENABLE_HELM_RELEASE_CACHE: "true"
@@ -93,10 +93,11 @@ components:
9393
healthPort: 50052
9494
kubewatch:
9595
registry: ""
96-
image: "kubewatch:880420ac-419-36026"
96+
image: "kubewatch:6b408df4-419-38172"
9797
imagePullPolicy: IfNotPresent
9898
healthPort: 8080
9999
configs:
100+
VELERO_INFORMER: "false"
100101
devtroncd_NAMESPACE: "devtron-ci"
101102
USE_CUSTOM_HTTP_TRANSPORT: "true"
102103
CI_INFORMER: "true"
@@ -117,7 +118,7 @@ components:
117118
image: postgres_exporter:v0.10.1
118119
gitsensor:
119120
registry: ""
120-
image: "git-sensor:b82f5fdb-200-36532"
121+
image: "git-sensor:6b408df4-200-38174"
121122
imagePullPolicy: IfNotPresent
122123
serviceMonitor:
123124
enabled: false
@@ -135,7 +136,7 @@ components:
135136
# Values for lens
136137
lens:
137138
registry: ""
138-
image: "lens:880420ac-333-36029"
139+
image: "lens:6b408df4-333-38167"
139140
imagePullPolicy: IfNotPresent
140141
configs:
141142
GIT_SENSOR_PROTOCOL: GRPC
@@ -170,7 +171,7 @@ components:
170171
entMigratorImage: "devtron-utils:geni-v1.1.4"
171172
chartSync:
172173
registry: ""
173-
image: chart-sync:880420ac-836-36037
174+
image: chart-sync:6b408df4-836-38155
174175
schedule: "0 19 * * *"
175176
podSecurityContext:
176177
fsGroup: 1001
@@ -208,7 +209,7 @@ workflowController:
208209
IMDSv1ExecutorImage: "argoexec:v3.0.7"
209210
security:
210211
imageScanner:
211-
image: "image-scanner:f21e02cb-141-34534"
212+
image: "image-scanner:6b408df4-141-38158"
212213
healthPort: 8080
213214
configs:
214215
TRIVY_DB_REPOSITORY: mirror.gcr.io/aquasec/trivy-db
@@ -219,7 +220,7 @@ security:
219220
tag: 4.3.6
220221
# Values for notifier integration
221222
notifier:
222-
image: "notifier:00f17215-372-36041"
223+
image: "notifier:5c4b5b3a-372-38153"
223224
healthPort: 3000
224225
minio:
225226
image: "minio:RELEASE.2021-02-14T04-01-33Z"
@@ -241,6 +242,15 @@ monitoring:
241242
imagePullPolicy: IfNotPresent
242243
devtronEnterprise:
243244
enabled: false
245+
finops:
246+
enabled: false
247+
costSync:
248+
image: "cost-sync:46ed7c67-1159-38183"
249+
schedule: "0 * * * *"
250+
timeZone: UTC
251+
timescale:
252+
image: "timescaledb-ha:pg18"
253+
volumeSize: 5Gi
244254
casbin:
245255
registry: ""
246256
image: "casbin:f6ff5f74-064b67e5-462-30822"

charts/devtron/templates/NOTES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{{- $liveCm := lookup "v1" "ConfigMap" "devtroncd" "devtron-custom-cm" }}
33
{{- $currentValue := pluck "POSTGRES_MIGRATED" $liveCm.data | first | default "" }}
44
{{- if ne $currentValue "14" }}
5-
{{- fail "Upgrade Failed Please ensure that you have completed the pre-requisites mentioned in https://docs.devtron.ai/upgrade/devtron-upgrade-1.5.0" }}
5+
{{- fail "Upgrade Failed Please ensure that you have completed the pre-requisites mentioned in https://docs.devtron.ai/docs/devtron/v1.7/setup/upgrade/devtron-upgrade-1.5.0" }}
66
{{- end }}
77
{{- end }}
88

charts/devtron/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,4 @@ securityContext:
115115
securityContext:
116116
{{ toYaml .global.containerSecurityContext | indent 2 }}
117117
{{- end }}
118-
{{- end }}
118+
{{- end }}

0 commit comments

Comments
 (0)