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

Dissalow adding ns*.wordpress.com as NS record #94036

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

StevenPartridge
Copy link
Contributor

Internal bug: 978-gh-Automattic/nomado-issues

Proposed Changes

  • Sets the Hosts field as 'invalid' if setting NS record to *.wordpress.com

Why are these changes being made?

  • As a user, I should not be able to add NS records pointing to our nameservers.
  • NS records pointing to ns?.wordpress.com doesn't make sense since we are hosting the root zone anyway
  • Fixes a bug that results in a UI issue where the added NS record shows as Handled by WordPress.com and the user can't edit or delete them anymore

It makes the most sense to block <*>.wordpress.com

Discussed introducing validation checks in the API too, as well as additional output/guidance for the user, but it was determined to be unnessesary at the moment. Can open new tasks to for either if requested.

Testing Instructions

  • Check out this branch and run
  • Navigate to 'Add a New DNS Record'
  • Specify 'NS' as the type
  • Add any 'Name'
  • Test different combinations for 'Hosts', the only disallowed Hosts would match <*>.wordpress.com NS server structure
    • ns.wordpress.com
    • Valid: ns1wordpress.com, ns1.anythingelse.com
    • Invalid: ns1337.wordpress.com, ns1.wordpress.com
not valid: ns1.wordpress.com
not valid: ns2.WoRdPrEsS.com
not valid: ns3.wordpress.com
not valid: nsone.wordpress.com
not valid: ns999999.wordpress.com
not valid: mysite.wordpress.com
not valid: *.wordpress.com

valid: ns1wordpress.com
valid: wordpress.com
valid: ns1.wardpress.com
valid: ns1.WoRdPrEsS.edu
valid: ns2.wordpress.org
valid: ns3.wordpress.co

Regexr.com
image

Screenshot from local dev:
image

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@StevenPartridge StevenPartridge added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Aug 29, 2024
@StevenPartridge StevenPartridge self-assigned this Aug 29, 2024
@StevenPartridge StevenPartridge requested a review from a team as a code owner August 29, 2024 19:52
@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~22 bytes added 📈 [gzipped])

name     parsed_size           gzip_size
domains       +109 B  (+0.0%)      +22 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Contributor

@delputnam delputnam left a comment

Choose a reason for hiding this comment

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

This looks correct and works well for me. It prevents users from incorrectly adding NS records that they are unable to remove.

@delputnam delputnam added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Aug 29, 2024
@leonardost leonardost merged commit b4d838d into trunk Aug 30, 2024
15 checks passed
@leonardost leonardost deleted the feature/978-disallow-loopback-ns-setting branch August 30, 2024 17:18
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.

4 participants