Skip to content

Commit 2b1c9ac

Browse files
committed
update remote domain gatekeeper
1 parent 05e8f21 commit 2b1c9ac

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

lib/app/app.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,13 @@ func (a *Application) createNewConfigFile() {
304304
}
305305

306306
func (a *Application) checkForApplicationUpdates() {
307-
if a.Gatekeeper.CanAccessUrl(updater.GetUpdateCheckUrlFormat()) {
308-
updateAvailable := updater.IsLatestApplicationReleaseNewerThanCurrent(version.APP_VERSION, "permafrost-dev/stackup")
307+
// if a.Gatekeeper.CanAccessUrl(updater.GetUpdateCheckUrlFormat()) {
308+
updateAvailable := updater.IsLatestApplicationReleaseNewerThanCurrent(version.APP_VERSION, "permafrost-dev/stackup")
309309

310-
if updateAvailable {
311-
support.WarningMessage("A new version of StackUp is available. Please update to the latest version.")
312-
}
310+
if updateAvailable {
311+
support.WarningMessage("A new version of StackUp is available. Please update to the latest version.")
313312
}
313+
// }
314314
}
315315

316316
func (a *Application) handleFlagOptions() {

lib/app/gatekeeper.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ func (g *Gatekeeper) Initialize() {
2020
}
2121

2222
func (g *Gatekeeper) CanAccessUrl(urlStr string) bool {
23+
if !g.Enabled {
24+
return true
25+
}
26+
27+
if App.Workflow.Settings.Domains.Allowed == nil {
28+
return true
29+
}
30+
2331
for _, domain := range App.Workflow.Settings.Domains.Allowed {
2432
parsedUrl, _ := url.Parse(urlStr)
2533

lib/app/workflow.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,16 @@ func (workflow *StackupWorkflow) Initialize() {
421421
// ensure that the allowed domains are in the correct format, i.e. without a protocol or port
422422
tempDomains := []string{}
423423
for _, domain := range workflow.Settings.Domains.Allowed {
424-
parsedUrl, _ := url.Parse(domain)
425-
tempDomains = append(tempDomains, parsedUrl.Host)
424+
if strings.Contains(domain, "://") {
425+
parsedUrl, _ := url.Parse(domain)
426+
tempDomains = append(tempDomains, parsedUrl.Host)
427+
} else {
428+
tempDomains = append(tempDomains, domain)
429+
}
426430
}
427-
workflow.Settings.Domains.Allowed = tempDomains
431+
432+
copy(workflow.Settings.Domains.Allowed, tempDomains)
433+
// workflow.Settings.Domains.Allowed = tempDomains
428434

429435
// initialize the includes
430436
for _, inc := range workflow.Includes {

0 commit comments

Comments
 (0)