Skip to content

Conversation

@Jdubrick
Copy link
Contributor

Description

  • Removes /dev/null as placeholder for the vertex mount as /dev/null is a special file and can produce errors when being mounted. Also conflicts with :Z flag
  • Adds dummy placeholder.json that can fill the role.

Which issue(s) does this PR fix or relate to

PR acceptance criteria

  • Tests updated and passing
  • Documentation updated
  • Built-in TechDocs updated if needed. Note that TechDocs changes may need to be reviewed by a Product Manager and/or Architect to ensure content accuracy, clarity, and alignment with user needs.

How to test changes / Special notes to the reviewer

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
@rhdh-qodo-merge
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

RHIDP-11250 - Partially compliant

Compliant requirements:

  • Stop using /dev/null as the default bind mount source for Vertex AI credentials with :Z
  • Remove the /dev/null reference

Non-compliant requirements:

(empty)

Requires further human verification:

  • Validate in newer Podman versions that the updated default mount (placeholder file) works and no longer errors with SELinux labeling (:Z)
  • Validate runtime behavior when ENABLE_VERTEX_AI=false (service should not fail due to placeholder credentials content)
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🔒 Security concerns

Potential sensitive information exposure:
the default now mounts a repo file as /app-root/credentials.json. Ensure placeholder.json contains no secrets and is clearly a non-secret dummy file; also confirm docs/examples don’t encourage committing real credential JSON into the repo path referenced by default.

⚡ Recommended focus areas for review

Runtime Behavior

GOOGLE_APPLICATION_CREDENTIALS is always set to /app-root/credentials.json. With the new default bind mount pointing to a placeholder file, ensure the containerized app does not attempt to parse/load credentials unless Vertex AI is enabled; otherwise startup may fail due to invalid/empty credentials JSON.

  # Vertex AI credentials (only used if ENABLE_VERTEX_AI=true)
  # Set VERTEX_AI_CREDENTIALS_PATH in your .env file to your Google Cloud credentials JSON file path
  - ${VERTEX_AI_CREDENTIALS_PATH:-./developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:Z
environment:
  GOOGLE_APPLICATION_CREDENTIALS: /app-root/credentials.json
Missing File Risk

The new default path references ./developer-lightspeed/configs/extra-files/templates/placeholder.json. Ensure this file is present in the repo and included in distributions; otherwise docker/podman compose will fail with a missing bind mount source.

# Set VERTEX_AI_CREDENTIALS_PATH in your .env file to your Google Cloud credentials JSON file path
- ${VERTEX_AI_CREDENTIALS_PATH:-./developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:Z
📚 Focus areas based on broader codebase context

Security

The credentials JSON bind mount is not marked read-only, which makes it writable inside the container. Consider mounting the credentials file as read-only (e.g., :ro alongside :Z) to reduce risk of accidental modification or tampering of sensitive auth material. (Ref 1)

  # Vertex AI credentials (only used if ENABLE_VERTEX_AI=true)
  # Set VERTEX_AI_CREDENTIALS_PATH in your .env file to your Google Cloud credentials JSON file path
  - ${VERTEX_AI_CREDENTIALS_PATH:-./developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:Z
environment:
  GOOGLE_APPLICATION_CREDENTIALS: /app-root/credentials.json

Reference reasoning: Existing Kubernetes deployment patterns mount container registry auth/credential-related files with readOnly: true, indicating the repo’s established approach is to treat credential mounts as immutable within the runtime container.

📄 References
  1. redhat-developer/rhdh-operator/config/profile/rhdh/default-config/deployment.yaml [72-82]
  2. redhat-developer/rhdh-operator/config/crd/bases/rhdh.redhat.com_backstages.yaml [715-718]
  3. redhat-developer/rhdh-operator/bundle/rhdh/manifests/rhdh.redhat.com_backstages.yaml [1009-1012]
  4. redhat-developer/rhdh-operator/dist/rhdh/install.yaml [1168-1171]
  5. redhat-developer/rhdh-operator/bundle/backstage.io/manifests/rhdh.redhat.com_backstages.yaml [1224-1227]

@rhdh-qodo-merge
Copy link
Contributor

PR Type

Bug fix


Description

  • Replace /dev/null placeholder with placeholder.json file for vertex mount

  • Fixes mounting errors caused by special file handling with :Z flag

  • Updates both compose configuration files with new placeholder path


File Walkthrough

Relevant files
Bug fix
compose-with-validation.yaml
Update vertex credentials default path                                     

developer-lightspeed/compose-with-validation.yaml

  • Changed default vertex credentials path from /dev/null to
    ./developer-lightspeed/configs/extra-files/templates/placeholder.json
  • Resolves special file mounting issues with the :Z SELinux flag
+1/-1     
compose.yaml
Update vertex credentials default path                                     

developer-lightspeed/compose.yaml

  • Changed default vertex credentials path from /dev/null to
    ./developer-lightspeed/configs/extra-files/templates/placeholder.json
  • Resolves special file mounting issues with the :Z SELinux flag
+1/-1     

@rhdh-qodo-merge
Copy link
Contributor

rhdh-qodo-merge bot commented Jan 15, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Use a valid empty JSON object

To prevent JSON parsing errors, ensure the placeholder.json file contains a
valid empty JSON object ({}).

developer-lightspeed/compose.yaml [51-52]

 # Set VERTEX_AI_CREDENTIALS_PATH in your .env file to your Google Cloud credentials JSON file path
+# Ensure developer-lightspeed/configs/extra-files/templates/placeholder.json contains "{}"
 - ${VERTEX_AI_CREDENTIALS_PATH:-./developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:Z
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a potential runtime error if the placeholder file is empty and provides a simple, effective fix to improve application robustness and error handling.

Medium
General
Use absolute placeholder path

Use an absolute path for the placeholder file by prefixing the path with ${PWD}
to avoid issues when running docker-compose from different directories.

developer-lightspeed/compose-with-validation.yaml [8]

-- ${VERTEX_AI_CREDENTIALS_PATH:-./developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:Z
+- ${VERTEX_AI_CREDENTIALS_PATH:-${PWD}/developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:Z
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly points out that using a relative path in a Docker Compose volume can be brittle and proposes using ${PWD} to create a more robust absolute path.

Low
Security
Mount credentials file read-only

Add the ro (read-only) flag to the volume mount for the credentials.json file to
prevent the container from modifying it.

developer-lightspeed/compose.yaml [52]

-- ${VERTEX_AI_CREDENTIALS_PATH:-./developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:Z
+- ${VERTEX_AI_CREDENTIALS_PATH:-./developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:ro,Z

[Suggestion processed]

Suggestion importance[1-10]: 8

__

Why: This is a valuable security enhancement that follows the principle of least privilege by preventing the container from writing to the host's credentials file.

Medium
  • Update

# Vertex AI credentials (only used if ENABLE_VERTEX_AI=true)
# Set VERTEX_AI_CREDENTIALS_PATH in your .env file to your Google Cloud credentials JSON file path
- ${VERTEX_AI_CREDENTIALS_PATH:-/dev/null}:/app-root/credentials.json:Z
- ${VERTEX_AI_CREDENTIALS_PATH:-./developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:Z
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Mount credentials file read-only

Suggested change
- ${VERTEX_AI_CREDENTIALS_PATH:-./developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:Z
- ${VERTEX_AI_CREDENTIALS_PATH:-./developer-lightspeed/configs/extra-files/templates/placeholder.json}:/app-root/credentials.json:ro,Z

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
Copy link
Member

@rm3l rm3l left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Jan 17, 2026
@rm3l rm3l merged commit 2697e43 into redhat-developer:main Jan 17, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants