Skip to content

fix(scripts/cert): harden csr_generator.sh and install_cert.sh - #30

Merged
DerekRoberts merged 1 commit into
mainfrom
fix/cert-scripts-hardening
Sep 14, 2026
Merged

DerekRoberts merged 1 commit into
mainfrom
fix/cert-scripts-hardening

Conversation

@DerekRoberts

Copy link
Copy Markdown
Member

Description

Harden certificate helper scripts in scripts/cert/:

  1. csr_generator.sh:

    • Prevent silent overwrite of ${DOMAIN}.key or ${DOMAIN}.csr: if either file already exists, abort with exit code 1 and error on stderr unless forced with -f/--force, or interactively confirmed, or using an existing key.
    • Fix invalid argument handling: if more than two positional arguments are passed, output error to stderr and exit 1 instead of exiting 0 via display_help.
    • Add -f, --force flag to options and help output.
  2. install_cert.sh:

    • Fix shebang: update to #!/bin/bash and set -euo pipefail.
    • Support route updates/renewals: change oc create route edge to generate client-side manifest with --dry-run=client -o yaml | oc apply -f - to prevent AlreadyExists failure.
    • Fix subdirectory route path: ensure SUBDIR has a leading / prefix before passing to --path.

Closes #25

Prevent silent overwrite of key and CSR files, fix invalid argument exit code to 1 on stderr, update install_cert.sh shebang to bash with pipefail, support route updates via oc apply, and ensure leading slash on route subdir path.

Closes #25
Copilot AI balanced review requested due to automatic review settings September 14, 2026 04:34

Copilot AI 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.

🟢 Approval recommended

The focused changes correctly address the documented certificate safety and OpenShift route update issues.

Pull request overview

Hardens certificate generation and installation scripts against accidental overwrites and route renewal failures.

Changes:

  • Adds explicit overwrite controls and correct argument-error handling.
  • Makes certificate installation Bash-safe and route updates idempotent.
  • Normalizes OpenShift route paths.
File summaries
File Description
scripts/cert/csr_generator.sh Adds force/confirmation safeguards and proper error exits.
scripts/cert/install_cert.sh Fixes shell configuration, route updates, and path formatting.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@DerekRoberts DerekRoberts self-assigned this Sep 14, 2026
@DerekRoberts
DerekRoberts merged commit d2861a7 into main Sep 14, 2026
4 checks passed
@DerekRoberts
DerekRoberts deleted the fix/cert-scripts-hardening branch September 14, 2026 04:42
@github-project-automation github-project-automation Bot moved this from New to Done in DevOps (NR) Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

fix(scripts/cert): harden csr_generator.sh and install_cert.sh

2 participants