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

Missing attribute for device posture rules #670

Closed
2 tasks done
bmoller opened this issue Jul 14, 2021 · 2 comments
Closed
2 tasks done

Missing attribute for device posture rules #670

bmoller opened this issue Jul 14, 2021 · 2 comments

Comments

@bmoller
Copy link

bmoller commented Jul 14, 2021

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the library and it is still present.

cloudflare-go version

0.19.0

Go environment

GOVERSION="go1.15"

Expected output

A usable device posture rule should be created for reference by Cloudflare for Teams policies.

Actual output

The Go library currently does not pass a flavor as part of the rule input; this behavior differs from the Cloudflare for Teams web console. A usable JSON object should look like this:

{
    "type": "application",
    "name": "Jamf",
    "schedule": "5m",
    "match": [
        {
            "platform": "mac"
        }
    ],
    "input": {
        "path": "/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
        "running": true,
        "thumbprint": "e86867eab7456a4fefcda5541be7d7e2c5aacbe9",
        "flavor": "application"
    }
}

The flavor is not currently defined in the rule struct: https://github.com/cloudflare/cloudflare-go/blob/master/device_posture_rule.go#L28:L36

It is admittedly also missing from the Cloudflare API docs, which is unfortunate.

I am not a direct consumer of the Cloudflare Go library but it's used by Terraform, which I use to manage our Cloudflare account. It doesn't make much sense to open a bug for the Cloudflare provider until it's fixed here because they use this library for API calls: https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/cloudflare/resource_cloudflare_device_posture_rule.go

Code demonstrating the issue

{
"type": "application",
"name": "Jamf",
"schedule": "5m",
"match": [
{
"platform": "mac"
}
],
"input": {
"path": "/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
"running": true,
"thumbprint": "e86867eab7456a4fefcda5541be7d7e2c5aacbe9"
}
}

Steps to reproduce

  1. POST the above JSON object to client/v4/accounts/.../devices/posture to create a new device posture rule
  2. Note that the rule is displayed in the Cloudflare for Teams console list of rules, but does not appear as an option when creating policies
  3. POST the above JSON object again with "flavor": "application" in the input attribute to client/v4/accounts/.../devices/posture/...
  4. Note that the rule is both listed in the console and may now be selected as an option for policies

References

No response

@jacobbednarz
Copy link
Member

by the looks, this field doesn't have public API support yet so once it's documented (and confirmed to be intentionally used by the public), we can look at adding it

@jacobbednarz
Copy link
Member

Closed by #676, #677

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

No branches or pull requests

2 participants