feat: support storage and use of custom rego engine hostnames#2315
Conversation
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
| policiesAllowedHostnames = result.GetPoliciesAllowedHostnames() | ||
|
|
||
| signingOpts := result.GetSigningOptions() | ||
| if signingOpts != nil { |
There was a problem hiding this comment.
This change is actually not needed, right? proto getters are always safe and work for nil receivers, so it's safe to do GetSigningOptions().GetTimestampAuthorityUrl() even if SigningOptions is nil
| ID, Name string | ||
| CreatedAt *time.Time | ||
| PolicyViolationBlockingStrategy string | ||
| PolicyAllowedHostnames []string `json:"policyAllowedHostnames,omitempty"` |
There was a problem hiding this comment.
nope really, I wanted to hide this option if the default is set
| type NewOrgUpdateOpts struct { | ||
| BlockOnPolicyViolation *bool | ||
| BlockOnPolicyViolation *bool | ||
| PoliciesAllowedHostnames *[]string |
There was a problem hiding this comment.
This looks a bit weird. Slices are pointers already and are nil if no initialized. No need to create a pointer to a pointer. Just keep in mind that len([]string(nil)) is 0
There was a problem hiding this comment.
updated the pointer situation to leverage instead the duality of empty slice vs nil slice.
| } | ||
|
|
||
| if opts.PoliciesAllowedHostnames != nil { | ||
| payload.PoliciesAllowedHostnames = *opts.PoliciesAllowedHostnames |
There was a problem hiding this comment.
This is what I mean, *variable shouldn't be needed for slices, since they are pointers anyways.
There was a problem hiding this comment.
this is about making sure we can detect when we want to update the value vs empty it. In any case I've implemented the same by using slices
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
This PR allows to store, expose and use custom hostnames that can be used inside policies. If provided, they will be appended to the existing ones.
This PR includes
org describeandatt initresponse.closes #2267