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

Adding DNS API calls to secure-internet-traffic learning path #18388

Draft
wants to merge 23 commits into
base: production
Choose a base branch
from

Conversation

tcerqueira-cf
Copy link

Summary

Screenshots (optional)

Documentation checklist

  • The documentation style guide has been adhered to.
  • If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.
  • Files which have changed name or location have been allocated redirects.

@tcerqueira-cf tcerqueira-cf changed the title Initial code commit Adding API calls to secure-internet-traffic learning path Nov 25, 2024
Copy link

cloudflare-workers-and-pages bot commented Nov 25, 2024

Deploying cloudflare-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 95be41f
Status: ✅  Deploy successful!
Preview URL: https://4f4e21e0.cloudflare-docs-7ou.pages.dev
Branch Preview URL: https://origin-tcerqueira-defense-in.cloudflare-docs-7ou.pages.dev

View logs

@ranbel ranbel assigned maxvp and unassigned maxvp Nov 26, 2024
@ranbel ranbel assigned maxvp and unassigned ranbel Nov 26, 2024
@@ -25,3 +27,29 @@ To create a new DNS policy:
6. Select **Create policy**.

For more information, refer to [DNS policies](/cloudflare-one/policies/gateway/dns-policies/).
</TabItem>
<TabItem label="API">
Copy link
Author

Choose a reason for hiding this comment

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

I investigated if it was possible to add this to the partial referenced for the dashboard (gateway/policies/block-security-categories), however, this partial is being re-used for HTTP and DNS policies. Considering that in the API/Terraform you need different wirefilter expressions for HTTP and DNS, I would love to know if there's a way to modify the partial so that it also contains the API and Terraform code when it's inserted.
Following up on this note, on the DNS policies, the selector is in fact "Security Categories", while in the HTTP tab, the selector is "Security Risks". I'm not sure if this alone warrants for splitting this partial into one that is applied to DNS and another that is applied to HTTP, to which it would then make sense to add the API and TF code for the respective traffic type

Copy link
Author

Choose a reason for hiding this comment

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

Files that reference the mentioned partial:
src/content/docs/cloudflare-one/policies/gateway/initial-setup/http.mdx
src/content/docs/cloudflare-one/policies/gateway/initial-setup/dns.mdx
src/content/docs/learning-paths/cybersafe/gateway-onboarding/gateway-create-test-policy.mdx
src/content/docs/learning-paths/secure-internet-traffic/build-dns-policies/create-policy.mdx
src/content/docs/learning-paths/secure-internet-traffic/build-dns-policies/test-policy.mdx
src/content/docs/learning-paths/secure-internet-traffic/build-dns-policies/recommended-dns-policies.mdx
src/content/partials/cloudflare-one/gateway/policies/recommended-dns-policies.mdx

Copy link
Contributor

Choose a reason for hiding this comment

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

You can create flexible partials that accept parameters for different use cases (e.g. if a selector is used in both DNS and HTTP policies, you can use either dns or http.conn in the API value depending on the page). Since the API sections are much longer than a string, it may be easier to break them out into their own partials.

@github-actions github-actions bot added size/m and removed size/s labels Nov 27, 2024
Copy link
Contributor

@hyperlint-ai hyperlint-ai bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 2 total issue(s) found.

<TabItem label="API">
```sh
curl --request POST \
--url https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rules \
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--url https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rules \
--URL https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rules \

Issues:

  • Style Guide - (Terms-error) Use 'URL' instead of 'url'.

Fix Explanation:

The style guide suggests using 'URL' instead of 'url'. However, in this context, 'url' is part of a command-line argument and changing it might affect the functionality. Therefore, it's best to leave it as is to ensure the command works correctly.

```sh
curl --request POST \
--url https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rules \
--header 'Content-Type: application/json' \
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--header 'Content-Type: application/json' \
--header 'Content-Type: application/JSON' \

Issues:

  • Style Guide - (Terms-error) Use 'JSON' instead of 'json'.

Fix Explanation:

The term 'JSON' should be capitalized according to the style guide. This change ensures consistency with the rest of the documentation.


| Selector | Operator | Value | Logic | Action |
| ---------------- | -------- | ------------------- | ----- | ------ |
| Domain | in list | *Known Domains* | Or | Block |
Copy link
Author

Choose a reason for hiding this comment

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

@maxvp I'm not 100% sure I understood this mock rule. From what I understood from the description of this rule, it appears that you are attempting to restrict Quarantined users to specific domains for remediation, is this correct? If so, this wouldn't work because it would block the domains allowed for remediation. I proposed a change to this, and from a policy standpoint it should work. Let me know if my reasoning is correct.

It also came to mind that this policy was meant to block quarantined users from accessing known malicious domains, but that wouldn't make much sense, as if the domains/hosts are known to be malicious, you would want that to be blocked organisation-wide

Let me know your thoughts on this.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM!

@maxvp maxvp changed the title Adding API calls to secure-internet-traffic learning path Adding DNS API calls to secure-internet-traffic learning path Dec 30, 2024
@maxvp
Copy link
Contributor

maxvp commented Dec 30, 2024

For sake of separating work, let's limit this PR to only DNS policies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants