Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(admin-api): Fix missing Zendesk webhook env variable #18010

Merged
merged 3 commits into from
Feb 18, 2025

Conversation

GunnlaugurG
Copy link
Member

@GunnlaugurG GunnlaugurG commented Feb 18, 2025

What

Fix this error for missing env variable

Why

Specify why you need to achieve this

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • Chores
    • Enhanced security configuration by adding a new secret for identity confirmation.
    • Updated development and production environment settings to reference the new secret, ensuring a smoother and more reliable integration.

@GunnlaugurG GunnlaugurG requested review from a team as code owners February 18, 2025 13:36
Copy link
Contributor

coderabbitai bot commented Feb 18, 2025

Walkthrough

This pull request introduces a new secret configuration for the auth-admin-api service. It adds the ZENDESK_WEBHOOK_SECRET_IDENTITY_CONFIRMATION secret in the auth-admin-api.ts file, which points to a specified Kubernetes secret path. Additionally, it updates the environment configuration in environment.ts to use this new secret instead of the previous one for the zendeskIdentityConfirmationSecret variable in both development and production configurations.

Changes

File(s) Change Summary
apps/services/auth/admin-api/infra/auth-admin-api.ts
apps/services/auth/admin-api/src/environments/.../environment.ts
Added new Zendesk webhook secret ZENDESK_WEBHOOK_SECRET_IDENTITY_CONFIRMATION (pointing to /k8s/services-auth/ZENDESK_WEBHOOK_SECRET_IDENTITY_CONFIRMATION) and updated the zendeskIdentityConfirmationSecret in both devConfig and prodConfig to reference process.env.ZENDESK_WEBHOOK_SECRET_IDENTITY_CONFIRMATION instead of process.env.ZENDESK_IDENTITY_CONFIRMATION_SECRET.

Possibly related PRs

  • fix: chunks from gh vars #17644: The changes in this PR are directly related to the modifications made to the zendeskIdentityConfirmationSecret variable in environment.ts, as both pertain to the handling of the same webhook secret.
  • fix(zendesk-service): Add missing Zendesk config values #16783: This PR is related to the addition of the new secret configuration for identity confirmation, which connects to the modifications in the environment variable for the same process.
  • fix(ids-api): Zendesk config #16820: The changes in this PR are linked to the modifications of the zendeskIdentityConfirmationSecret variable in environment.ts, which directly connects to the new secret configuration added in the main PR.

Suggested labels

automerge

Suggested reviewers

  • svanaeinars
  • magnearun

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ada039 and 9bd590c.

📒 Files selected for processing (1)
  • apps/services/auth/admin-api/src/environments/environment.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/services/auth/admin-api/src/environments/environment.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: check-secrets (staging)
  • GitHub Check: check-secrets (dev)
  • GitHub Check: prepare

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@GunnlaugurG GunnlaugurG changed the title fix(admin-api) fix(admin-api): Fix missing Zendesk webhook env variable Feb 18, 2025
Copy link

nx-cloud bot commented Feb 18, 2025

View your CI Pipeline Execution ↗ for commit 9bd590c.

Command Status Duration Result
nx run-many --projects services-auth-admin-api ... ✅ Succeeded 9m 29s View ↗
nx run-many --target=build --projects=api --par... ✅ Succeeded 5m 8s View ↗
nx run-many --projects api,api-domains-auth-adm... ✅ Succeeded 56s View ↗
nx run-many --target=build --projects=services-... ✅ Succeeded 36s View ↗
nx run-many --projects clients-auth-admin-api -... ✅ Succeeded 12s View ↗
nx run-many --target=lint --projects=services-a... ✅ Succeeded 5s View ↗
nx run-many --target=codegen/frontend-client --... ✅ Succeeded 11s View ↗
nx run-many --target=codegen/backend-schema --a... ✅ Succeeded 3m 56s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-18 14:07:01 UTC

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38e4cc2 and 6ada039.

