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
This commit is contained in:
Patrick Kuo 2018-01-31 17:05:52 +00:00 committed by GitHub
parent ceff50d656
commit 941429d3a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 12 deletions

View File

@ -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

View File

@ -91,7 +91,8 @@ object LegalNameValidator {
CapitalLetterRule()
)
val legalNameRules: List<Rule<String>> = 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<Rule<String>> = legalNameRules + listOf(

View File

@ -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)

View File

@ -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).

View File

@ -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