flwr-nightly 1.14.0.dev20241127__py3-none-any.whl → 1.14.0.dev20241202__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of flwr-nightly might be problematic. Click here for more details.
- flwr/server/app.py +1 -1
- flwr/server/superlink/fleet/grpc_rere/server_interceptor.py +12 -11
- flwr/server/superlink/linkstate/sqlite_linkstate.py +0 -3
- {flwr_nightly-1.14.0.dev20241127.dist-info → flwr_nightly-1.14.0.dev20241202.dist-info}/METADATA +1 -1
- {flwr_nightly-1.14.0.dev20241127.dist-info → flwr_nightly-1.14.0.dev20241202.dist-info}/RECORD +8 -8
- {flwr_nightly-1.14.0.dev20241127.dist-info → flwr_nightly-1.14.0.dev20241202.dist-info}/LICENSE +0 -0
- {flwr_nightly-1.14.0.dev20241127.dist-info → flwr_nightly-1.14.0.dev20241202.dist-info}/WHEEL +0 -0
- {flwr_nightly-1.14.0.dev20241127.dist-info → flwr_nightly-1.14.0.dev20241202.dist-info}/entry_points.txt +0 -0
flwr/server/app.py
CHANGED
|
@@ -360,7 +360,7 @@ def run_superlink() -> None:
|
|
|
360
360
|
"Node authentication enabled with %d known public keys",
|
|
361
361
|
len(node_public_keys),
|
|
362
362
|
)
|
|
363
|
-
interceptors = [AuthenticateServerInterceptor(
|
|
363
|
+
interceptors = [AuthenticateServerInterceptor(state_factory)]
|
|
364
364
|
|
|
365
365
|
fleet_server = _run_fleet_api_grpc_rere(
|
|
366
366
|
address=fleet_address,
|
|
@@ -45,7 +45,7 @@ from flwr.proto.fleet_pb2 import ( # pylint: disable=E0611
|
|
|
45
45
|
)
|
|
46
46
|
from flwr.proto.node_pb2 import Node # pylint: disable=E0611
|
|
47
47
|
from flwr.proto.run_pb2 import GetRunRequest, GetRunResponse # pylint: disable=E0611
|
|
48
|
-
from flwr.server.superlink.linkstate import
|
|
48
|
+
from flwr.server.superlink.linkstate import LinkStateFactory
|
|
49
49
|
|
|
50
50
|
_PUBLIC_KEY_HEADER = "public-key"
|
|
51
51
|
_AUTH_TOKEN_HEADER = "auth-token"
|
|
@@ -84,15 +84,16 @@ def _get_value_from_tuples(
|
|
|
84
84
|
class AuthenticateServerInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
85
85
|
"""Server interceptor for node authentication."""
|
|
86
86
|
|
|
87
|
-
def __init__(self,
|
|
88
|
-
self.
|
|
87
|
+
def __init__(self, state_factory: LinkStateFactory):
|
|
88
|
+
self.state_factory = state_factory
|
|
89
|
+
state = self.state_factory.state()
|
|
89
90
|
|
|
90
91
|
self.node_public_keys = state.get_node_public_keys()
|
|
91
92
|
if len(self.node_public_keys) == 0:
|
|
92
93
|
log(WARNING, "Authentication enabled, but no known public keys configured")
|
|
93
94
|
|
|
94
|
-
private_key =
|
|
95
|
-
public_key =
|
|
95
|
+
private_key = state.get_server_private_key()
|
|
96
|
+
public_key = state.get_server_public_key()
|
|
96
97
|
|
|
97
98
|
if private_key is None or public_key is None:
|
|
98
99
|
raise ValueError("Error loading authentication keys")
|
|
@@ -154,7 +155,7 @@ class AuthenticateServerInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
|
154
155
|
context.abort(grpc.StatusCode.UNAUTHENTICATED, "Access denied")
|
|
155
156
|
|
|
156
157
|
# Verify node_id
|
|
157
|
-
node_id = self.state.get_node_id(node_public_key_bytes)
|
|
158
|
+
node_id = self.state_factory.state().get_node_id(node_public_key_bytes)
|
|
158
159
|
|
|
159
160
|
if not self._verify_node_id(node_id, request):
|
|
160
161
|
context.abort(grpc.StatusCode.UNAUTHENTICATED, "Access denied")
|
|
@@ -186,7 +187,7 @@ class AuthenticateServerInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
|
186
187
|
return False
|
|
187
188
|
return request.task_res_list[0].task.producer.node_id == node_id
|
|
188
189
|
if isinstance(request, GetRunRequest):
|
|
189
|
-
return node_id in self.state.get_nodes(request.run_id)
|
|
190
|
+
return node_id in self.state_factory.state().get_nodes(request.run_id)
|
|
190
191
|
return request.node.node_id == node_id
|
|
191
192
|
|
|
192
193
|
def _verify_hmac(
|
|
@@ -210,17 +211,17 @@ class AuthenticateServerInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
|
210
211
|
),
|
|
211
212
|
)
|
|
212
213
|
)
|
|
213
|
-
|
|
214
|
-
node_id =
|
|
214
|
+
state = self.state_factory.state()
|
|
215
|
+
node_id = state.get_node_id(public_key_bytes)
|
|
215
216
|
|
|
216
217
|
# Handle `CreateNode` here instead of calling the default method handler
|
|
217
218
|
# Return previously assigned `node_id` for the provided `public_key`
|
|
218
219
|
if node_id is not None:
|
|
219
|
-
|
|
220
|
+
state.acknowledge_ping(node_id, request.ping_interval)
|
|
220
221
|
return CreateNodeResponse(node=Node(node_id=node_id, anonymous=False))
|
|
221
222
|
|
|
222
223
|
# No `node_id` exists for the provided `public_key`
|
|
223
224
|
# Handle `CreateNode` here instead of calling the default method handler
|
|
224
225
|
# Note: the innermost `CreateNode` method will never be called
|
|
225
|
-
node_id =
|
|
226
|
+
node_id = state.create_node(request.ping_interval, public_key_bytes)
|
|
226
227
|
return CreateNodeResponse(node=Node(node_id=node_id, anonymous=False))
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
import json
|
|
20
20
|
import re
|
|
21
21
|
import sqlite3
|
|
22
|
-
import threading
|
|
23
22
|
import time
|
|
24
23
|
from collections.abc import Sequence
|
|
25
24
|
from logging import DEBUG, ERROR, WARNING
|
|
@@ -183,7 +182,6 @@ class SqliteLinkState(LinkState): # pylint: disable=R0904
|
|
|
183
182
|
"""
|
|
184
183
|
self.database_path = database_path
|
|
185
184
|
self.conn: Optional[sqlite3.Connection] = None
|
|
186
|
-
self.lock = threading.RLock()
|
|
187
185
|
|
|
188
186
|
def initialize(self, log_queries: bool = False) -> list[tuple[str]]:
|
|
189
187
|
"""Create tables if they don't exist yet.
|
|
@@ -216,7 +214,6 @@ class SqliteLinkState(LinkState): # pylint: disable=R0904
|
|
|
216
214
|
cur.execute(SQL_CREATE_TABLE_PUBLIC_KEY)
|
|
217
215
|
cur.execute(SQL_CREATE_INDEX_ONLINE_UNTIL)
|
|
218
216
|
res = cur.execute("SELECT name FROM sqlite_schema;")
|
|
219
|
-
|
|
220
217
|
return res.fetchall()
|
|
221
218
|
|
|
222
219
|
def query(
|
{flwr_nightly-1.14.0.dev20241127.dist-info → flwr_nightly-1.14.0.dev20241202.dist-info}/RECORD
RENAMED
|
@@ -213,7 +213,7 @@ flwr/proto/transport_pb2_grpc.py,sha256=vLN3EHtx2aEEMCO4f1Upu-l27BPzd3-5pV-u8wPc
|
|
|
213
213
|
flwr/proto/transport_pb2_grpc.pyi,sha256=AGXf8RiIiW2J5IKMlm_3qT3AzcDa4F3P5IqUjve_esA,766
|
|
214
214
|
flwr/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
215
215
|
flwr/server/__init__.py,sha256=cEg1oecBu4cKB69iJCqWEylC8b5XW47bl7rQiJsdTvM,1528
|
|
216
|
-
flwr/server/app.py,sha256=
|
|
216
|
+
flwr/server/app.py,sha256=wes1HI5KJfzPry7bjztQDazn1FIca3CS6kEVM_6LLUY,28872
|
|
217
217
|
flwr/server/client_manager.py,sha256=7Ese0tgrH-i-ms363feYZJKwB8gWnXSmg_hYF2Bju4U,6227
|
|
218
218
|
flwr/server/client_proxy.py,sha256=4G-oTwhb45sfWLx2uZdcXD98IZwdTS6F88xe3akCdUg,2399
|
|
219
219
|
flwr/server/compat/__init__.py,sha256=VxnJtJyOjNFQXMNi9hIuzNlZM5n0Hj1p3aq_Pm2udw4,892
|
|
@@ -276,7 +276,7 @@ flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy.py,sha256=h3EhqgelegVC4E
|
|
|
276
276
|
flwr/server/superlink/fleet/grpc_bidi/grpc_server.py,sha256=X4I2rd1ZC9fqjOg9uwdTydLxJ3JiWthkIAqb3wEv17g,12454
|
|
277
277
|
flwr/server/superlink/fleet/grpc_rere/__init__.py,sha256=j2hyC342am-_Hgp1g80Y3fGDzfTI6n8QOOn2PyWf4eg,758
|
|
278
278
|
flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py,sha256=JuNdT6hs4iRtuToV6vkEuftCE_LgSipBPeRAJLWnJKw,4783
|
|
279
|
-
flwr/server/superlink/fleet/grpc_rere/server_interceptor.py,sha256=
|
|
279
|
+
flwr/server/superlink/fleet/grpc_rere/server_interceptor.py,sha256=8PHzqtW_rKBvqI5XVwYN-CBEpEonnj85iN0daSWliyI,8299
|
|
280
280
|
flwr/server/superlink/fleet/message_handler/__init__.py,sha256=h8oLD7uo5lKICPy0rRdKRjTYe62u8PKkT_fA4xF5JPA,731
|
|
281
281
|
flwr/server/superlink/fleet/message_handler/message_handler.py,sha256=WAis2WPj0L91HSfOZqX-k0n9Rs3igdARKRMsV1VlTnY,4465
|
|
282
282
|
flwr/server/superlink/fleet/rest_rere/__init__.py,sha256=5jbYbAn75sGv-gBwOPDySE0kz96F6dTYLeMrGqNi4lM,735
|
|
@@ -290,7 +290,7 @@ flwr/server/superlink/linkstate/__init__.py,sha256=v-2JyJlCB3qyhMNwMjmcNVOq4rkoo
|
|
|
290
290
|
flwr/server/superlink/linkstate/in_memory_linkstate.py,sha256=TRayqT_pKB0JfdsAYXwtuXyG4d3vYD_vhvYixhTlAec,22327
|
|
291
291
|
flwr/server/superlink/linkstate/linkstate.py,sha256=9tb80YM1XhVSuiE32PVqdG7fBulqtSGM3Hv01WaFLcQ,12548
|
|
292
292
|
flwr/server/superlink/linkstate/linkstate_factory.py,sha256=ISSMjDlwuN7swxjOeYlTNpI_kuZ8PGkMcJnf1dbhUSE,2069
|
|
293
|
-
flwr/server/superlink/linkstate/sqlite_linkstate.py,sha256=
|
|
293
|
+
flwr/server/superlink/linkstate/sqlite_linkstate.py,sha256=XWr-2CWZTWCrGdXV_wYBBLEZ9vj8zRm8_nZh9ZmztdI,43389
|
|
294
294
|
flwr/server/superlink/linkstate/utils.py,sha256=d5uqqIOCKfd54X8CFNfUr3AWqPLpgmzsC_RagRwFugM,13321
|
|
295
295
|
flwr/server/superlink/simulation/__init__.py,sha256=mg-oapC9dkzEfjXPQFior5lpWj4g9kwbLovptyYM_g0,718
|
|
296
296
|
flwr/server/superlink/simulation/simulationio_grpc.py,sha256=5wflYW_TS0mjmPG6OYuHMJwXD2_cYmUNhFkdOU0jMWQ,2237
|
|
@@ -321,8 +321,8 @@ flwr/superexec/exec_grpc.py,sha256=OuhBAk7hiky9rjGceinLGIXqchtzGPQThZnwyYv6Ei0,2
|
|
|
321
321
|
flwr/superexec/exec_servicer.py,sha256=M3R3q5rg2kYz-gFN-nmiXkvjels4QbieEA0K5wks0kQ,4972
|
|
322
322
|
flwr/superexec/executor.py,sha256=zH3_53il6Jh0ZscIVEB9f4GNnXMeBbCGyCoBCxLgiG0,3114
|
|
323
323
|
flwr/superexec/simulation.py,sha256=WQDon15oqpMopAZnwRZoTICYCfHqtkvFSqiTQ2hLD_g,4088
|
|
324
|
-
flwr_nightly-1.14.0.
|
|
325
|
-
flwr_nightly-1.14.0.
|
|
326
|
-
flwr_nightly-1.14.0.
|
|
327
|
-
flwr_nightly-1.14.0.
|
|
328
|
-
flwr_nightly-1.14.0.
|
|
324
|
+
flwr_nightly-1.14.0.dev20241202.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
325
|
+
flwr_nightly-1.14.0.dev20241202.dist-info/METADATA,sha256=o6efv7F40gKQKDCxlO04rzDXKdiB8RdLaUrTSY50W5Q,15679
|
|
326
|
+
flwr_nightly-1.14.0.dev20241202.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
327
|
+
flwr_nightly-1.14.0.dev20241202.dist-info/entry_points.txt,sha256=JlNxX3qhaV18_2yj5a3kJW1ESxm31cal9iS_N_pf1Rk,538
|
|
328
|
+
flwr_nightly-1.14.0.dev20241202.dist-info/RECORD,,
|
{flwr_nightly-1.14.0.dev20241127.dist-info → flwr_nightly-1.14.0.dev20241202.dist-info}/LICENSE
RENAMED
|
File without changes
|
{flwr_nightly-1.14.0.dev20241127.dist-info → flwr_nightly-1.14.0.dev20241202.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|