Skip to content

Commit 96a6dc9

Browse files
committed
typing and bandit ignores
Signed-off-by: Paul Horton <[email protected]>
1 parent 1e71dc3 commit 96a6dc9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

cyclonedx/model/crypto.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ def __init__(self, *, primitive: Optional[CryptoPrimitive] = None,
290290
self.curve = curve
291291
self.execution_environment = execution_environment
292292
self.implementation_platform = implementation_platform
293-
self.certification_levels = certification_levels
293+
self.certification_levels = certification_levels or [] # type:ignore[assignment]
294294
self.mode = mode
295295
self.padding = padding
296-
self.crypto_functions = crypto_functions
296+
self.crypto_functions = crypto_functions or [] # type:ignore[assignment]
297297
self.classical_security_level = classical_security_level
298298
self.nist_quantum_security_level = nist_quantum_security_level
299299

@@ -686,16 +686,16 @@ class RelatedCryptoMaterialType(str, Enum):
686686
INITIALIZATION_VECTOR = 'initialization-vector'
687687
KEY = 'key'
688688
NONCE = 'nonce'
689-
PASSWORD = 'password'
689+
PASSWORD = 'password' # nosec
690690
PRIVATE_KEY = 'private-key'
691691
PUBLIC_KEY = 'public-key'
692692
SALT = 'salt'
693-
SECRET_KEY = 'secret-key'
693+
SECRET_KEY = 'secret-key' # nosec
694694
SEED = 'seed'
695-
SHARED_SECRET = 'shared-secret'
695+
SHARED_SECRET = 'shared-secret' # nosec
696696
SIGNATURE = 'signature'
697697
TAG = 'tag'
698-
TOKEN = 'token'
698+
TOKEN = 'token' # nosec
699699

700700
OTHER = 'other'
701701
UNKNOWN = 'unknown'
@@ -968,7 +968,7 @@ def size(self) -> Optional[int]:
968968

969969
@size.setter
970970
def size(self, size: Optional[int]) -> None:
971-
if size < 0:
971+
if size and size < 0:
972972
raise InvalidRelatedCryptoMaterialSizeException('Size must be greater than zero')
973973
self._size = size
974974

@@ -1272,7 +1272,7 @@ def __init__(self, *, type: Optional[ProtocolPropertiesType] = None, version: Op
12721272
ikev2_transform_types: Optional[Ikev2TransformTypes] = None) -> None:
12731273
self.type = type
12741274
self.version = version
1275-
self.cipher_suites = cipher_suites
1275+
self.cipher_suites = cipher_suites or [] # type:ignore[assignment]
12761276
self.ikev2_transform_types = ikev2_transform_types
12771277

12781278
@property
@@ -1375,7 +1375,7 @@ def __init__(self, *, asset_type: Optional[CryptoAssetType] = None,
13751375

13761376
@property
13771377
@serializable.xml_sequence(10)
1378-
def asset_type(self) -> CryptoAssetType:
1378+
def asset_type(self) -> Optional[CryptoAssetType]:
13791379
"""
13801380
Cryptographic assets occur in several forms. Algorithms and protocols are most commonly implemented in
13811381
specialized cryptographic libraries. They may however also be 'hardcoded' in software components. Certificates
@@ -1388,7 +1388,7 @@ def asset_type(self) -> CryptoAssetType:
13881388
return self._asset_type
13891389

13901390
@asset_type.setter
1391-
def asset_type(self, asset_type: CryptoAssetType) -> None:
1391+
def asset_type(self, asset_type: Optional[CryptoAssetType]) -> None:
13921392
self._asset_type = asset_type
13931393

13941394
@property

0 commit comments

Comments
 (0)