Skip to content

Commit f1b57d2

Browse files
committed
Fix a bug with how the server retrieves attributes under KMIP 2.0
This change fixes a bug in the server attribute handling logic that manifests when attributes are deprecated and removed in KMIP 2.0. Now these attributes are effectively ignored for KMIP 2.0 messages, complying with the KMIP 2.0 specification.
1 parent 4ebaa6f commit f1b57d2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

kmip/services/server/engine.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,14 @@ def _get_attributes_from_managed_object(self, managed_object, attr_names):
593593
for attribute_name in attr_names:
594594
object_type = managed_object._object_type
595595

596+
# TODO (ph) Create the policy once and just pass these calls the
597+
# KMIP version for the current request.
596598
if not self._attribute_policy.is_attribute_supported(
597599
attribute_name
598600
):
599601
continue
602+
if self._attribute_policy.is_attribute_deprecated(attribute_name):
603+
continue
600604

601605
if self._attribute_policy.is_attribute_applicable_to_object_type(
602606
attribute_name,

kmip/services/server/policy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,8 @@ def __init__(self, version):
521521
enums.ObjectType.SECRET_DATA,
522522
enums.ObjectType.OPAQUE_DATA
523523
),
524-
contents.ProtocolVersion(1, 0)
524+
contents.ProtocolVersion(1, 0),
525+
contents.ProtocolVersion(2, 0)
525526
),
526527
'Cryptographic Usage Mask': AttributeRuleSet(
527528
True,

0 commit comments

Comments
 (0)