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

MTV-1856 | Protect OVA URL parsing #1287

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yaacov
Copy link
Member

@yaacov yaacov commented Dec 30, 2024

Issue:
we do not handle the case of missing ":" in the NFS URL
this will create an unhanded error:

{"level":"info","ts":"2024-12-29 10:46:32.872","msg":"Observed a panic in reconciler: runtime error: index out of range [1] with length 1","controller":"provider","object":{"name":"ova-server","namespace":"ova-server"}
,"namespace":"ova-server","name":"ova-server","reconcileID":"6322e786-c0cd-42eb-b05c-32d644704caa"}

Fix:
check for the number of splits when splitting the URL string using ":"

Ref:
https://issues.redhat.com/browse/MTV-1856

@yaacov yaacov requested a review from mnecas as a code owner December 30, 2024 07:19
@yaacov yaacov changed the title MTV-1856: Protect OVA URL parsing MTV-1856 | Protect OVA URL parsing Dec 30, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 30, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 15.44%. Comparing base (bfb0a81) to head (dc40900).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1287      +/-   ##
==========================================
- Coverage   15.47%   15.44%   -0.04%     
==========================================
  Files         112      112              
  Lines       23399    23399              
==========================================
- Hits         3621     3613       -8     
- Misses      19490    19501      +11     
+ Partials      288      285       -3     
Flag Coverage Δ
unittests 15.44% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yaacov yaacov force-pushed the protect-ova-url-parsing branch from d0d2715 to dc40900 Compare December 30, 2024 09:42
@@ -70,6 +70,13 @@ func (r Reconciler) CreateOVAServerDeployment(provider *api.Provider, ctx contex

func (r *Reconciler) createPvForNfs(provider *api.Provider, ctx context.Context, pvNamePrefix string) (pv *core.PersistentVolume, err error) {
splitted := strings.Split(provider.Spec.URL, ":")
if len(splitted) < 2 {
err = fmt.Errorf("invalid provider URL format: %s", provider.Spec.URL)
Copy link
Member Author

Choose a reason for hiding this comment

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

can the URL be a secret we don't want to expose in the logs ?

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.

2 participants