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

Go code to get SIA certs from a CGF (Google Cloud Function) #2220

Merged
merged 2 commits into from
Jul 2, 2023

Conversation

gilad-bendor
Copy link
Contributor

No description provided.

//
// to get an Athenz certificate from ZTS.
//
// This file should usually be copied without changes into the GCF source-code.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what this is referring to. nobody should copy the source file. instead, they'll just import the module and call the methods, so let's remove this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Archeological remnant removed...

@@ -0,0 +1,263 @@
package functions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add Athenz License header block

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if err != nil {
return nil, err
}
//log.Printf("GCP Attestation Data: %s", attestationData) // commented out - sensitive info
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove all the commented log entries

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

// SiaCertData response of GcfGetSiaCerts()
type SiaCertData struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to define a new struct. This is already available as part of our RDL

import "github.com/AthenZ/athenz/clients/go/zts"

and generate and return zts.InstanceIdentity object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thing is, zts.InstanceIdentity is JSON-able: it only contain PEM stuff.
My SiaCertData also contains rsa.PrivateKey and x509.Certificate objects - so usage is simpler.
Also, zts.InstanceIdentitycontains many properties that I will not fill-in, and it would be confusing to users.
I would not make this change, but will yield to your judgment...
Are you sure you want to go that way?

Signed-off-by: gilad.bendor <[email protected]>
@havetisyan havetisyan merged commit 2c4898b into AthenZ:master Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants