[ACM-30429] Fix nil pointer dereference in Equal() method#1986
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 30 minutes and 6 seconds.Comment |
f45cd8d to
7e11026
Compare
Fixed nil pointer panic in DiscoveredCluster.Equal() by adding nil checks for ActivityTimestamp and CreationTimestamp pointers before calling Truncate(). Changes: - Added timestampsEqual() helper function to safely compare *metav1.Time pointers - Updated Equal() method in api/v1 to use the helper - Updated component version from 2.17 to 5.0 in COMPONENT_VERSION and Dockerfile Fixes: ACM-30429 Signed-off-by: dislbenn <dbennett@redhat.com>
7e11026 to
4bbbe18
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cameronmwall, dislbenn The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
Fixes a critical nil pointer dereference bug in the
DiscoveredCluster.Equal()method that causes the operator to panic and crash during reconciliation whenActivityTimestamporCreationTimestampfields are nil.Related Issue
Fixes ACM-30429
Changes Made
Added
timestampsEqual()helper function in bothapi/v1andapi/v1alpha1packages*metav1.TimepointersUpdated
Equal()methods to use the helper function instead of direct.Truncate()callsapi/v1/discoveredcluster_types.go(lines 177, 180)api/v1alpha1/discoveredcluster_types.go(lines 93, 94)Updated component version from 2.17 to 5.0
COMPONENT_VERSIONfile: 2.17.0 → 5.0.0build/Dockerfile.rhtap: CPE version 2.17 → 5.0Screenshots (if applicable)
N/A - Bug fix, no visual changes
Checklist
Additional Notes
Before this fix:
After this fix:
The panic would occur during reconciliation whenever a
DiscoveredClusterobject had a nil timestamp field, causing the operator to crash and requiring a restart.Reviewers
/cc @ngraham20 @cameronmwall
Definition of Done