Skip to content

Modernize Docker-Prep for VM-Setup pinned launches - #6

Closed
Narehood wants to merge 1 commit into
mainfrom
cursor/docker-prep-modernization-7bdf
Closed

Modernize Docker-Prep for VM-Setup pinned launches#6
Narehood wants to merge 1 commit into
mainfrom
cursor/docker-prep-modernization-7bdf

Conversation

@Narehood

@Narehood Narehood commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Honor DOCKER_PREP_EPHEMERAL / DOCKER_PREP_REVISION so VM-Setup temp checkouts disable self-update and show the pinned revision
  • Verify Scripts/*.sh against Scripts/.checksums.sha256 before execution, with tools/generate-checksums.sh for regeneration
  • Add shell-security CI (tests/security-checks.sh + ShellCheck) and a tag-driven Release workflow that can notify VM-Setup via repository_dispatch
  • Pin Portainer to portainer/portainer-ce:lts, keep download-to-file Docker install, and document the consumer/release contract in the README
  • Bump version to 2.4.0 for the modernization release line

Alignment with VM-Setup

Matches the consumer contract from VM-Setup PR #48 (cursor/harden-bash-app-b08a): pinned revision launch, ephemeral env vars, and GitHub Releases for pin sync.

Validation

  • bash tests/security-checks.sh
  • shellcheck --severity=error install.sh Scripts/*.sh tests/*.sh tools/*.sh
Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features

    • Added support for pinned, ephemeral launches with revision details and disabled self-updates.
    • Added script integrity verification before execution.
    • Portainer deployments now use the pinned LTS image.
    • Added automated release creation and VM-Setup synchronization.
  • Bug Fixes

    • Improved Docker and Portainer installation reliability and validation.
    • Blocked unsafe script execution patterns and untrusted script changes.
  • Documentation

    • Expanded setup, integration, release, checksum, and validation guidance.
  • Tests

    • Added automated shell syntax, checksum, security, and ShellCheck validation.

Align with VM-Setup hardening: honor ephemeral env vars, verify Scripts
checksums, add shell-security CI, pin Portainer to lts, and publish
releases so VM-Setup can sync pins.

Co-authored-by: Michael <Narehood@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b967d288-818e-4187-916e-bbecaffd06fe

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds ephemeral pinned-launch support, checksum verification, stricter shell validation, pinned Portainer deployment, tagged-release automation, VM-Setup synchronization, and documentation for the new workflows.

Changes

Docker-Prep security and release integration

Layer / File(s) Summary
Ephemeral launches and verified script execution
install.sh
Adds version 2.4.0, pinned ephemeral-launch handling, revision display, checksum-gated script execution, safer Docker installer handling, and updated menu behavior.
Pinned Portainer deployment
Scripts/*.sh, Scripts/.checksums.sha256
Pins Portainer to the lts image, validates and rewrites compose files, updates server setup, and applies stricter shell handling.
Integrity generation and validation
tests/security-checks.sh, tools/generate-checksums.sh, .github/workflows/shell-security.yml
Adds checksum generation, syntax and policy checks, and ShellCheck validation in CI.
Release automation and integration documentation
.github/workflows/release.yml, README.md, .gitignore
Adds tag-validated GitHub Releases, optional VM-Setup dispatch notifications, and documentation for pinned launches and integrity tooling.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHub
  participant ReleaseWorkflow
  participant VMSetup
  GitHub->>ReleaseWorkflow: Push v* tag
  ReleaseWorkflow->>ReleaseWorkflow: Validate tag against install.sh VERSION
  ReleaseWorkflow->>GitHub: Create GitHub Release
  ReleaseWorkflow->>VMSetup: Dispatch docker-prep-release with tag
Loading

Possibly related PRs

  • Narehood/Docker-Prep#4: Both changes update the Portainer installer’s compose validation and image-tag handling.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.06% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: modernizing Docker-Prep for VM-Setup pinned launches.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/docker-prep-modernization-7bdf

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Narehood
Narehood marked this pull request as ready for review July 18, 2026 05:21
@cursor

cursor Bot commented Jul 18, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@Narehood

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
tests/security-checks.sh (1)

16-19: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Require manifest coverage for every script.

sha256sum --check only validates listed entries. Compare manifest filenames against Scripts/*.sh so a newly added but unlisted menu script cannot pass CI and then fail integrity verification at runtime.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/security-checks.sh` around lines 16 - 19, Update the checksum
validation block in tests/security-checks.sh to compare filenames in
.checksums.sha256 against all Scripts/*.sh files, and fail when any script is
missing from the manifest. Preserve the existing sha256sum --check --strict
validation for listed entries.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/shell-security.yml:
- Around line 14-16: Update the actions/checkout step in the shell-security
workflow to pin it to the specified full commit SHA
34e114876b0b11c390a56381ad16ebd13914f8d5 instead of the mutable v4 tag, while
preserving persist-credentials: false.

In `@Scripts/portainer-install.sh`:
- Around line 262-266: Update the installation flow around pin_portainer_image
to download and validate the compose content in a temporary file first, then
atomically replace portainer-compose.yaml only after validation succeeds. On any
download or validation failure, remove only the temporary file and preserve the
existing live compose file.

---

Nitpick comments:
In `@tests/security-checks.sh`:
- Around line 16-19: Update the checksum validation block in
tests/security-checks.sh to compare filenames in .checksums.sha256 against all
Scripts/*.sh files, and fail when any script is missing from the manifest.
Preserve the existing sha256sum --check --strict validation for listed entries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 34545e07-1d83-41c5-a03a-bd6b3a3aaead

📥 Commits

Reviewing files that changed from the base of the PR and between d50a3bd and 9d2650c.

📒 Files selected for processing (12)
  • .github/workflows/release.yml
  • .github/workflows/shell-security.yml
  • .gitignore
  • README.md
  • Scripts/.checksums.sha256
  • Scripts/DockerGroup.sh
  • Scripts/UserCreation.sh
  • Scripts/portainer-install.sh
  • Scripts/serverSetup.sh
  • install.sh
  • tests/security-checks.sh
  • tools/generate-checksums.sh

Comment on lines +14 to +16
- uses: actions/checkout@v4
with:
persist-credentials: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
gh api repos/actions/checkout/commits/v4 --jq '.sha'

Repository: Narehood/Docker-Prep

Length of output: 199


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sha="$(gh api repos/actions/checkout/commits/v4 --jq '.sha')"
echo "resolved_v4_sha=$sha"

echo "commit_lookup:"
gh api "repos/actions/checkout/commits/$sha" --jq '.sha'

Repository: Narehood/Docker-Prep

Length of output: 271


Pin actions/checkout to a full commit SHA. v4 is mutable and can move without a repository change, which weakens supply-chain reproducibility in this security-sensitive workflow. Pin it to 34e114876b0b11c390a56381ad16ebd13914f8d5 instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/shell-security.yml around lines 14 - 16, Update the
actions/checkout step in the shell-security workflow to pin it to the specified
full commit SHA 34e114876b0b11c390a56381ad16ebd13914f8d5 instead of the mutable
v4 tag, while preserving persist-credentials: false.

Comment on lines +262 to +266
if ! pin_portainer_image "$compose_file"; then
$SUDO rm -f "$compose_file"
return 1
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Preserve the existing compose file when validation fails.

The download overwrites the live compose path, then this failure path deletes it. Stage the download in a temporary file, pin and validate it, and only then atomically replace portainer-compose.yaml; otherwise a transient upstream change can remove the last known-good configuration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Scripts/portainer-install.sh` around lines 262 - 266, Update the installation
flow around pin_portainer_image to download and validate the compose content in
a temporary file first, then atomically replace portainer-compose.yaml only
after validation succeeds. On any download or validation failure, remove only
the temporary file and preserve the existing live compose file.

@cursor

cursor Bot commented Jul 18, 2026

Copy link
Copy Markdown

Superseded by #7 (cursor/security-hardening-8d8d), which already contains this modernization commit plus the follow-up security hardening. Closing in favor of the combined PR — no merge conflicts.

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