Repository navigation
Conversation
Bravo555
requested review from
a team,
albinsuresh,
didier-wenzek,
jarhodes314 and
rina23q
as code owners
September 15, 2026 08:48
Bravo555
had a problem deploying
to
Test Pull Request
September 15, 2026 08:49 — with
GitHub Actions
Failure
Bravo555
force-pushed
the
feat/pkcs11-uri-warn
branch
from
September 15, 2026 08:50
21bc939 to
cdb5285
Compare
Bravo555
requested a deployment
to
Test Pull Request
September 15, 2026 08:50 — with
GitHub Actions
Waiting
Bravo555
force-pushed
the
feat/pkcs11-uri-warn
branch
from
September 15, 2026 08:51
cdb5285 to
7ee81f9
Compare
Bravo555
had a problem deploying
to
Test Pull Request
September 15, 2026 08:51 — with
GitHub Actions
Failure
7 of 11 tasks
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Bravo555
marked this pull request as draft
September 16, 2026 12:40
Previously, when tedge-p11-server used `device.cryptoki.uri=pkcs11:token=tedge1` but list-keys requested `pkcs11:token=tedge2`, tedge-p11-server would return keys with `token=tedge1`, which is not what the client requested. Now, we filter these non-matching keys on the client side and warn the user if any results were filtered because `device.cryptoki.uri` was used by the server. Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
URIs exported by tedge-p11-server never include `slot-id`, so a filter with a `slot-id` attribute never matched them, and `tedge hsm list-keys pkcs11:slot-id=N` hid every key. Only compare slot ids when both URIs have one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
tedge-p11-server uses its `device.cryptoki.uri` as a base for request URIs, and its attributes win over the requested ones, so `tedge hsm` commands could act on another token or key than requested without any message. delete-key, create-key and change-pin now list the keys on the token the server selects and refuse if they are on another token. After the operation, they check the URIs returned by the server and report objects that don't match the request. list-keys shares the helpers. Cases that can't be detected without server changes are covered by skipped tests tagged `known-issue:p11-server-uri-override` in the new hsm_config_uri_scope suite, which also takes over the list-keys test from the create_key_hsm suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
Bravo555
force-pushed
the
feat/pkcs11-uri-warn
branch
from
October 28, 2026 09:18
7ee81f9 to
902a178
Compare
Bravo555
requested a deployment
to
Test Pull Request
October 28, 2026 09:18 — with
GitHub Actions
Waiting
device.cryptoki.uri overrides in tedge hsm commands
This branch is waiting to be deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed changes
tedge-p11-server uses its
device.cryptoki.urias a base for every request URI, and when both set the same attribute (token,serial,object,id), the server's value wins. Atedge hsmcommand can therefore be served from another token or key than the user requested, without any message. For example, withdevice.cryptoki.uri=pkcs11:token=tedge1,tedge hsm list-keys pkcs11:token=tedge2returned the keys oftedge1.This PR detects these cases on the client side, so it also works with older tedge-p11-server versions:
device.cryptoki.uri.--force), the command lists the keys on the token the server selects for the request and refuses if they are on another token. After deleting, it fails with a non-zero exit code if the server deleted objects that don't match the requested URI.device.key_uri. When the server can't list keys (all released versions), the check is skipped, socreate-keyandtedge cert downloadkeep working with older servers.device.cryptoki.uri, so they are unchanged.This also fixes
Pkcs11Uri::matches, which never matched a filter with aslot-idattribute because URIs exported by tedge-p11-server don't include one.Known limitations (tracked by skipped tests)
Some cases can't be detected on the client side without changes to tedge-p11-server. The new
hsm_config_uri_scopeRobot suite has a test asserting the correct behavior for each of them, taggedrobot:skipandknown-issue:p11-server-uri-override:pkcs11:slot-id=Nlists the keys of the first tokenCryptoki::open_sessionignoresslot-idobject=/id=indevice.cryptoki.urimakes the server delete the configured key instead of the requested one; the client only reports it afterwardsCryptoki::request_urilets the config overrideobject/id, andCryptoki::list_keysignores themdevice.cryptoki.uriselects a token without keys, the key is created there before the mismatch is detectedCryptoki::request_urioverridestoken; an empty token can't be identified from the clientobject=indevice.cryptoki.urimakes the existing key check "reuse" the configured key, so no key is created anddevice.key_uriis set to a URI naming a key that doesn't existCryptoki::request_urioverridesobjectdevice.cryptoki.uriselects a token without keys, the PIN is changed before the mismatch is detected--resetCryptoki::request_urioverridestokenThe proper fix is for tedge-p11-server to reject requests that conflict with
device.cryptoki.uri.Types of changes
Paste Link to the issue
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments
The
list-keystest that checked filtering bydevice.cryptoki.urimoved from thecreate_key_hsmsuite to the newhsm_config_uri_scopesuite, which covers everytedge hsmcommand. That suite has noinitial.robotvariant, as released tedge-p11-server versions can't list keys, delete keys or change PINs.🤖 Generated with Claude Code