Skip to content

Commit 7b30c1f

Browse files
committed
Release 5.15.2
2 parents 5ac7495 + 394468c commit 7b30c1f

File tree

15 files changed

+88
-35
lines changed

15 files changed

+88
-35
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ find_package( ecbuild 3.4 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CUR
3131
# Project
3232
# =========================================================================================
3333

34-
project( ecflow LANGUAGES CXX VERSION 5.15.1 )
34+
project( ecflow LANGUAGES CXX VERSION 5.15.2 )
3535
#
3636
# Important:
3737
# The CMake project version is used, as generated CMake variables, to filter .../ecflow/core/ecflow_version.h.in

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797

9898

9999
def get_ecflow_version():
100-
version = "5.15.1"
100+
version = "5.15.2"
101101
ecflow_version = version.split(".")
102102
print("Extracted ecflow version '" + str(ecflow_version))
103103
return ecflow_version

docs/release_notes/version_5.15.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ Version 5.15 updates
66
.. role:: jiraissue
77
:class: hidden
88

9+
Version 5.15.2
10+
==============
11+
12+
* `Released <https://confluence.ecmwf.int/display/ECFLOW/Releases>`__\ on 2025-12-17
13+
14+
Server
15+
------
16+
17+
- **Bug Fix** correct use of whitelist for authorisation purposes :jiraissue:`ECFLOW-2055`
18+
919
Version 5.15.1
1020
==============
1121

libs/base/src/ecflow/base/Client.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bool Client::start_connect(endpoints_iterator_t endpoints_iterator) {
103103
// will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
104104

105105
// Set a deadline for the connect operation.
106-
deadline_.expires_from_now(boost::posix_time::seconds(timeout_));
106+
deadline_.expires_after(std::chrono::seconds(timeout_));
107107

108108
auto endpoint = endpoints_iterator->endpoint();
109109
connection_.socket_ll().async_connect(endpoint,
@@ -190,7 +190,7 @@ void Client::start_write() {
190190
// executed. If it returns 1 then the wait handler was successfully cancelled.
191191

192192
// Set a deadline for the write operation.
193-
deadline_.expires_from_now(boost::posix_time::seconds(timeout_));
193+
deadline_.expires_after(std::chrono::seconds(timeout_));
194194

195195
connection_.async_write(outbound_request_,
196196
[this](const boost::system::error_code& error) { this->handle_write(error); });
@@ -235,7 +235,7 @@ void Client::start_read() {
235235
// executed. If it returns 1 then the wait handler was successfully cancelled.
236236

237237
// Set a deadline for the read operation.
238-
deadline_.expires_from_now(boost::posix_time::seconds(timeout_));
238+
deadline_.expires_after(std::chrono::seconds(timeout_));
239239

240240
connection_.async_read(inbound_response_,
241241
[this](const boost::system::error_code& error) { this->handle_read(error); });
@@ -340,7 +340,7 @@ void Client::check_deadline() {
340340
// Check whether the deadline has passed. We compare the deadline against
341341
// the current time since a new asynchronous operation may have moved the
342342
// deadline before this actor had a chance to run.
343-
if (deadline_.expires_at() <= boost::asio::deadline_timer::traits_type::now()) {
343+
if (deadline_.expiry() <= boost::asio::chrono::system_clock::now()) {
344344
#ifdef DEBUG_CLIENT
345345
std::cout << " Client::check_deadline timed out" << std::endl;
346346
#endif

libs/base/src/ecflow/base/Client.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Client {
7070
ClientToServerRequest outbound_request_; /// The request we will send to the server
7171
ServerToClientResponse inbound_response_; /// The response we get back from the server
7272

73-
boost::asio::deadline_timer deadline_;
73+
boost::asio::system_timer deadline_;
7474

7575
// connect : timeout_ second
7676
// send request : timeout_ second

libs/base/src/ecflow/base/SslClient.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ bool SslClient::start_connect(endpoints_iterator_t endpoints_iterator) {
104104
// will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
105105

106106
// Set a deadline for the connect operation.
107-
deadline_.expires_from_now(boost::posix_time::seconds(timeout_));
107+
deadline_.expires_after(std::chrono::seconds(timeout_));
108108

109109
boost::asio::ip::tcp::endpoint endpoint = *endpoints_iterator;
110110
connection_.socket_ll().async_connect(endpoint,
@@ -192,7 +192,7 @@ void SslClient::start_handshake() {
192192
// cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be
193193
// executed. If it returns 1 then the wait handler was successfully cancelled. Set a deadline for the write
194194
// operation.
195-
deadline_.expires_from_now(boost::posix_time::seconds(timeout_));
195+
deadline_.expires_after(std::chrono::seconds(timeout_));
196196

197197
connection_.socket().async_handshake(boost::asio::ssl::stream_base::client,
198198
[this](const boost::system::error_code& e) { handle_handshake(e); });
@@ -222,7 +222,7 @@ void SslClient::start_write() {
222222
// executed. If it returns 1 then the wait handler was successfully cancelled.
223223

224224
// Set a deadline for the write operation.
225-
deadline_.expires_from_now(boost::posix_time::seconds(timeout_));
225+
deadline_.expires_after(std::chrono::seconds(timeout_));
226226

227227
connection_.async_write(outbound_request_,
228228
[this](const boost::system::error_code& error) { this->handle_write(error); });
@@ -267,7 +267,7 @@ void SslClient::start_read() {
267267
// executed. If it returns 1 then the wait handler was successfully cancelled.
268268

269269
// Set a deadline for the read operation.
270-
deadline_.expires_from_now(boost::posix_time::seconds(timeout_));
270+
deadline_.expires_after(std::chrono::seconds(timeout_));
271271

272272
connection_.async_read(inbound_response_,
273273
[this](const boost::system::error_code& error) { this->handle_read(error); });
@@ -369,7 +369,7 @@ void SslClient::check_deadline() {
369369
// Check whether the deadline has passed. We compare the deadline against
370370
// the current time since a new asynchronous operation may have moved the
371371
// deadline before this actor had a chance to run.
372-
if (deadline_.expires_at() <= boost::asio::deadline_timer::traits_type::now()) {
372+
if (deadline_.expiry() <= boost::asio::chrono::system_clock::now()) {
373373
#ifdef DEBUG_CLIENT
374374
std::cout << " SslClient::check_deadline timed out" << std::endl;
375375
#endif

libs/base/src/ecflow/base/SslClient.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class SslClient {
7272
ClientToServerRequest outbound_request_; /// The request we will send to the server
7373
ServerToClientResponse inbound_response_; /// The response we get back from the server
7474

75-
boost::asio::deadline_timer deadline_;
75+
boost::asio::system_timer deadline_;
7676

7777
// connect : timeout_ second
7878
// send request : timeout_ second

libs/server/src/ecflow/server/AuthorisationService.cpp

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,40 @@
1313
#include "ecflow/base/AbstractServer.hpp"
1414
#include "ecflow/base/Algorithms.hpp"
1515
#include "ecflow/core/Overload.hpp"
16+
#include "ecflow/core/WhiteListFile.hpp"
1617

1718
namespace ecf {
1819

19-
struct Rules
20+
///
21+
/// NodeRules represent permissions derived from the nodes themselves (based on ECF_PERMISSIONS permissions)
22+
///
23+
struct NodeRules
2024
{
2125
};
2226

27+
///
28+
/// WhiteListRules represent permissions define by a white list file
29+
///
30+
struct WhiteListRules
31+
{
32+
WhiteListRules(const WhiteListFile& file) : file_(file) {}
33+
const WhiteListFile& file_;
34+
};
35+
36+
///
37+
/// Unrestricted represent no restrictions at all
38+
///
2339
struct Unrestricted
2440
{
2541
};
2642

2743
struct AuthorisationService::Impl
2844
{
2945
Impl() : permissions_(Unrestricted{}) {}
30-
explicit Impl(Rules&& rules) : permissions_(std::move(rules)) {}
46+
explicit Impl(NodeRules&& rules) : permissions_(std::move(rules)) {}
47+
explicit Impl(WhiteListRules&& rules) : permissions_(std::move(rules)) {}
3148

32-
std::variant<Unrestricted, Rules> permissions_;
49+
std::variant<Unrestricted, NodeRules, WhiteListRules> permissions_;
3350
};
3451

3552
AuthorisationService::AuthorisationService() = default;
@@ -83,7 +100,19 @@ bool AuthorisationService::allows(const Identity& identity,
83100
// Dangerous, but backward compatible!
84101
allowed = true;
85102
},
86-
[&server, &identity, &paths, &permission, &allowed](const Rules& rules) {
103+
[&allowed, &identity, &paths, &permission](const WhiteListRules& rules) {
104+
// Apply white list rules
105+
if (permission == "read") {
106+
allowed = rules.file_.verify_read_access(identity.username(), paths);
107+
}
108+
else if (permission == "write") {
109+
allowed = rules.file_.verify_write_access(identity.username(), paths);
110+
}
111+
else {
112+
allowed = false;
113+
}
114+
},
115+
[&server, &identity, &paths, &permission, &allowed](const NodeRules& rules) {
87116
for (auto&& path : paths) {
88117

89118
auto u = identity.as_string();
@@ -132,7 +161,11 @@ bool AuthorisationService::allows(const Identity& identity,
132161
}
133162

134163
AuthorisationService::result_t AuthorisationService::load_permissions_from_nodes() {
135-
return result_t::success(AuthorisationService(std::make_unique<Impl>(Rules{})));
164+
return result_t::success(AuthorisationService(std::make_unique<Impl>(NodeRules{})));
165+
}
166+
167+
AuthorisationService::result_t AuthorisationService::load_permissions_from_whitelist(const WhiteListFile& whitelist) {
168+
return result_t::success(AuthorisationService(std::make_unique<Impl>(WhiteListRules{whitelist})));
136169
}
137170

138171
} // namespace ecf

libs/server/src/ecflow/server/AuthorisationService.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "ecflow/core/Filesystem.hpp"
1515
#include "ecflow/core/Identity.hpp"
1616
#include "ecflow/core/Result.hpp"
17+
#include "ecflow/core/WhiteListFile.hpp"
1718

1819
class AbstractServer;
1920

@@ -70,6 +71,7 @@ class AuthorisationService {
7071

7172
[[nodiscard]]
7273
static result_t load_permissions_from_nodes();
74+
static result_t load_permissions_from_whitelist(const WhiteListFile& whitelist);
7375

7476
private:
7577
struct Impl;

libs/server/src/ecflow/server/CheckPtSaver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ using namespace ecf;
2929
//-------------------------------------------------------------------------------------
3030
CheckPtSaver::CheckPtSaver(BaseServer* s, boost::asio::io_context& io, const ServerEnvironment* serverEnv)
3131
: server_(s),
32-
timer_(io, boost::posix_time::seconds(0)),
32+
timer_(io, std::chrono::seconds(0)),
3333
firstTime_(true),
3434
running_(false),
3535
serverEnv_(serverEnv),
@@ -67,7 +67,7 @@ void CheckPtSaver::start() {
6767
// with explicit save each time server is halted/started.
6868
if (firstTime_) {
6969
firstTime_ = false;
70-
timer_.expires_from_now(boost::posix_time::seconds(serverEnv_->checkPtInterval()));
70+
timer_.expires_after(std::chrono::seconds(serverEnv_->checkPtInterval()));
7171
timer_.async_wait(boost::asio::bind_executor(
7272
server_->io_, [this](const boost::system::error_code& error) { periodicSaveCheckPt(error); }));
7373
}
@@ -170,7 +170,7 @@ void CheckPtSaver::periodicSaveCheckPt(const boost::system::error_code& error) {
170170
}
171171

172172
/// Appears that expires_from_now is more accurate then expires_at
173-
timer_.expires_from_now(boost::posix_time::seconds(serverEnv_->checkPtInterval()));
173+
timer_.expires_after(std::chrono::seconds(serverEnv_->checkPtInterval()));
174174
timer_.async_wait(boost::asio::bind_executor(
175175
server_->io_, [this](const boost::system::error_code& error) { periodicSaveCheckPt(error); }));
176176
}

0 commit comments

Comments
 (0)