Skip to content

Commit

Permalink
Dissalow adding ns*.wordpress.com as NS record (#94036)
Browse files Browse the repository at this point in the history
* Dissalow adding ns*.wordpress.com as NS record - 978-gh-Automattic/nomado-issues

* Updated regex per discussion with dev lead

---------

Co-authored-by: Steven Partridge <[email protected]>
  • Loading branch information
StevenPartridge and Steven Partridge authored Aug 30, 2024
1 parent 291753c commit b4d838d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/my-sites/domains/domain-management/dns/dns-add-new.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,15 @@ class DnsAddNew extends React.Component {
return true;
}

// Specific to NS records, avoid invalid state by checking if the target Host field is at *.wordpress.com
if (
this.state.fields.type.value === 'NS' &&
fieldName === 'data' &&
/\.wordpress\.com$/i.test( this.state.fields.data.value ) // matches on ns1.wordpress.com, ns2.wordpress.com, *.wordpress.com, etc.
) {
return false;
}

return ! formState.isFieldInvalid( this.state.fields, fieldName );
};

Expand Down

0 comments on commit b4d838d

Please sign in to comment.