-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement HTTP server for remote UEFI shell capability #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
We don't publish DEVs .whl. |
1 similar comment
|
We don't publish DEVs .whl. |
7904675 to
b38783f
Compare
|
We don't publish DEVs .whl. |
1 similar comment
|
We don't publish DEVs .whl. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a remote shell (RShell) capability that enables HTTP-based command execution between a Python client and Flask server, with specific support for UEFI shell environments.
Key changes:
- Added RShellConnection class for managing remote command execution via HTTP
- Implemented Flask-based server for handling command queues and client connections
- Created UEFI-compatible HTTP client with specialized handling for UEFI shell limitations
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| mfd_connect/rshell_server.py | Flask REST server managing command queues, health checks, and result collection |
| mfd_connect/rshell_client.py | HTTP client designed for UEFI shell with polling and command execution capabilities |
| mfd_connect/rshell.py | RShellConnection class providing remote command execution interface |
| examples/rshell_example.py | Usage example demonstrating RShellConnection functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
b38783f to
1fea908
Compare
|
We don't publish DEVs .whl. |
1 similar comment
|
We don't publish DEVs .whl. |
|
We don't publish DEVs .whl. |
1 similar comment
|
We don't publish DEVs .whl. |
dfe39e4 to
abcb17d
Compare
|
We don't publish DEVs .whl. |
1 similar comment
|
We don't publish DEVs .whl. |
abcb17d to
7f6f67a
Compare
|
We don't publish DEVs .whl. |
1 similar comment
|
We don't publish DEVs .whl. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7f6f67a to
5ab80e4
Compare
|
We don't publish DEVs .whl. |
1 similar comment
|
We don't publish DEVs .whl. |
5ab80e4 to
ec5d15c
Compare
ec5d15c to
ba8ddb4
Compare
Signed-off-by: Lasota, Adrian <adrian.lasota@intel.com>
ba8ddb4 to
41d81cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 7 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| if __name__ == "__main__": | ||
| print("Starting Flask REST server...") | ||
| app.run(host="0.0.0.0", port=80) |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running Flask server on privileged port 80 without authentication or authorization checks exposes all endpoints to any network client. Consider using a non-privileged port (e.g., 8080) or implementing authentication middleware to verify client requests.
| app.run(host="0.0.0.0", port=80) | |
| app.run(host="0.0.0.0", port=8080) |
| """ | ||
| print("Getting output for command ID:", command_id) | ||
| print(f"Waiting for output {timeout} seconds") | ||
| timeout = timeout + 5 # add time for client loop waiting |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic number '5' lacks explanation. Consider documenting why 5 seconds are added to the timeout or defining it as a named constant (e.g., CLIENT_LOOP_BUFFER = 5).
| os_name = os.name | ||
|
|
||
|
|
||
| def _sleep(interval): # noqa: ANN001, ANN202 |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The busy-wait implementation of _sleep will consume 100% CPU during sleep intervals. This is inefficient even in UEFI environments. Consider using a less aggressive polling interval or documenting this performance trade-off.
| def __init__( | ||
| self, | ||
| ip: str | IPv4Address | IPv6Address, | ||
| server_ip: str | IPv4Address | IPv6Address | None = "127.0.0.1", |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value '127.0.0.1' has type str but parameter accepts None. The logic at line 56 checks if server_ip which treats empty string as falsy. Consider using None as default and explicitly setting to '127.0.0.1' when None, or adjust the conditional to if server_ip is None.
| logging.basicConfig(level=logging.DEBUG) | ||
| from mfd_connect.rshell import RShellConnection |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import statement should appear before code execution. Move the import of RShellConnection to line 4, before the logging.basicConfig() call.
| logging.basicConfig(level=logging.DEBUG) | |
| from mfd_connect.rshell import RShellConnection | |
| from mfd_connect.rshell import RShellConnection | |
| logging.basicConfig(level=logging.DEBUG) |
|
We don't publish DEVs .whl. |
5 similar comments
|
We don't publish DEVs .whl. |
|
We don't publish DEVs .whl. |
|
We don't publish DEVs .whl. |
|
We don't publish DEVs .whl. |
|
We don't publish DEVs .whl. |
This pull request introduces a new remote shell (RShell) connection mechanism for executing commands on remote systems via an HTTP-based protocol. The main changes include the addition of a robust
RShellConnectionclass, a Flask-based RShell server, and a sample RShell client for UEFI shell environments. These components work together to allow remote command execution and result retrieval over HTTP, supporting both Linux and UEFI environments.Key changes:
RShell Connection Implementation
RShellConnectionclass inmfd_connect/rshell.py, which manages the lifecycle of RShell servers and clients, handles command execution via HTTP requests, and provides logging and error handling for unsupported features.RShell Server
mfd_connect/rshell_server.py, a Flask-based HTTP server that manages command queues per client, handles command dispatch and result collection, and provides health check endpoints.RShell Client
mfd_connect/rshell_client.py, a sample HTTP client application designed for UEFI shell environments, which polls the RShell server for commands, executes them, and posts results or exceptions back to the server.Example Usage
examples/rshell_example.pydemonstrating how to instantiate and use the newRShellConnectionto execute remote commands and manage connections.