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

add support for client_certificate_v2 posture rule #1685

Merged
merged 4 commits into from
Jul 23, 2024

Conversation

jlu-cloudflare
Copy link
Contributor

@jlu-cloudflare jlu-cloudflare commented Apr 5, 2024

Description

Added fields to DevicePostureRuleInput to accommodate needed inputs for the new posture type client_certificate_v2

This requires the merge and deployment of documentation changes found here: WDAPI-1954

Has your change been tested?

Because it is just adding fields to the DevicePostureRuleInput struct, this should not affect existing uses of it. There has been a test created to test the creation of the client_certificate_v2 posture rule to test out the added fields.

Screenshots (if appropriate):

Types of changes

What sort of change does your code introduce/modify?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • This change is using publicly documented in cloudflare/api-schemas
    and relies on stable APIs.

Copy link
Contributor

github-actions bot commented Apr 5, 2024

changelog detected ✅

State string `json:"state,omitempty"`
LastSeen string `json:"last_seen,omitempty"`
ExtendedKeyUsage []string `json:"extended_key_usage,omitempty"`
CheckPrivateKey bool `json:"check_private_key,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

@jacobbednarz
Copy link
Member

feel free to ping me once the API docs are out and we'll get this merged.

@@ -354,10 +354,10 @@ func TestDevicePostureRules(t *testing.T) {
Input: DevicePostureRuleInput{
ID: "9e597887-345e-4a32-a09c-68811b129768",
Path: "/tmp/data.zta",
Exists: true,
Exists: newBoolPointer(true),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Exists: newBoolPointer(true),
Exists: BoolPtr(true),

Thumbprint: "asdfasdfasdfasdf",
Sha256: "D75398FC796D659DEB4170569DCFEC63E3897C71E3AE8642FD3139A554AEE21E",
Running: true,
Running: newBoolPointer(true),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Running: newBoolPointer(true),
Running: BoolPtr(true),

@@ -413,7 +413,7 @@ func TestDevicePostureFileRule(t *testing.T) {
Match: []DevicePostureRuleMatch{{Platform: "ios"}},
Input: DevicePostureRuleInput{
Path: "/tmp/test",
Exists: true,
Exists: newBoolPointer(true),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Exists: newBoolPointer(true),
Exists: BoolPtr(true),

@@ -468,7 +468,7 @@ func TestDevicePostureDiskEncryptionRule(t *testing.T) {
Expiration: "1h",
Match: []DevicePostureRuleMatch{{Platform: "ios"}},
Input: DevicePostureRuleInput{
RequireAll: true,
RequireAll: newBoolPointer(true),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
RequireAll: newBoolPointer(true),
RequireAll: BoolPtr(true),

@@ -693,7 +691,7 @@ func TestDevicePostureClientCertificateRuleV2(t *testing.T) {
Input: DevicePostureRuleInput{
CertificateID: "d2c04b78-3ba2-4294-8efa-4e85aef0777f",
CommonName: "example.com",
CheckPrivateKey: &checkPrivateKey,
CheckPrivateKey: newBoolPointer(true),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
CheckPrivateKey: newBoolPointer(true),
CheckPrivateKey: BoolPtr(true),

Comment on lines 852 to 855

func newBoolPointer(b bool) *bool {
return &b
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func newBoolPointer(b bool) *bool {
return &b
}

Copy link
Member

@jacobbednarz jacobbednarz left a comment

Choose a reason for hiding this comment

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

sorry for the back and forth here but we have a built in for the non-pointer => pointer values you can use here :)

(note: i'd apply these but you've sent the PR using your master branch which is protected. if you send it using a feature branch, i can automatically fix these ones for you)

@jacobbednarz jacobbednarz merged commit 55933c2 into cloudflare:master Jul 23, 2024
10 checks passed
@github-actions github-actions bot added this to the v0.101.0 milestone Jul 23, 2024
Copy link
Contributor

This functionality has been released in v0.101.0.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants