(self, context, info, key_size=None)
| 79 | yield self._gen_hit(context, info, key_size) |
| 80 | |
| 81 | def _gen_hit(self, context, info, key_size=None): |
| 82 | hit = Detection( |
| 83 | detection_type="CryptoKeyGeneration", |
| 84 | message="Generation of cryptography key detected", |
| 85 | signature=f"crypto#gen_key#{context.signature}", |
| 86 | extra={ |
| 87 | "function": context.node.cached_full_name, |
| 88 | "key_type": info["type"], |
| 89 | "key_size": key_size, |
| 90 | }, |
| 91 | node=context.node, |
| 92 | ) |
| 93 | |
| 94 | if key_size is not None and key_size < MIN_KEY_SIZES.get(info["type"], 0): |
| 95 | hit.score = 100 |
| 96 | |
| 97 | return hit |
no test coverage detected