Skip to content

Commit d0fa622

Browse files
committed
Merge remote-tracking branch 'origin/release/v11.2.2' into release/v11.2.2
2 parents a5fc40c + 299b378 commit d0fa622

File tree

22 files changed

+224
-96
lines changed

22 files changed

+224
-96
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ installer/installer
1111
geolocation/
1212
installer/public_key.crt
1313
.github/scripts/golang-updater/go-updater
14+
15+
16+
qodana.yaml

agent-manager/updates/updates.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"crypto/tls"
55
"net/http"
66
"os"
7+
"time"
78

8-
"github.com/gin-contrib/gzip"
99
"github.com/threatwinds/go-sdk/catcher"
1010

1111
"github.com/gin-gonic/gin"
@@ -23,7 +23,6 @@ func ServeDependencies() {
2323
r := gin.New()
2424
r.Use(
2525
gin.Recovery(),
26-
gzip.Gzip(gzip.DefaultCompression),
2726
)
2827

2928
r.NoRoute(notFound)
@@ -33,20 +32,31 @@ func ServeDependencies() {
3332

3433
loadedCert, err := tls.LoadX509KeyPair(config.CertPath, config.CertKeyPath)
3534
if err != nil {
36-
catcher.Error("failed to load TLS credentials", err, map[string]any{"process": "agent-manager"})
35+
_ = catcher.Error("failed to load TLS credentials", err, map[string]any{"process": "agent-manager"})
36+
time.Sleep(5 * time.Second)
3737
os.Exit(1)
3838
}
3939

4040
tlsConfig := &tls.Config{
41-
MinVersion: tls.VersionTLS12,
4241
Certificates: []tls.Certificate{loadedCert},
42+
MinVersion: tls.VersionTLS12,
43+
MaxVersion: tls.VersionTLS13,
4344
CipherSuites: []uint16{
44-
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
45+
// TLS 1.2 secure cipher suites - RSA key exchange
4546
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
4647
tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
48+
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
49+
// TLS 1.2 secure cipher suites - ECDSA key exchange (for ECDSA certificates)
50+
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
51+
tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
52+
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
53+
},
54+
CurvePreferences: []tls.CurveID{
55+
tls.X25519, // Modern and fast
56+
tls.CurveP256, // NIST P-256
57+
tls.CurveP384, // NIST P-384
58+
tls.CurveP521, // NIST P-521
4759
},
48-
49-
PreferServerCipherSuites: true,
5060
}
5161

5262
server := &http.Server{
@@ -57,7 +67,7 @@ func ServeDependencies() {
5767

5868
catcher.Info("Starting HTTP server on port 8080", map[string]any{"process": "agent-manager"})
5969
if err := server.ListenAndServeTLS("", ""); err != nil {
60-
catcher.Error("error starting HTTP server", err, map[string]any{"process": "agent-manager"})
70+
_ = catcher.Error("error starting HTTP server", err, map[string]any{"process": "agent-manager"})
6171
return
6272
}
6373
}

agent/updater/utils/download.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ func DownloadFile(url string, headers map[string]string, fileName string, path s
2020

2121
client := &http.Client{}
2222
client.Transport = &http.Transport{
23-
TLSClientConfig: &tls.Config{InsecureSkipVerify: skipTlsVerification},
23+
TLSClientConfig: &tls.Config{InsecureSkipVerify: skipTlsVerification},
24+
DisableCompression: true,
2425
}
2526

2627
resp, err := client.Do(req)

agent/utils/download.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func DownloadFile(url string, headers map[string]string, fileName string, path s
2121
client := &http.Client{}
2222
client.Transport = &http.Transport{
2323
TLSClientConfig: &tls.Config{InsecureSkipVerify: skipTlsVerification},
24+
DisableCompression: true,
2425
}
2526

2627
resp, err := client.Do(req)

agent/utils/files.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"io"
99
"os"
1010
"path/filepath"
11+
"reflect"
1112

1213
"gopkg.in/yaml.v2"
1314
)
@@ -22,6 +23,15 @@ func GetMyPath() string {
2223
}
2324

2425
func ReadYAML(path string, result interface{}) error {
26+
if result == nil {
27+
return fmt.Errorf("result interface is nil")
28+
}
29+
30+
rv := reflect.ValueOf(result)
31+
if rv.Kind() != reflect.Ptr || rv.IsNil() {
32+
return fmt.Errorf("result must be a non-nil pointer")
33+
}
34+
2535
file, err := os.Open(path)
2636
if err != nil {
2737
return err

frontend/src/app/graphic-builder/chart-builder/chart-builder.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h5 class="mb-0 label-header px-3 py-2">
2020
</app-visualization-header>
2121

2222
<div class="row">
23-
<div *ngIf="visualization && visualization.filterType && !isSqlMode" class="col-lg-12 col-sm-12 col-md-12 p-0">
23+
<div *ngIf="visualization" class="col-lg-12 col-sm-12 col-md-12 p-0">
2424
<app-utm-elastic-filter (filterChange)="onFilterChange($event)"
2525
[filters]="visualization.filterType"
2626
[pattern]="pattern"
@@ -97,6 +97,7 @@ <h5 class="mb-0 label-header px-3 py-2">
9797
[(ngModel)]="sqlQuery"
9898
(ngModelChange)="clearMessages()"
9999
[customKeywords]="loadFieldNames().concat(indexPatternNames)"
100+
(indexPatternChange)="onIndexPatternChange($event)"
100101
[consoleOptions]="codeEditorOptions">
101102
</app-code-editor>
102103
</div>

frontend/src/app/graphic-builder/chart-builder/chart-builder.component.ts

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ import {VisualizationService} from '../visualization/shared/services/visualizati
4040
import {VisualizationSaveComponent} from '../visualization/visualization-save/visualization-save.component';
4141

4242
import {DashboardStatusEnum} from '../dashboard-builder/shared/enums/dashboard-status.enum';
43+
import {HttpResponse} from "@angular/common/http";
44+
import {IndexPatternService} from "../../shared/services/elasticsearch/index-pattern.service";
45+
import {map} from "rxjs/operators";
4346

4447

4548
@Component({
@@ -75,6 +78,7 @@ export class ChartBuilderComponent implements OnInit, AfterViewChecked {
7578
indexPatternNames: string[] = [];
7679
codeEditorOptions: ConsoleOptions = {lineNumbers: 'off'};
7780
loading = true;
81+
indexPattern: UtmIndexPattern[];
7882

7983
constructor(private spinner: NgxSpinnerService,
8084
private route: ActivatedRoute,
@@ -86,7 +90,8 @@ export class ChartBuilderComponent implements OnInit, AfterViewChecked {
8690
private location: Location,
8791
private router: Router,
8892
private localFieldService: LocalFieldService,
89-
private sqlValidationService: SqlValidationService) {
93+
private sqlValidationService: SqlValidationService,
94+
private indexPatternService: IndexPatternService) {
9095
route.queryParams.subscribe(params => {
9196
this.chart = params[VisualizationQueryParamsEnum.CHART];
9297
this.mode = params[VisualizationQueryParamsEnum.MODE];
@@ -138,6 +143,8 @@ export class ChartBuilderComponent implements OnInit, AfterViewChecked {
138143
};
139144
this.loading = false;
140145
}
146+
147+
this.getIndexPatterns();
141148
}
142149

143150
getFields() {
@@ -343,13 +350,37 @@ export class ChartBuilderComponent implements OnInit, AfterViewChecked {
343350

344351
nullifyUnusedFields() {
345352
this.visualization.aggregationType = null;
346-
this.visualization.pattern = null;
347-
this.visualization.idPattern = null;
348-
this.visualization.filterType = null;
349353
}
350354

351355
clearMessages(): void {
352356
this.errorMessage = '';
353357
}
354358

359+
getIndexPatterns() {
360+
const req = {
361+
page: 0,
362+
size: 1000,
363+
sort: 'id,asc',
364+
'isActive.equals': true,
365+
};
366+
this.indexPatternService.query(req)
367+
.pipe(
368+
map((res: HttpResponse<any>) => res.body || [])
369+
)
370+
.subscribe({
371+
next: data => {
372+
this.indexPatternNames = data.map((pattern: UtmIndexPattern) => pattern.pattern);
373+
this.indexPattern = data;
374+
},
375+
error: () => this.indexPatternNames = [],
376+
});
377+
}
378+
379+
onIndexPatternChange($event: string) {
380+
const indexPattern = this.indexPattern.find(p => p.pattern === $event);
381+
382+
if (indexPattern) {
383+
this.indexPatternSelected(indexPattern);
384+
}
385+
}
355386
}

frontend/src/app/graphic-builder/shared/components/viewer/chart-view/chart-view.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ export class ChartViewComponent implements OnInit, OnDestroy {
127127
if (!this.defaultTime) {
128128
this.defaultTime = this.visualization.filterType ? resolveDefaultVisualizationTime(this.visualization)
129129
: new ElasticFilterDefaultTime('now-30d', 'now');
130+
}
131+
132+
if (this.building) {
130133
this.refreshService.sendRefresh(this.refreshType);
131134
}
132135
}

frontend/src/app/graphic-builder/shared/components/viewer/goal-view/goal-view.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ export class GoalViewComponent implements OnInit, OnDestroy {
100100

101101
if (!this.defaultTime) {
102102
this.defaultTime = this.visualization.filterType ? resolveDefaultVisualizationTime(this.visualization)
103-
: new ElasticFilterDefaultTime('now-30d', 'now');
103+
: new ElasticFilterDefaultTime('now-30d', 'now');
104+
}
105+
106+
if (this.building) {
104107
this.refreshService.sendRefresh(this.refreshType);
105108
}
106109
}

frontend/src/app/graphic-builder/shared/components/viewer/map-view/map-view.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,11 @@ export class MapViewComponent implements OnInit, AfterViewInit, OnDestroy {
326326
});
327327

328328
if (!this.defaultTime) {
329-
this.defaultTime = this.visualization.queryLanguage === ChartBuilderQueryLanguageEnum.DSL ?
330-
resolveDefaultVisualizationTime(this.visualization)
329+
this.defaultTime = this.visualization.filterType ? resolveDefaultVisualizationTime(this.visualization)
331330
: new ElasticFilterDefaultTime('now-30d', 'now');
331+
}
332+
333+
if (this.building) {
332334
this.refreshService.sendRefresh(this.refreshType);
333335
}
334336
}

0 commit comments

Comments
 (0)