diff --git a/CHANGES b/CHANGES index 9b6f9c26..93fac42c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,26 @@ +1.2.7 | 2020-04-10 16:16:06 -0700 + + * Release v1.2.6 + + * Change topic strings to not automaticaly alter slashes (Jon Siwek, Corelight) + + Automatically removing trailing or consecutive slashes in topic strings + prevents uniquely targeting topic names to a node. + + For example, publishing to "node-10/" should not match a subscription + for "node-1/", but that's what happens with prefix-based matching if the + trailing slash is automatically removed. + + * Add Cirrus CI config and remove Travis CI config (Jon Siwek, Corelight) + + The CMake configuration also now prefers choosing a Python3 installation + over Python2 (since that's end-of-life) for building the Broker Python + bindings. + + Some timeout values in unit tests were also fiddled to work better in + the CI environment. + 1.2.6 | 2020-03-09 13:11:25 -0700 * Release v1.2.6 diff --git a/NEWS b/NEWS index 4e4f1df5..22e085a9 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,39 @@ -Broker 2.0.0 +Broker 1.2.7 +============ + +Change topic strings to not automatically alter slashes + +Automatically removing trailing or consecutive slashes in topic strings +prevents uniquely targeting topic names to a node. + +For example, publishing to "node-10/" should not match a subscription +for "node-1/", but that's what happens with prefix-based matching if the +trailing slash is automatically removed. + +Broker 1.2.6 +============ + +Fix a race condition in data store flare operations + +The race (as seen via Zeek usage) goes like: + +Thread A: enqueue item, get suspended +Thread B: sees mailbox has items +Thread B: dequeue item +Thread B: extinguish flare +Thread A: resume, fire flare + +That ordering can leave the flare in an active state without any actual +items remaining in the mailbox. + +This patch adds a mutex/lock such that extinguishing of the flare cannot +be interleaved between the enqueue and firing of the flare. + +This likely relates to https://github.com/zeek/zeek/issues/838 +https://github.com/zeek/zeek/issues/716, as well as this thread +http://mailman.icsi.berkeley.edu/pipermail/zeek/2020-February/015062.html + +Broker 1.2.0 ============ This release contains breaking API changes (for C++ code, not Python) diff --git a/VERSION b/VERSION index 3c43790f..c04c650a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.6 +1.2.7 diff --git a/broker/topic.hh b/broker/topic.hh index a076b70d..8e75a6c1 100644 --- a/broker/topic.hh +++ b/broker/topic.hh @@ -42,7 +42,7 @@ public: >::type > topic(T&& x) : str_(std::forward(x)) { - clean(); + // nop } /// Appends a topic components with a separator. @@ -62,7 +62,6 @@ public: } private: - void clean(); std::string str_; }; diff --git a/broker/version.hh b/broker/version.hh index e940062a..af88ad00 100644 --- a/broker/version.hh +++ b/broker/version.hh @@ -11,7 +11,7 @@ using type = unsigned; constexpr type major = 1; constexpr type minor = 2; -constexpr type patch = 6; +constexpr type patch = 7; constexpr auto suffix = ""; constexpr type protocol = 2; diff --git a/src/topic.cc b/src/topic.cc index 635ee21e..2636a53d 100644 --- a/src/topic.cc +++ b/src/topic.cc @@ -48,19 +48,6 @@ bool topic::prefix_of(const topic& t) const { && t.str_.compare(0, str_.size(), str_) == 0; } -void topic::clean() { - // Remove one or more separators at the end. - while (!str_.empty() && str_.back() == sep) - str_.pop_back(); - // Replace multiple consecutive separators with a single one. - static char sep2[] = {sep, sep}; - auto i = str_.find(sep2, 0, sizeof(sep2)); - if (i != std::string::npos) { - auto j = str_.find_first_not_of(sep, i); - str_.replace(i, j - i, 1, sep); - } -} - bool operator==(const topic& lhs, const topic& rhs) { return lhs.string() == rhs.string(); } diff --git a/tests/cpp/topic.cc b/tests/cpp/topic.cc index f412b8c8..ccc49d45 100644 --- a/tests/cpp/topic.cc +++ b/tests/cpp/topic.cc @@ -11,17 +11,6 @@ auto sep = std::string{topic::sep}; } // namespace -TEST(cleaning) { - auto sep3 = sep + sep + sep; - CHECK_EQUAL(topic{sep3}, ""_t); - auto t = topic{"foo" + sep3}; - CHECK_EQUAL(t, "foo"); - t = sep3 + "foo"; - CHECK_EQUAL(t, sep + "foo"); - t = sep3 + "foo" + sep3; - CHECK_EQUAL(t, sep + "foo"); -} - TEST(concatenation) { topic t; t /= "foo"; diff --git a/tests/python/topic.py b/tests/python/topic.py index a9bc11b2..f408a77a 100644 --- a/tests/python/topic.py +++ b/tests/python/topic.py @@ -15,7 +15,7 @@ def test_append(self): t3 = t1 / t2 t2 /= t1 - self.assertEqual(t3.string(), "/a/b/c") + self.assertEqual(t3.string(), "/a//b/c") self.assertEqual(t2.string(), "/b/c/a") if __name__ == '__main__':