From 941429d3a7641c6348dd5096207059af96daae5e Mon Sep 17 00:00:00 2001 From: Patrick Kuo Date: Wed, 31 Jan 2018 17:05:52 +0000 Subject: [PATCH] Remove word restriction in corda x500 name (#2439) * Remove word restriction in x500 name https://github.com/corda/corda/issues/2326 * remove unused const * address PR issue * address PR issue * address PR issue --- .../main/kotlin/net/corda/core/identity/CordaX500Name.kt | 4 +--- .../kotlin/net/corda/core/internal/LegalNameValidator.kt | 3 ++- .../net/corda/core/internal/LegalNameValidatorTest.kt | 7 ------- docs/source/changelog.rst | 2 ++ docs/source/generating-a-node.rst | 1 - 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/core/src/main/kotlin/net/corda/core/identity/CordaX500Name.kt b/core/src/main/kotlin/net/corda/core/identity/CordaX500Name.kt index abe3d21fd4..5d7e27ac47 100644 --- a/core/src/main/kotlin/net/corda/core/identity/CordaX500Name.kt +++ b/core/src/main/kotlin/net/corda/core/identity/CordaX500Name.kt @@ -50,9 +50,6 @@ data class CordaX500Name(val commonName: String?, // Legal name checks. LegalNameValidator.validateOrganization(organisation, LegalNameValidator.Validation.MINIMAL) - // Attribute data width checks. - require(country.length == LENGTH_COUNTRY) { "Invalid country '$country' Country code must be $LENGTH_COUNTRY letters ISO code " } - require(country.toUpperCase() == country) { "Country code should be in upper case." } require(country in countryCodes) { "Invalid country code $country" } require(organisation.length < MAX_LENGTH_ORGANISATION) { @@ -74,6 +71,7 @@ data class CordaX500Name(val commonName: String?, } companion object { + @Deprecated("Not Used") const val LENGTH_COUNTRY = 2 const val MAX_LENGTH_ORGANISATION = 128 const val MAX_LENGTH_LOCALITY = 64 diff --git a/core/src/main/kotlin/net/corda/core/internal/LegalNameValidator.kt b/core/src/main/kotlin/net/corda/core/internal/LegalNameValidator.kt index ffdba208b8..9f97612852 100644 --- a/core/src/main/kotlin/net/corda/core/internal/LegalNameValidator.kt +++ b/core/src/main/kotlin/net/corda/core/internal/LegalNameValidator.kt @@ -91,7 +91,8 @@ object LegalNameValidator { CapitalLetterRule() ) val legalNameRules: List> = attributeRules + listOf( - WordRule("node", "server"), + // Removal of word restriction was requested in https://github.com/corda/corda/issues/2326 + // WordRule("node", "server"), X500NameRule() ) val legalNameFullRules: List> = legalNameRules + listOf( diff --git a/core/src/test/kotlin/net/corda/core/internal/LegalNameValidatorTest.kt b/core/src/test/kotlin/net/corda/core/internal/LegalNameValidatorTest.kt index 5db052fcc1..922a99117a 100644 --- a/core/src/test/kotlin/net/corda/core/internal/LegalNameValidatorTest.kt +++ b/core/src/test/kotlin/net/corda/core/internal/LegalNameValidatorTest.kt @@ -27,13 +27,6 @@ class LegalNameValidatorTest { } } - @Test - fun `blacklisted words`() { - assertFailsWith(IllegalArgumentException::class) { - LegalNameValidator.validateOrganization("Test Server", LegalNameValidator.Validation.FULL) - } - } - @Test fun `blacklisted characters`() { LegalNameValidator.validateOrganization("Test", LegalNameValidator.Validation.FULL) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 0878044a79..afe5cd3215 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -6,6 +6,8 @@ from the previous milestone release. UNRELEASED ---------- +* Removed blacklisted word checks in Corda X.500 name to allow "Server" or "Node" to be use as part of the legal name. + * Separated our pre-existing Artemis broker into an RPC broker and a P2P broker. * Refactored ``NodeConfiguration`` to expose ``NodeRpcOptions`` (using top-level "rpcAddress" property still works with warning). diff --git a/docs/source/generating-a-node.rst b/docs/source/generating-a-node.rst index 6a11dc2721..99c5022344 100644 --- a/docs/source/generating-a-node.rst +++ b/docs/source/generating-a-node.rst @@ -63,7 +63,6 @@ The name must also obey the following constraints: * The organisation field of the name also obeys the following constraints: * No double-spacing - * Does not contain the words "node" or "server" * This is to avoid right-to-left issues, debugging issues when we can't pronounce names over the phone, and character confusability attacks