⛔ Files ignored due to path filters (6)
  • charts/identity-server-services/services-auth-admin-api/values.dev.yaml is excluded by !charts/**
  • charts/identity-server-services/services-auth-admin-api/values.prod.yaml is excluded by !charts/**
  • charts/identity-server-services/services-auth-admin-api/values.staging.yaml is excluded by !charts/**
  • charts/identity-server/values.dev.yaml is excluded by !charts/**
  • charts/identity-server/values.prod.yaml is excluded by !charts/**
  • charts/identity-server/values.staging.yaml is excluded by !charts/**
📒 Files selected for processing (2)
  • apps/services/auth/admin-api/infra/auth-admin-api.ts (1 hunks)
  • apps/services/auth/admin-api/src/environments/environment.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`apps/services/**/*`: "Confirm that the code adheres to the ...

apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."
  • apps/services/auth/admin-api/infra/auth-admin-api.ts
  • apps/services/auth/admin-api/src/environments/environment.ts
`apps/**/*`: "Confirm that the code adheres to the following...

apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
  • apps/services/auth/admin-api/infra/auth-admin-api.ts
  • apps/services/auth/admin-api/src/environments/environment.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: prepare
🔇 Additional comments (2)
apps/services/auth/admin-api/infra/auth-admin-api.ts (1)

86-87:

❓ Verification inconclusive

LGTM! Verify secret configuration in Kubernetes.

The new Zendesk webhook secret follows the established naming pattern and is properly integrated into the service configuration.

Please ensure that the secret has been properly configured in the Kubernetes cluster for all environments (dev, staging, prod) before deploying:


🏁 Script executed:

#!/bin/bash
# Description: Verify the existence of the new secret in Kubernetes.
# Note: This requires appropriate cluster access and kubectl configuration.

# Check if the secret exists in the services-auth namespace
kubectl get secret -n services-auth ZENDESK_WEBHOOK_SECRET_IDENTITY_CONFIRMATION -o json | jq -r '.metadata.name'

Length of output: 211


LGTM! Manual verification of secret configuration recommended.

The new Zendesk webhook secret follows the established naming pattern and is properly integrated into the service configuration. However, our automated verification attempt using the script was inconclusive because the kubectl command was not available in the current environment. Please verify manually that the secret exists and is correctly configured in your Kubernetes clusters (dev, staging, prod) before deployment.

apps/services/auth/admin-api/src/environments/environment.ts (1)

20-24:

❓ Verification inconclusive

Verify the environment variable in deployment configuration.

Please ensure that the Zendesk webhook secret is properly configured in the deployment environment.

Run the following script to check the environment variable configuration:


🏁 Script executed:

#!/bin/bash
# Description: Check for the presence of Zendesk webhook secret in deployment configuration

# Search for Zendesk webhook secret configuration
rg -i "ZENDESK.*SECRET.*CONFIRMATION" --type yaml

Length of output: 200


Ensure Deployment Configuration Includes Zendesk Webhook Secret

The code in apps/services/auth/admin-api/src/environments/environment.ts (lines 20–24) uses an environment variable (process.env.ZENDESK_WEBHOOK_SECRET_IDENTITY_CONFIRMATION) with a fallback to a static test secret. Please verify that in your deployment environment the actual Zendesk webhook secret is set. The initial search using a YAML file filter did not scan any files—try running the above script to search all files or manually check your deployment configuration (e.g., environment files, deployment YAMLs) to confirm that the ZENDESK_WEBHOOK_SECRET_IDENTITY_CONFIRMATION variable is defined and set correctly.


🏁 Script executed:

#!/bin/bash
# Attempt to search for the Zendesk webhook secret variable in the entire repository (ignoring file type filters)
rg -i "ZENDESK_WEBHOOK_SECRET_IDENTITY_CONFIRMATION" .

Length of output: 54


Ensure Zendesk Webhook Secret is Configured in Deployment

The code in apps/services/auth/admin-api/src/environments/environment.ts (lines 20–24) uses process.env.ZENDESK_WEBHOOK_SECRET_IDENTITY_CONFIRMATION with a fallback to a static testing value. Our searches (both in YAML files and across the repository) did not reveal any deployment configuration that references this variable. This is common if environment configurations are managed outside of version control. However, to avoid inadvertently using the static test secret in production, please manually verify that your deployment configuration (e.g., environment files, CI/CD settings) defines the ZENDESK_WEBHOOK_SECRET_IDENTITY_CONFIRMATION variable with the correct secret.

  • File under review: apps/services/auth/admin-api/src/environments/environment.ts (lines 20–24)

Copy link
Member

@robertaandersen robertaandersen left a comment

Choose a reason for hiding this comment

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

LGTM

@GunnlaugurG GunnlaugurG added this pull request to the merge queue Feb 18, 2025
Merged via the queue into main with commit 78fcf42 Feb 18, 2025
37 checks passed
@GunnlaugurG GunnlaugurG deleted the fix/webhook-secret branch February 18, 2025 14:08
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.

4 participants