@@ -5040,10 +5040,16 @@ func GetGcpSchedule(ctx context.Context, id string) (*ScheduleOld, error) {
50405040 log.Printf("[ERROR] Client error: %s", err)
50415041 return schedule, err
50425042 }
5043+
50435044 location := "europe-west2"
5044- if len(os.Getenv("SHUFFLE_GCEPROJECT")) > 0 && len(os.Getenv("SHUFFLE_GCEPROJECT_LOCATION")) > 0 {
5045+ if len(os.Getenv("SHUFFLE_GCE_LOCATION")) > 0 {
5046+ location = os.Getenv("SHUFFLE_GCE_LOCATION")
5047+ }
5048+
5049+ if len(os.Getenv("SHUFFLE_GCE_LOCATION")) == 0 && len(os.Getenv("SHUFFLE_GCEPROJECT_LOCATION")) > 0 {
50455050 location = os.Getenv("SHUFFLE_GCEPROJECT_LOCATION")
50465051 }
5052+
50475053 req := &schedulerpb.GetJobRequest{
50485054 Name: fmt.Sprintf("projects/%s/locations/%s/jobs/schedule_%s", gceProject, location, id),
50495055 }
@@ -6520,7 +6526,7 @@ func diffWorkflows(oldWorkflow Workflow, parentWorkflow Workflow, update bool) {
65206526 // i think the following messes everything up with
65216527 // authenticationIDs. Let's just remove it for now.
65226528
6523- // In case of replication,
6529+ // In case of replication,
65246530 parentWorkflow.Actions[actionIndex].AuthenticationId = ""
65256531
65266532 idFound := false
@@ -18491,45 +18497,10 @@ func PrepareSingleAction(ctx context.Context, user User, fileId string, body []b
1849118497 return workflowExecution, err
1849218498 }
1849318499
18494- /*
18495- // FIXME: Is this required? I don't think so
18496- if app.Authentication.Required && len(action.AuthenticationId) == 0 {
18497-
18498- // Basic bypass check for valid headers just in case
18499- authFound := false
18500- for _, param := range action.Parameters {
18501- if param.Name == "headers" || param.Name == "queries" || param.Name == "url" {
18502- lowercased := strings.ToLower(param.Value)
18503- if strings.Contains(lowercased, "auth") || strings.Contains(lowercased, "bearer") || strings.Contains(lowercased, "basic") || strings.Contains(lowercased, "api") {
18504- authFound = true
18505- break
18506- }
18507- }
18508- }
18509-
18510- if !authFound {
18511- log.Printf("[WARNING] Tried to execute SINGLE %s WITHOUT auth (missing)", app.Name)
18512-
18513- found := false
18514- for _, param := range action.Parameters {
18515- if param.Configuration {
18516- found = true
18517- break
18518- }
18519- }
18520-
18521- if !found {
18522- return workflowExecution, errors.New("You must authenticate this API first")
18523- }
18524- }
18525- }
18526- */
18527-
18528- // FIXME: We need to inject missing empty auth here
18500+ // FIXME: We need to inject missing empty auth here in some cases
1852918501 // This is NOT a good solution, but a good bypass
18530- if app.Authentication.Required {
18502+ if app.Authentication.Required && len(action.AuthenticationId) == 0 {
1853118503 authFields := 0
18532-
1853318504 foundFields := []string{}
1853418505 for _, actionParam := range action.Parameters {
1853518506 if actionParam.Configuration {
@@ -18568,6 +18539,32 @@ func PrepareSingleAction(ctx context.Context, user User, fileId string, body []b
1856818539 })
1856918540 }
1857018541 }
18542+
18543+ auths, err := GetAllWorkflowAppAuth(ctx, user.ActiveOrg.Id)
18544+ if err != nil {
18545+ log.Printf("[ERROR] Failed getting auth for single action: %s", err)
18546+ } else {
18547+ //latestTimestamp := int64(0)
18548+ for _, auth := range auths {
18549+ if auth.App.ID != fileId {
18550+ continue
18551+ }
18552+
18553+ // Fallback to latest created
18554+ /*
18555+ if latestTimestamp < auth.Created {
18556+ latestTimestamp = auth.Created
18557+ action.AuthenticationId = auth.Id
18558+ }
18559+ */
18560+
18561+ // If valid, just choose it
18562+ if auth.Validation.Valid {
18563+ action.AuthenticationId = auth.Id
18564+ break
18565+ }
18566+ }
18567+ }
1857118568 }
1857218569
1857318570 if runValidationAction {
@@ -25429,7 +25426,7 @@ func GetExternalClient(baseUrl string) *http.Client {
2542925426
2543025427 if len(os.Getenv("SHUFFLE_INTERNAL_NO_PROXY")) > 0 {
2543125428 noProxy = os.Getenv("SHUFFLE_INTERNAL_NO_PROXY")
25432- }
25429+ }
2543325430
2543425431 if len(os.Getenv("SHUFFLE_INTERNAL_NOPROXY")) > 0 {
2543525432 noProxy = os.Getenv("SHUFFLE_INTERNAL_NOPROXY")
@@ -25438,7 +25435,7 @@ func GetExternalClient(baseUrl string) *http.Client {
2543825435
2543925436 // Manage noproxy
2544025437 if len(noProxy) > 0 {
25441- isNoProxy := isNoProxyHost(noProxy, parsedUrl.Host)
25438+ isNoProxy := isNoProxyHost(noProxy, parsedUrl.Host)
2544225439 if isNoProxy {
2544325440 log.Printf("[INFO] Skipping proxy for %s", parsedUrl)
2544425441
0 commit comments