Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deck should not require a secret json file to sign URLs #16489

Closed
fejta opened this issue Feb 26, 2020 · 2 comments
Closed

Deck should not require a secret json file to sign URLs #16489

fejta opened this issue Feb 26, 2020 · 2 comments
Assignees
Labels
area/prow/deck Issues or PRs related to prow's deck component area/prow/spyglass Issues or PRs related to prow's spyglass UI area/prow Issues or PRs related to prow kind/feature Categorizes issue or PR as related to a new feature.

Comments

@fejta
Copy link
Contributor

fejta commented Feb 26, 2020

We should be able to use built-in service accounts to sign URLs.
We can also use cookie auth to show private logs.

/assign @fejta @Katharine
/area prow
/area prow/deck
/area prow/spyglass

ref #15806

Some background:

ref googleapis/google-cloud-python#922
ref googleapis/google-cloud-go#1130 (comment)

Problematic area of code:

auth := struct {
Type string `json:"type"`
PrivateKey string `json:"private_key"`
ClientEmail string `json:"client_email"`
}{}
if err := json.NewDecoder(f).Decode(&auth); err != nil {
return "", err
}
if auth.Type != "service_account" {
return "", fmt.Errorf("only service_account GCS auth is supported, got %q", auth.Type)
}
return storage.SignedURL(bucket, obj, &storage.SignedURLOptions{
Method: "GET",
Expires: time.Now().Add(10 * time.Minute),
GoogleAccessID: auth.ClientEmail,
PrivateKey: []byte(auth.PrivateKey),
})
}

@fejta fejta added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 26, 2020
@k8s-ci-robot k8s-ci-robot added the area/prow Issues or PRs related to prow label Feb 26, 2020
@k8s-ci-robot
Copy link
Contributor

@fejta: The label(s) area/prow/deck/spyglass cannot be applied, because the repository doesn't have them

In response to this:

/assign @fejta @Katharine
/area prow
/area prow/deck
/area prow/deck/spyglass

ref #15806
ref googleapis/google-cloud-python#922

auth := struct {
Type string `json:"type"`
PrivateKey string `json:"private_key"`
ClientEmail string `json:"client_email"`
}{}
if err := json.NewDecoder(f).Decode(&auth); err != nil {
return "", err
}
if auth.Type != "service_account" {
return "", fmt.Errorf("only service_account GCS auth is supported, got %q", auth.Type)
}
return storage.SignedURL(bucket, obj, &storage.SignedURLOptions{
Method: "GET",
Expires: time.Now().Add(10 * time.Minute),
GoogleAccessID: auth.ClientEmail,
PrivateKey: []byte(auth.PrivateKey),
})
}

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the area/prow/deck Issues or PRs related to prow's deck component label Feb 26, 2020
@fejta fejta added the area/prow/spyglass Issues or PRs related to prow's spyglass UI label Feb 26, 2020
@k8s-ci-robot
Copy link
Contributor

@fejta: The label(s) area/prow/deck/spyglass cannot be applied, because the repository doesn't have them

In response to this:

/assign @fejta @Katharine
/area prow
/area prow/deck
/area prow/deck/spyglass

ref #15806

Some background:

ref googleapis/google-cloud-python#922
ref googleapis/google-cloud-go#1130 (comment)

auth := struct {
Type string `json:"type"`
PrivateKey string `json:"private_key"`
ClientEmail string `json:"client_email"`
}{}
if err := json.NewDecoder(f).Decode(&auth); err != nil {
return "", err
}
if auth.Type != "service_account" {
return "", fmt.Errorf("only service_account GCS auth is supported, got %q", auth.Type)
}
return storage.SignedURL(bucket, obj, &storage.SignedURLOptions{
Method: "GET",
Expires: time.Now().Add(10 * time.Minute),
GoogleAccessID: auth.ClientEmail,
PrivateKey: []byte(auth.PrivateKey),
})
}

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/prow/deck Issues or PRs related to prow's deck component area/prow/spyglass Issues or PRs related to prow's spyglass UI area/prow Issues or PRs related to prow kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants