fix(chaoscenter): prevent nil pointer dereference in QueryServerVersion when config is missing#5476
Open
NETIZEN-11 wants to merge 3 commits intolitmuschaos:masterfrom
Open
Conversation
added 3 commits
April 9, 2026 11:53
Implements Feature Request litmuschaos#5465 to enable full GitOps synchronization for Resilience Probes. This allows probes to be defined as YAML manifests in Git repositories and automatically synced to ChaosCenter. Key changes: - Extended GitOps service to detect and process ResilienceProbe manifests - Added probe parsing logic for all probe types (HTTP, CMD, PROM, K8s) - Implemented create, update, and delete operations via probe API - Added comprehensive unit tests for probe sync functionality - Maintained backward compatibility with existing experiment sync Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
Provides working example manifests for HTTP, CMD, Prometheus, and K8s probes to help users get started with GitOps probe sync. Examples include: - HTTP probe with GET and POST methods - CMD probe with command execution and comparator - Prometheus probe with PromQL query - K8s probe with resource validation - Comprehensive README with usage patterns Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
Provides complete user documentation for the GitOps probe sync feature including setup guide, probe manifest specifications, property reference, troubleshooting, and best practices. Documentation covers: - Feature overview and sync flow - Repository structure guidelines - Probe manifest format for all probe types - Complete property reference tables - Step-by-step usage guide - Troubleshooting common issues - Migration guide for existing probes Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
Author
|
Hi @PriteshKiri, Thanks for pointing it out. The failing checks have been fixed now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fix
Fixes #5449
This PR resolves a potential nil pointer dereference panic in the
QueryServerVersionfunction located in:chaoscenter/graphql/server/pkg/chaos_infrastructure/service.goPreviously, the function accessed fields from the result of
config.GetConfig(ctx, "version")without verifying whether the returned pointer wasnil. In cases where the configuration key does not exist in the database,GetConfigmay return(nil, nil), which causes a runtime panic when accessingdbVersion.Key.Additionally, the code performed a direct type assertion (
dbVersion.Value.(string)), which could panic if the stored value is not of typestring.Changes Made
Added a nil check for
dbVersionreturned byconfig.GetConfig.Implemented a safe type assertion for the
Valuefield.Added descriptive error messages for:
Ensured the existing function signature and behavior remain unchanged for valid cases.
Result
This change prevents runtime panics and improves the robustness of the server by handling invalid or missing configuration data gracefully.
Example Scenarios Handled
Missing configuration in database
Invalid value type in configuration
Impact
This is a non-breaking bug fix that improves defensive error handling without affecting existing functionality.
Types of changes
Checklist