]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
auth/cephx: enforce sorted config keys
authorPatrick Donnelly <pdonnell@ibm.com>
Wed, 26 Mar 2025 01:55:22 +0000 (21:55 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Mon, 22 Sep 2025 16:34:39 +0000 (12:34 -0400)
Makes future additions avoid conflicts.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
(cherry picked from commit 6ca5288570a8e6f4edb7b4f7ca0c47b9c4f0d212)

src/auth/cephx/CephxServiceHandler.cc

index 4b61df25badca3f1649098f081cf3815dfb7c5d5..df886514352ff6cf11e299d5b1e3e1d3e9352cab 100644 (file)
@@ -45,9 +45,11 @@ CephxServiceHandler::CephxServiceHandler(CephContext *cct_, KeyServer *ks)
 
 std::vector<std::string> CephxServiceHandler::get_tracked_keys() const noexcept
 {
-  return {
-    "cephx_allowed_ciphers"s
-  };
+  static constexpr auto as_sv = std::to_array<std::string_view>({
+    "cephx_allowed_ciphers",
+  });
+  static_assert(std::is_sorted(as_sv.begin(), as_sv.end()), "keys are not sorted!");
+  return {as_sv.begin(), as_sv.end()};
 }
 
 void CephxServiceHandler::init_conf(const ConfigProxy& conf) {