Skip to content

Conversation

bo156
Copy link
Contributor

@bo156 bo156 commented Aug 11, 2025

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

Description

Handled git external module loading with sub-directory but without protocol, specifically when using git::git rather than git::https://... (or any other protocol instead of https).
This makes sure we correctly parse the sub-directory inside the source url.

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

@bo156 bo156 temporarily deployed to scan-security August 11, 2025 14:55 — with GitHub Actions Inactive
headers: dict[str, Any],
payload: dict[str, Any] | None = None,
) -> ClientResponse:
from checkov.common.util import env_vars_config
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this import moved due to an import loop of env_var_config and http_utils

Copy link
Contributor

@lirshindalman lirshindalman left a comment

Choose a reason for hiding this comment

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

nice!

Copy link
Contributor

@talazuri talazuri left a comment

Choose a reason for hiding this comment

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

LGTM

if len(module_source_components) < 3:
root_module = module_source_components[-1]
inner_module = ""
if len(module_source_components) == 2 and "git::git" in module_source_components[0]:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be helpful if we had a comment here (and in other places in this method) which would explain which use case it solves.

i.e. in this case if I got it right it would be

// git::git@github.com:test-inner-module/out-module//inner-module?ref=main

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added :)

@bo156 bo156 temporarily deployed to scan-security August 12, 2025 07:14 — with GitHub Actions Inactive
@bo156 bo156 merged commit 949acce into main Aug 12, 2025
46 checks passed
@bo156 bo156 deleted the bugfix/support-git-loader-no-protocol-inner-module branch August 12, 2025 07:22
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.

4 participants