• Jason Yellick's avatar
    [FAB-2487] Restrict channelIDs to CouchDB/Kafka · 94d7e9af
    Jason Yellick authored
    The current channel ID checks are to ensure that the IDs comply with the
    Kafka topic naming restrictions.
    However, it is possible that two different channel IDs such as TestChain
    and testchain would both map to the same couchdb name, causing an
    intersection and failure.
    This CR changes the logic to test for the intersection of the
    restrictions on CouchDB and Kafka.  In particular, the logic now
    requires that Channel IDs:
    1. Contain only lower case ASCII alphanumerics, dots '.' and dashes '-'
    2. Are shorter than 250 characters.
    3. Start with a letter
    Note that this is not a true intersection, because the ledger must still
    map '.' to '_' for CouchDB, but this mapping is bijective so is safe and
    free from collisions.
    Because the configuration key name checking was leveraging this same
    code path, the existing function was duplicated, to leave the same logic
    checks in place for the config.
    Although the code diff is relatively high, this is largely due to the
    copying and renaming.
    Change-Id: Ie957cf9b8a075233bfcc5d3748e1a91e795ff067
    Signed-off-by: default avatarJason Yellick <jyellick@us.ibm.com>