Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
]
[tool.poetry.dependencies]
python = ">=3.10,<4.0"
volttron-core = ">=2.0.0rc13"
volttron-core = ">=2.0.0rc26"

[tool.poetry.group.dev.dependencies]
# formatting, quality, tests
Expand Down
12 changes: 3 additions & 9 deletions src/volttron/auth/auth_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,12 @@ def get_credentials(self, *, identity: Identity) -> Credentials:
except IdentityNotFound as e:
raise VIPError(f"Credentials not found for identity {identity}") from e

def add_federation_platform(self, platform_id: str, credentials: Any) -> bool:
def register_remote_platform(self, platform_id: str, credentials: Any):
"""
Register a remote platform for federation access

:param platform_id: ID of the remote platform
:param credentials: Authentication credentials for the remote platform (public key)
:return: True if registration was successful, False otherwise
"""
try:
# Store the platform credentials
Expand All @@ -193,15 +192,10 @@ def add_federation_platform(self, platform_id: str, credentials: Any) -> bool:

platform_identity = f"{platform_id}"
public_creds = PublicCredentials(identity=f"{platform_identity}", publickey=credentials)

self._credentials_store.store_credentials(credentials=public_creds)


_log.info(f"Federation platform registered: {platform_id}")
return True
self._credentials_store.store_credentials(credentials=public_creds, overwrite=True)
Comment on lines 193 to +195
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using platform_id directly as the credentials identity combined with overwrite=True can overwrite existing/local agent credentials if a remote platform registers with a reserved identity (e.g., AUTH, CONTROL, etc.). Consider namespacing federation identities (e.g., federation.<platform_id>) and/or explicitly rejecting reserved/known identities before storing, and only allowing overwrite when you have verified it's the same remote platform updating its own key.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

store_credentials(..., overwrite=True) introduces a hard dependency on a newer volttron-core API. With the current pyproject.toml constraint (volttron-core >=2.0.0rc13), environments may install a core version that doesn't support overwrite, causing a TypeError at runtime. Either bump the minimum volttron-core version in this PR or add a compatibility fallback (call without overwrite when the kwarg isn't supported).

Suggested change
self._credentials_store.store_credentials(credentials=public_creds, overwrite=True)
try:
# Prefer newer API that supports overwriting existing credentials
self._credentials_store.store_credentials(credentials=public_creds, overwrite=True)
except TypeError:
# Fallback for older volttron-core versions that do not accept 'overwrite'
self._credentials_store.store_credentials(credentials=public_creds)

Copilot uses AI. Check for mistakes.
except Exception as e:
_log.error(f"Error registering federation platform {platform_id}: {e}")
Comment on lines 196 to 197
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching Exception and then logging with _log.error(...) loses the traceback context in logs; since the exception is re-raised, consider using _log.exception(...) (or exc_info=True) and avoid double-logging higher up the stack.

Suggested change
except Exception as e:
_log.error(f"Error registering federation platform {platform_id}: {e}")
except Exception:
_log.exception("Error registering federation platform %s", platform_id)

Copilot uses AI. Check for mistakes.
return False
raise
Comment on lines 179 to +198
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method previously returned bool to indicate success/failure, but now has no return type and always returns None on success while raising on error. If any callers (or an interface/abstract base) still expect a boolean result, this is a breaking API change—consider restoring -> bool with an explicit return value, or annotate -> None and ensure all callers are updated accordingly.

Copilot uses AI. Check for mistakes.

def remove_federation_platform(self, platform_id: str) -> bool:
"""
Expand Down
Loading