-
Notifications
You must be signed in to change notification settings - Fork 4
Avoid leaking DHCHAP keys to the host system #1165
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
Draft
mxsrc
wants to merge
1
commit into
main
Choose a base branch
from
spdk-keyring-hardening
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,7 +178,7 @@ | |
| return None, None | ||
|
|
||
| def _request3(self, method: str, **kwargs): | ||
| logger.debug("Requesting method: %s, params: %s", method, kwargs) | ||
Check failureCode scanning / CodeQL Clear-text logging of sensitive information High
This expression logs
sensitive data (secret) Error loading related location Loading This expression logs sensitive data (secret) Error loading related location Loading This expression logs sensitive data (secret) as clear text. |
||
| try: | ||
| wire_payload = unwrap_secrets_for_send({ | ||
| 'id': 1, | ||
|
|
@@ -235,6 +235,11 @@ | |
| def keyring_file_add_key(self, name: str, path: str, *, allow_existing: bool = False): | ||
| """Register a file-based key in SPDK's keyring by path. | ||
|
|
||
| Deprecated: requires the key file to be placed on the node beforehand | ||
| (via the deprecated SNodeAPI write_key_file endpoint). Use | ||
| keyring_add_key instead, which delivers the key material through the | ||
| spdk-proxy without touching persistent storage. | ||
|
|
||
| Args: | ||
| name: Key name for the SPDK keyring. | ||
| path: Path to the key file on the storage node. | ||
|
|
@@ -250,6 +255,34 @@ | |
| return None | ||
| raise | ||
|
|
||
| def keyring_add_key(self, name: str, key: SecretStr, *, allow_existing: bool = False): | ||
| """Register a key in SPDK's keyring, delivering the material inline. | ||
|
|
||
| Intercepted by the spdk-proxy, which writes the key to a memory-backed | ||
| secrets directory shared with the SPDK container and forwards a | ||
| keyring_file_add_key referencing that file. A proxy that predates | ||
| interception forwards this to SPDK, which rejects the unknown method | ||
| with -32601; callers fall back to keyring_file_add_key in that case. | ||
|
|
||
| Args: | ||
| name: Key name for the SPDK keyring. | ||
| key: The key material (e.g. DHCHAP/PSK key in its wire format). | ||
| allow_existing: When True, silently succeed if the key is already | ||
| registered with the same material (SPDK errno -17). When False | ||
| (default) an existing key raises RPCException. | ||
|
|
||
| Raises: | ||
| RPCException: On proxy or SPDK errors, including a key of the same | ||
| name existing with different material. | ||
| """ | ||
| try: | ||
| return self._request3("keyring_add_key", name=name, key=key) | ||
| except RPCException as e: | ||
| if allow_existing and e.code == -17: | ||
| logger.debug("Key %s already in SPDK keyring, reusing", name) | ||
| return None | ||
| raise | ||
|
|
||
| def keyring_file_remove_key(self, name): | ||
| """Remove a key from SPDK's keyring.""" | ||
| params = {"name": name} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.