Skip to content

release: include portable M0 hardening - #145

Merged
gnanirahulnutakki merged 2 commits into
mainfrom
dev
Jul 14, 2026
Merged

release: include portable M0 hardening#145
gnanirahulnutakki merged 2 commits into
mainfrom
dev

Conversation

@gnanirahulnutakki

@gnanirahulnutakki gnanirahulnutakki commented Jul 14, 2026

Copy link
Copy Markdown
Member

Release scope

Promotes the current governed-read integration tip, including the release-hardening correction from #143 / #144:

  • canonical private per-UID temporary M0 scratch root with explicit non-default override controls;
  • structured OCI version-output assertion and negative coverage;
  • corrected M0 RBAC/operator documentation.

Evidence before promotion

  • Exact dev post-merge CI 29347313112 passed, including the real two-cluster fan-out.
  • Exact dev post-merge CodeQL 29347310921 passed all analyses.
  • Local M0 hub-plus-two-spoke integration, Kind integration, isolation/fuzz, and release reproducibility all passed.
  • GitHub security queues: Dependabot 0, code-scanning 0, secret-scanning 0.

dev remains the durable integration branch and must not be deleted.

Summary by CodeRabbit

  • New Features

    • Added safer per-user temporary storage for experiment scratch data, with private directory permissions and cleanup safeguards.
    • Added an explicit opt-in requirement for using non-default scratch locations.
    • Expanded documented reader access for cluster and namespaced resource inspection.
  • Bug Fixes

    • OCI job validation now requires a valid, non-empty version field.
    • Improved handling of symlinked temporary directories and scratch cleanup.
  • Documentation

    • Updated experiment, release-hardening, and session documentation to reflect current behavior and issue tracking.

Gnani Rahul and others added 2 commits July 14, 2026 10:43
Use a canonical private temporary scratch root for the direct OCM lab, retain explicit override controls, and prove the lifecycle under a symlinked TMPDIR. Strengthen the OCI Kind contract to decode its version payload and correct the associated operator evidence.

GSTACK-Checkpoint: 2026-07-14/release-hardening#1
Signed-off-by: Gnani Rahul <gnani.nutakki@gmail.com>
…rdening

fix(e2): harden portable M0 release checks
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Release hardening

