From 1c8387b68ee57424bab0480964a586957f0011ca Mon Sep 17 00:00:00 2001 From: janusec Date: Sat, 13 Jul 2024 17:57:42 +0800 Subject: [PATCH] v1.5.1 adjust timeout to 60s and fix deletion destinations or domains of application --- backend/application.go | 8 ++++++-- data/data.go | 2 +- gateway/gateway.go | 8 ++++---- release_batch.sh | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/backend/application.go b/backend/application.go index 5488eda..9c080ad 100644 --- a/backend/application.go +++ b/backend/application.go @@ -360,23 +360,27 @@ func UpdateApplication(body []byte, clientIP string, authUser *models.AuthUser) return nil, err } app := rpcAppRequest.Object + // backup app0 to update destinations and domains + var app0 *models.Application customHeaders := GetCustomHeadersString(app.CustomHeaders) if app.ID == 0 { // new application app.ID = data.DAL.InsertApplication(app.Name, app.InternalScheme, app.RedirectHTTPS, app.HSTSEnabled, app.WAFEnabled, app.ShieldEnabled, app.ClientIPMethod, app.Description, app.OAuthRequired, app.SessionSeconds, app.Owner, app.CSPEnabled, app.CSP, app.CacheEnabled, customHeaders) Apps = append(Apps, app) + app0 = app go utils.OperationLog(clientIP, authUser.Username, "Add Application", app.Name) } else { err := data.DAL.UpdateApplication(app.Name, app.InternalScheme, app.RedirectHTTPS, app.HSTSEnabled, app.WAFEnabled, app.ShieldEnabled, app.ClientIPMethod, app.Description, app.OAuthRequired, app.SessionSeconds, app.Owner, app.CSPEnabled, app.CSP, app.CacheEnabled, customHeaders, app.ID) if err != nil { utils.DebugPrintln("UpdateApplication", err) } + app0, _ = GetApplicationByID(app.ID) // update app pointer in apps UpdateApplications(app) go utils.OperationLog(clientIP, authUser.Username, "Update Application", app.Name) } - UpdateDestinations(app, app.Destinations) - UpdateAppDomains(app, app.Domains) + UpdateDestinations(app0, app.Destinations) + UpdateAppDomains(app0, app.Domains) data.UpdateBackendLastModified() return app, nil } diff --git a/data/data.go b/data/data.go index 894d2a4..0a6418d 100644 --- a/data/data.go +++ b/data/data.go @@ -35,7 +35,7 @@ var ( // IsPrimary i.e. Is Primary Node IsPrimary bool // Version of JANUSEC - Version = "1.5.0" + Version = "1.5.1" ) // InitConfig init Data Access Layer diff --git a/gateway/gateway.go b/gateway/gateway.go index 94c2e7a..aadf666 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -386,10 +386,10 @@ func ReverseHandlerFunc(w http.ResponseWriter, r *http.Request) { // var transport http.RoundTripper transport := &http.Transport{ - TLSHandshakeTimeout: 30 * time.Second, - ResponseHeaderTimeout: 30 * time.Second, - IdleConnTimeout: 30 * time.Second, - ExpectContinueTimeout: 10 * time.Second, + TLSHandshakeTimeout: 60 * time.Second, + ResponseHeaderTimeout: 60 * time.Second, + IdleConnTimeout: 60 * time.Second, + ExpectContinueTimeout: 30 * time.Second, MaxIdleConns: 100, DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { dest.Mutex.Lock() diff --git a/release_batch.sh b/release_batch.sh index 0cc6bca..ae6fffa 100755 --- a/release_batch.sh +++ b/release_batch.sh @@ -2,7 +2,7 @@ printf "Creating installation package\n" printf "Checklist:\n" printf "* Angular Admin Version Check. \n" printf "* Janusec Version Check. \n" -version="1.5.0" +version="1.5.1" printf "Version: ${version} \n" read -r -p "Are You Sure? [Y/n] " option