Add audit baseline functionality#44
Conversation
…t-baseline-functionality
|
|
||
| current_secret_index += 1 | ||
|
|
||
| break |
There was a problem hiding this comment.
I'm not sure I follow, why only do the first filename here?
There was a problem hiding this comment.
Ah, nice catch.
I throw in breaks when testing; looks like I missed a spot.
| def _secret_generator(baseline): | ||
| """Generates secrets to audit, from the baseline""" | ||
| current_secret_index = 1 | ||
| num_secrets_to_parse = sum(map( |
There was a problem hiding this comment.
Nit: Maybe add some comments and space it out so there isn't the ))). I initially misread it as map gets all the secrets that don't have an is_secret attribute (i.e. the ones that have not been audited) and adds that number to the number of results in the baseline.
num_secrets_to_parse = sum(
map(
lambda filename: len(
list(
filter(
lambda secret: not hasattr(secret, 'is_secret'),
baseline['results'][filename],
)
)
),
baseline['results'],
)
)| lineno=0, | ||
| ) | ||
|
|
||
| # There could be more than two secrets on the same line. |
| for raw_secret in plugin.secret_generator(secret_line): | ||
| yield raw_secret | ||
|
|
||
| # It hits here if the secret has been moved, from the original |
There was a problem hiding this comment.
I think it'd be more pythonic/you wouldn't need a comment (uncle bob 💯 ), if you did for .. else (i.e. if you don't take a break you get a raise.)
| ), | ||
| x[1], | ||
| ), | ||
| enumerate(output), |
There was a problem hiding this comment.
Wow, woah, this is reel nice 🍰 ⚡️ 💡
61cf2d5 to
b77ceec
Compare
resolving IBM Cloud IAM test test_verify_payload_not_json
Testing
Output
Features
--scan.skipallows you to revisit the secret at a later time.Backwards Compatibility Considerations
This is a breaking change!
plugins_usedlist with proper initialization args.SensitivityValueshas been dropped.detect-secrets-serverwill need to be pinned on an older version, until fixed.