Layer / File(s) Summary
Portable M0 scratch lifecycle
Makefile, hack/experiments/m0-ocm-falsification.sh, tests/scripts/m0_ocm_falsification_safety_test.sh, docs/experiments/M0-ocm-falsification.md
M0 scratch storage now uses canonical per-user temporary paths with restricted parent creation, stricter validation, cleanup handling, and symlink-aware lifecycle tests.
OCI Job version validation
tests/e2e/oci_image_kind_test.go
OCI Job output is decoded as JSON and must contain a non-empty version field, with table-driven unit coverage.
Release and experiment documentation
docs/experiments/M0-ocm-falsification.md, sessions/*
Documentation records the combined reader permissions, issue wording, release-hardening scope, findings, and validation evidence.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main portable M0 hardening work in the change set.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (2)
hack/experiments/m0-ocm-falsification.sh (2)

172-179: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

mkdir -p -m 0700 only applies mode to the deepest directory (SC2174).

Intermediate components of SCRATCH_PARENT created via -p get 0777 & ~umask rather than the explicit -m. This is currently safe only because umask 077 is set immediately beforehand, so intermediates also land at 0700 — but that's an implicit coupling, not an explicit guarantee.

🛡️ More defensive alternative
 prepare_default_scratch_parent() {
   [[ "${SCRATCH_ROOT}" == "${DEFAULT_SCRATCH_ROOT}" ]] || return 0
   [[ ! -e "${SCRATCH_PARENT}" && ! -L "${SCRATCH_PARENT}" ]] || return 0

   umask 077
-  mkdir -p -m 0700 -- "${SCRATCH_PARENT}"
+  mkdir -p -- "${SCRATCH_PARENT}"
+  chmod 0700 -- "${SCRATCH_PARENT}"
 }
🤖 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 `@hack/experiments/m0-ocm-falsification.sh` around lines 172 - 179, Update
prepare_default_scratch_parent so every directory created under SCRATCH_PARENT
is explicitly guaranteed to use mode 0700, rather than relying on mkdir -p’s
interaction with the preceding umask 077. Preserve the existing no-op conditions
and scratch-parent creation behavior while removing the implicit mode coupling.

Source: Linters/SAST tools


35-44: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Default scratch-root path is computed twice, independently, and must stay byte-for-byte identical. Makefile and the script both derive sith-m0-<uid>/lab under the canonical TMPDIR, but the script's validate_scratch_root hard-requires an exact string match against its own default unless the operator opts into SITH_M0_ALLOW_NON_EXTENDED=1. This is fragile: any drift (different python3 on PATH vs ${PYTHON_BIN}, or os.getuid() real-uid vs bash $EUID effective-uid) makes make e2e-ocm fail closed with die "scratch must use the private default...".

  • hack/experiments/m0-ocm-falsification.sh#L35-L44: add a print-default-scratch-root (or similar) subcommand/flag that outputs DEFAULT_SCRATCH_ROOT so it becomes the single source of truth.
  • Makefile#L15-L15: replace the inline python3 computation with $(shell hack/experiments/m0-ocm-falsification.sh print-default-scratch-root) (or equivalent) instead of recomputing it.
🤖 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 `@hack/experiments/m0-ocm-falsification.sh` around lines 35 - 44, Make
hack/experiments/m0-ocm-falsification.sh expose a print-default-scratch-root
subcommand or equivalent that outputs DEFAULT_SCRATCH_ROOT, preserving the
existing canonical path calculation. Update Makefile’s scratch-root definition
to invoke that script command instead of independently recomputing the path,
making the script’s value the single source of truth; apply these changes at
hack/experiments/m0-ocm-falsification.sh:35-44 and Makefile:15.
🤖 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.

Nitpick comments:
In `@hack/experiments/m0-ocm-falsification.sh`:
- Around line 172-179: Update prepare_default_scratch_parent so every directory
created under SCRATCH_PARENT is explicitly guaranteed to use mode 0700, rather
than relying on mkdir -p’s interaction with the preceding umask 077. Preserve
the existing no-op conditions and scratch-parent creation behavior while
removing the implicit mode coupling.
- Around line 35-44: Make hack/experiments/m0-ocm-falsification.sh expose a
print-default-scratch-root subcommand or equivalent that outputs
DEFAULT_SCRATCH_ROOT, preserving the existing canonical path calculation. Update
Makefile’s scratch-root definition to invoke that script command instead of
independently recomputing the path, making the script’s value the single source
of truth; apply these changes at hack/experiments/m0-ocm-falsification.sh:35-44
and Makefile:15.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fc4a1ab6-4827-4437-8f30-a78468698823

📥 Commits

Reviewing files that changed from the base of the PR and between 193af24 and aa168bf.

📒 Files selected for processing (7)
  • Makefile
  • docs/experiments/M0-ocm-falsification.md
  • hack/experiments/m0-ocm-falsification.sh
  • sessions/2026-07-13-e2-direct-konnectivity-transport.md
  • sessions/2026-07-14-release-hardening.md
  • tests/e2e/oci_image_kind_test.go
  • tests/scripts/m0_ocm_falsification_safety_test.sh

@gnanirahulnutakki

Copy link
Copy Markdown
Member Author

Reviewed the two nitpicks against the merged dev implementation.

The generated default parent is created immediately under umask 077; that process-level mode control applies to every directory created by mkdir -p, including intermediates. The proposed trailing chmod would not strengthen intermediate-directory handling.

The Makefile and script intentionally use the same canonical TMPDIR-plus-UID contract. Any future divergence is fail-closed and requires the explicit non-default override. Turning the script into a Makefile parse-time dependency would add a new bootstrap surface without reducing the current security boundary.

No release-blocking correctness, privacy, or security issue was found. The release proceeds with the green validation evidence.

@gnanirahulnutakki
gnanirahulnutakki merged commit 045778d into main Jul 14, 2026
10 checks passed
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.

1 participant