Skip to content

dev.Dockerfile: add BUILD_TAGS build argument#1244

Open
ZZiigguurraatt wants to merge 1 commit into
lightninglabs:masterfrom
ZZiigguurraatt:dev_Dockerfile_build_tags
Open

dev.Dockerfile: add BUILD_TAGS build argument#1244
ZZiigguurraatt wants to merge 1 commit into
lightninglabs:masterfrom
ZZiigguurraatt:dev_Dockerfile_build_tags

Conversation

@ZZiigguurraatt

Copy link
Copy Markdown
Contributor
  • dev.Dockerfile now has a BUILD_TAGS build argument that allows the tags passed to make to be customized. If defined, the defaults are completely overriden (not added to). If not defined, the default values are used.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the dev.Dockerfile by introducing a new build argument, BUILD_TAGS. This allows developers to precisely control the tags passed to make commands during the Docker image build process, providing greater flexibility for custom build configurations without altering the Dockerfile directly.

Highlights

  • dev.Dockerfile Enhancement: Introduced a BUILD_TAGS build argument in dev.Dockerfile to allow customization of make tags, overriding defaults if set, or using defaults otherwise.
  • Build Process Flexibility: Modified make commands within the Dockerfile to incorporate the new BUILD_TAGS argument, enabling dynamic control over Go build tags during the Docker image creation.
  • Release Notes Update: Added a new entry to the 0.16.2 release notes documenting the BUILD_TAGS argument and its functionality.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • dev.Dockerfile
    • Added a new ARG BUILD_TAGS="" to allow custom build tags.
    • Modified make commands to utilize the BUILD_TAGS argument when installing lightning-terminal and lightning-terminal-cli.
  • docs/release-notes/release-notes-0.16.2.md
    • Added a new release note entry detailing the BUILD_TAGS argument in dev.Dockerfile under "Functional Changes/Additions".
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

- `dev.Dockerfile` now has  a `BUILD_TAGS` build argument
   that allows the `tags` passed to `make` to be customized.
   If defined, the defaults are completely overriden (not
   added to). If not defined, the default values are used.
@ZZiigguurraatt
ZZiigguurraatt force-pushed the dev_Dockerfile_build_tags branch from 5e0e23a to cbedfd8 Compare March 4, 2026 17:37
@ZZiigguurraatt

Copy link
Copy Markdown
Contributor Author

force pushed with the actual PR number linked in the release notes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a BUILD_TAGS argument to dev.Dockerfile for customizing build tags during go install commands. However, the current implementation is vulnerable to command injection as BUILD_TAGS is directly interpolated into shell commands within RUN instructions, posing a risk of arbitrary command execution. Furthermore, the Makefile does not correctly consume this tags variable for go install -tags or build.RawTags in LDFLAGS, leading to a functional discrepancy where the BUILD_TAGS argument will not effectively override or augment build tags as intended. It is crucial to address the command injection vulnerability by sanitizing input or using a safer argument passing method, and to update the Makefile to properly utilize BUILD_TAGS.

Comment thread dev.Dockerfile
Comment on lines +127 to +131
make go-install-noui tags="$BUILD_TAGS"\
&& make go-install-cli-noui tags="$BUILD_TAGS"; \
else \
make go-install \
&& make go-install-cli; \
make go-install tags="$BUILD_TAGS" \
&& make go-install-cli tags="$BUILD_TAGS"; \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-high high

This section is vulnerable to command injection. The BUILD_TAGS argument is directly interpolated into a shell command within a RUN instruction. An attacker controlling BUILD_TAGS could inject arbitrary commands (e.g., foo" ; rm -rf / ; "bar). Additionally, the Makefile targets (go-install-noui, go-install) explicitly use $(LND_RELEASE_TAGS) instead of the tags variable passed from the Dockerfile for go install -tags and build.RawTags in LDFLAGS. This means the BUILD_TAGS value is not being used as intended to customize build tags. To fix this, sanitize the BUILD_TAGS input to prevent injection and update the Makefile targets to conditionally use the tags variable for both go install -tags and build.RawTags.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Additionally, the Makefile targets (go-install-noui, go-install) explicitly use $(LND_RELEASE_TAGS) instead of the tags variable passed from the Dockerfile for go install -tags and build.RawTags in LDFLAGS. This means the BUILD_TAGS value is not being used as intended to customize build tags.

Isn't

# Use all build tags by default but allow them to be overwritten.
ifneq ($(tags),)
LND_RELEASE_TAGS = $(tags)
endif
setting this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This section is vulnerable to command injection. The BUILD_TAGS argument is directly interpolated into a shell command within a RUN instruction. An attacker controlling BUILD_TAGS could inject arbitrary commands (e.g., foo" ; rm -rf / ; "bar).

Are we worried about this on dev builds where we control the machine being built on?

@ZZiigguurraatt

Copy link
Copy Markdown
Contributor Author

@ZZiigguurraatt, remember to re-request review from reviewers when ready

There are no reviewers that have been assigned that I can re-request review from.

@lightninglabs-deploy

Copy link
Copy Markdown

@ZZiigguurraatt, remember to re-request review from reviewers when ready

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.

2 participants