Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: dm/appengine/distributor/swarming/v1/isolate.go

Issue 2267143002: Add additional validation to swarming v1 distributor. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@dump_all_stacks
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/appengine/distributor/swarming/v1/distributor.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/appengine/distributor/swarming/v1/isolate.go
diff --git a/dm/appengine/distributor/swarming/v1/isolate.go b/dm/appengine/distributor/swarming/v1/isolate.go
index fef9e303597fed4da86de573721b117ad0c99f35..e974c60568dc36ed955d257b2ca8afb3a0baf7b9 100644
--- a/dm/appengine/distributor/swarming/v1/isolate.go
+++ b/dm/appengine/distributor/swarming/v1/isolate.go
@@ -7,7 +7,6 @@ package swarming
import (
"bytes"
"encoding/json"
- "net/http"
"strings"
"github.com/golang/protobuf/jsonpb"
@@ -21,7 +20,6 @@ import (
"github.com/luci/luci-go/common/sync/parallel"
sv1 "github.com/luci/luci-go/dm/api/distributor/swarming/v1"
"github.com/luci/luci-go/dm/appengine/distributor"
- "github.com/luci/luci-go/server/auth"
"golang.org/x/net/context"
)
@@ -85,7 +83,7 @@ type isoChunk struct {
file *isolated.File
}
-func pushIsolate(c context.Context, isolateHost string, chunks []isoChunk) error {
+func pushIsolate(c context.Context, isolateURL string, chunks []isoChunk) error {
dgsts := make([]*isolateservice.HandlersEndpointsV1Digest, len(chunks))
for i, chnk := range chunks {
dgsts[i] = &isolateservice.HandlersEndpointsV1Digest{
@@ -93,15 +91,10 @@ func pushIsolate(c context.Context, isolateHost string, chunks []isoChunk) error
IsIsolated: chnk.isIso}
}
- anonTransport, err := auth.GetRPCTransport(c, auth.NoAuth)
- if err != nil {
- panic(err)
- }
- anonClient := &http.Client{Transport: anonTransport}
+ anonC, authC := httpClients(c)
isoClient := isolatedclient.New(
- anonClient, httpClient(c), "https://"+isolateHost,
- isolatedclient.DefaultNamespace, nil)
+ anonC, authC, isolateURL, isolatedclient.DefaultNamespace, nil)
states, err := isoClient.Contains(c, dgsts)
if err != nil {
err = errors.Annotate(err).
@@ -122,7 +115,7 @@ func pushIsolate(c context.Context, isolateHost string, chunks []isoChunk) error
})
}
-func prepIsolate(c context.Context, isolateHost string, tsk *distributor.TaskDescription, params *sv1.Parameters) (*swarm.SwarmingRpcsFilesRef, error) {
+func prepIsolate(c context.Context, isolateURL string, tsk *distributor.TaskDescription, params *sv1.Parameters) (*swarm.SwarmingRpcsFilesRef, error) {
prevData := []byte("{}")
if tsk.PreviousResult() != nil {
prevData = []byte(tsk.PreviousResult().Object)
@@ -132,7 +125,7 @@ func prepIsolate(c context.Context, isolateHost string, tsk *distributor.TaskDes
descData, descFile := mkMsgFile(tsk.Payload())
isoData, isoFile := mkIsolated(c, params, prevFile, descFile, authFile)
- err := pushIsolate(c, isolateHost, []isoChunk{
+ err := pushIsolate(c, isolateURL, []isoChunk{
{data: prevData, file: prevFile},
{data: authData, file: authFile},
{data: descData, file: descFile},
@@ -145,7 +138,7 @@ func prepIsolate(c context.Context, isolateHost string, tsk *distributor.TaskDes
return &swarm.SwarmingRpcsFilesRef{
Isolated: string(isoFile.Digest),
- Isolatedserver: "https://" + isolateHost,
+ Isolatedserver: isolateURL,
Namespace: isolatedclient.DefaultNamespace,
}, nil
}
« no previous file with comments | « dm/appengine/distributor/swarming/v1/distributor.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698