Skip to content

Commit dc18657

Browse files
Add --enable-github-action-token
1 parent fc26751 commit dc18657

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.github/workflows/generate_sbom.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ jobs:
5252
- name: Install dependencies
5353
run: uv sync --group make_release
5454
- name: generate_sbom.py
55-
run: uv run etc/sbom/generate_sbom.py --target=branch --sbom-metadata=etc/sbom/metadata.cdx.json
55+
run: uv run etc/sbom/generate_sbom.py --enable-github-action-token --target=branch --sbom-metadata=etc/sbom/metadata.cdx.json

etc/sbom/endorctl_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,14 @@ def __init__(
145145
sleep_duration=30,
146146
endorctl_path="endorctl",
147147
config_path=None,
148+
enable_github_action_token=False
148149
):
149150
self.namespace = namespace
150151
self.retry_limit = retry_limit
151152
self.sleep_duration = sleep_duration
152153
self.endorctl_path = endorctl_path
153154
self.config_path = config_path
155+
self.enable_github_action_token = enable_github_action_token
154156

155157
def _call_endorctl(self, command, subcommand, **kwargs):
156158
"""https://docs.endorlabs.com/endorctl/"""
@@ -159,6 +161,8 @@ def _call_endorctl(self, command, subcommand, **kwargs):
159161
command = [self.endorctl_path, command, subcommand, f"--namespace={self.namespace}"]
160162
if self.config_path:
161163
command.append(f"--config-path={self.config_path}")
164+
if self.enable_github_action_token:
165+
command.append(f"--enable-github-action-token")
162166

163167
# parse args into flags
164168
for key, value in kwargs.items():

etc/sbom/generate_sbom.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ def main() -> None:
400400
default=None,
401401
type=str,
402402
)
403+
endor.add_argument("--enable-github-action-token", help="Enable keyless authentication using Github action OIDC tokens", action="store_true")
403404
endor.add_argument(
404405
"--namespace", help="Endor Labs namespace (Default: mongodb.{git org})", type=str
405406
)
@@ -479,6 +480,7 @@ def main() -> None:
479480
# endor
480481
endorctl_path = args.endorctl_path
481482
config_path = args.config_path
483+
enable_github_action_token = args.enable_github_action_token
482484
namespace = args.namespace if args.namespace else f"mongodb.{git_info.org}"
483485
target = args.target
484486

@@ -529,7 +531,7 @@ def main() -> None:
529531
# region export Endor Labs SBOM
530532

531533
print_banner(f"Exporting Endor Labs SBOM for {target} {getattr(git_info, target)}")
532-
endorctl = EndorCtl(namespace, retry_limit, sleep_duration, endorctl_path, config_path)
534+
endorctl = EndorCtl(namespace, retry_limit, sleep_duration, endorctl_path, config_path, enable_github_action_token=enable_github_action_token)
533535
if target == "commit":
534536
endor_bom = endorctl.get_sbom_for_commit(git_info.project, git_info.commit)
535537
elif target == "branch":

0 commit comments

Comments
 (0)