Skip to content

Conversation

bo156
Copy link
Contributor

@bo156 bo156 commented Oct 5, 2025

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

Fixes a bug in which empty lists in after_unknown section were inserted a new value, now the value stays an empty list.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes

resource_conf[k][0][inner_key] = _clean_simple_type_list([TRUE_AFTER_UNKNOWN])
elif isinstance(resource_conf[k][0], list) and isinstance(resource_conf[k][0][0], dict):
resource_conf[k][0][0][inner_key] = _clean_simple_type_list([TRUE_AFTER_UNKNOWN])
if _validate_after_unknown_list_not_empty(inner_key, k, resource_conf):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we really invoke the same condition in both cases?
I would expect the second condition to be invoked with k[0], since the second one is operating at a deeper level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, fixing

}
]}
key: str = 'network_configuration'
value: list = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have more than one item in this list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the function to handle case where there are more than 1 by going in for loop

@bo156 bo156 temporarily deployed to scan-security October 8, 2025 08:58 — with GitHub Actions Inactive
@bo156 bo156 merged commit afb10f1 into main Oct 8, 2025
46 checks passed
@bo156 bo156 deleted the bugfix/after-unknown-empty-list branch October 8, 2025 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants