Skip to content

Fix nexus-ui runAsNonRoot crash; prompt for the Istio hostname on install - #89

Merged
ckm007 merged 2 commits into
developfrom
fix-nexus-ui-runasuser-and-hostname-prompt
Aug 10, 2026
Merged

Fix nexus-ui runAsNonRoot crash; prompt for the Istio hostname on install#89
ckm007 merged 2 commits into
developfrom
fix-nexus-ui-runasuser-and-hostname-prompt

Conversation

@ckm007

@ckm007 ckm007 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

  • containerSecurityContext.runAsUser: 101nginx:1.27-alpine's Dockerfile USER directive is nginx (a name, not a numeric UID). Kubelet can't statically verify that satisfies runAsNonRoot without an explicit runAsUser, and refuses to start the container: container has runAsNonRoot and image has non-numeric user (nginx), cannot verify user is non-root. Confirmed the actual UID by running id nginx inside the real image on the cluster: uid=101(nginx) gid=101(nginx) — matches podSecurityContext.fsGroup: 101, which was clearly set with this same value in mind but never paired with the matching runAsUser.
  • Interactive hostname prompt in nexus-ui/install.sh, matching nexus-server's password-prompt pattern: routing is always Istio-based here (routing.mode: istio), so it always sets --set routing.istio.hosts[0]=<hostname>. Checks the currently deployed VirtualService's host first (--ignore-not-found, fail-closed on real kubectl errors — same pattern as nexus-server's postgres-data PVC check) and requires an explicit YES confirmation if the entered hostname would actually change it, since that has real DNS/TLS implications.
  • Also updates NS to nexus to match the actual target namespace (was mosip-nexus).

Verification

  • helm lint — clean
  • helm template --set routing.istio.hosts[0]=... — correctly overrides both the Gateway and VirtualService
  • Rendered containerSecurityContext includes runAsUser: 101 alongside runAsNonRoot: true
  • bash -n — clean
  • Applied directly against the live cluster (helm upgrade with both --set overrides) — release now shows STATUS: deployed

https://claude.ai/code/session_01A5KE4fZxHqbeiDaUJenSfU

Summary by CodeRabbit

  • New Features

    • Added interactive hostname selection during installation, including confirmation when changing an existing hostname.
    • Installation now uses the nexus namespace and applies the selected hostname to UI routing.
  • Bug Fixes

    • Installation safely stops when cluster information cannot be retrieved or when run noninteractively.
    • Updated UI container security settings to run with the correct non-root user.

…tall

nginx:1.27-alpine's Dockerfile USER directive is "nginx" (a name, not a
numeric UID) — kubelet can't statically verify that satisfies
runAsNonRoot without an explicit runAsUser, and refuses to start the
container: "container has runAsNonRoot and image has non-numeric user
(nginx), cannot verify user is non-root". Confirmed the actual UID by
running `id nginx` inside the real image on the cluster: uid=101(nginx)
gid=101(nginx) — matches containerSecurityContext's existing
podSecurityContext.fsGroup: 101, which was clearly set with this same
value in mind but never paired with the matching runAsUser.

Also adds an interactive hostname prompt to nexus-ui/install.sh, matching
nexus-server's password-prompt pattern: routing is always Istio-based
(routing.mode: istio) here, so it always sets
--set routing.istio.hosts[0]=<hostname>. Checks the currently deployed
VirtualService's host first (--ignore-not-found, fail-closed on real
kubectl errors, same pattern as nexus-server's postgres-data PVC check)
and requires an explicit "YES" confirmation if the entered hostname
would actually change it — hostname changes have real DNS/TLS
implications, so this guards against fat-fingering a typo into a
routine redeploy. Also updates NS to "nexus" to match the actual target
namespace.

Verified: helm lint clean; `helm template --set
routing.istio.hosts[0]=...` correctly overrides both the Gateway and
VirtualService; rendered containerSecurityContext includes runAsUser:
101 alongside runAsNonRoot: true; bash -n clean; applied directly
against the live cluster (helm upgrade with both --set overrides) —
release now shows STATUS: deployed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5KE4fZxHqbeiDaUJenSfU
Signed-off-by: ckm007 <chandrakeshavmishra@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ckm007, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ed26f2b0-6693-4f60-a434-cb13c207a41a

📥 Commits

Reviewing files that changed from the base of the PR and between 58fe6c3 and ccde736.

📒 Files selected for processing (1)
  • MosipNexus/deploy/nexus-ui/install.sh

Walkthrough

The Nexus UI installer now uses the nexus namespace, validates and confirms the Istio hostname before installation, and passes it to Helm. The UI container explicitly runs as UID 101.

Changes

Nexus UI installation

Layer / File(s) Summary
Hostname selection and Helm routing
MosipNexus/deploy/nexus-ui/install.sh
The installer queries the existing hostname, requires confirmation for changes, and passes the selected hostname to routing.istio.hosts[0] during Helm installation.
Explicit nginx container identity
MosipNexus/helm/nexus-ui/values.yaml
The UI container security context sets runAsUser: 101 while retaining non-root restrictions.

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

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant Installer
  participant Istio
  participant Helm

  Operator->>Installer: Start Nexus UI installation
  Installer->>Istio: Query existing nexus-ui hostname
  Istio-->>Installer: Return hostname
  Installer-->>Operator: Request hostname and confirmation
  Operator->>Installer: Confirm hostname
  Installer->>Helm: Install with routing.istio.hosts[0]
  Helm-->>Operator: Complete installation
Loading

Poem

A hostname waits at the gate,
Confirmed before Helm can create.
Istio knows the chosen way,
UID 101 keeps risk at bay.
Nexus UI starts clean and straight.

🚥 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 clearly and concisely describes both primary changes: the container startup fix and the Istio hostname prompt.
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 fix-nexus-ui-runasuser-and-hostname-prompt

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.

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

Actionable comments posted: 1

🤖 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 `@MosipNexus/deploy/nexus-ui/install.sh`:
- Around line 56-59: Update the hostname prompt loop to check the return status
of read before continuing; when read fails, return a nonzero error immediately
instead of retrying with an empty hostname. Preserve the existing repetition for
successful reads that provide an empty value.
🪄 Autofix

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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4f979d16-cb74-4186-9491-fecf32e04e89

📥 Commits

Reviewing files that changed from the base of the PR and between 348148d and 58fe6c3.

📒 Files selected for processing (2)
  • MosipNexus/deploy/nexus-ui/install.sh
  • MosipNexus/helm/nexus-ui/values.yaml

Comment thread MosipNexus/deploy/nexus-ui/install.sh
CodeRabbit review on #89: read failing (EOF on stdin, interrupted) left
the loop spinning — hostname stays empty, the while condition stays
true, and a failed non-blocking read doesn't block on a closed stdin,
so it would busy-loop forever instead of erroring out. Preserves the
existing behavior for a successful read that returns an empty string
(re-prompts), only treats a genuine read failure as a hard error.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5KE4fZxHqbeiDaUJenSfU
Signed-off-by: ckm007 <chandrakeshavmishra@gmail.com>
@ckm007
ckm007 merged commit 4ea2ee7 into develop Aug 10, 2026
18 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