Skip to content

plan: avoid nil pointer dereference in OCI provider build#65

Merged
tamalsaha merged 1 commit into
masterfrom
fix/oci-nil-pointer
Jun 6, 2026
Merged

plan: avoid nil pointer dereference in OCI provider build#65
tamalsaha merged 1 commit into
masterfrom
fix/oci-nil-pointer

Conversation

@tamalsaha

Copy link
Copy Markdown
Contributor

Summary

  • If OCI auth setup fails (missing compartment OCID for instance-principal mode, or a LoadOCIConfig error), config is nil while err is non-nil. The very next line dereferenced config.ZoneCacheDuration and panicked.
  • Move config.ZoneCacheDuration = ... and the NewOCIProvider call inside the existing err == nil guard.

Test plan

  • go build ./...
  • Manually exercise OCI provider with both missing compartment OCID and missing config file paths to confirm a clean error path instead of a panic

If OCI authentication setup fails (missing compartment OCID for instance
principal mode, or LoadOCIConfig error) the local `config` is nil while
err is non-nil. The next line then dereferenced `config.ZoneCacheDuration`
and panicked.

Move the ZoneCacheDuration assignment and the NewOCIProvider call into
the `err == nil` guard so the nil config can never be dereferenced.

Signed-off-by: Tamal Saha <tamal@appscode.com>
@tamalsaha tamalsaha merged commit ea9c8cf into master Jun 6, 2026
4 checks passed
@tamalsaha tamalsaha deleted the fix/oci-nil-pointer branch June 6, 2026 15:46
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.

1 participant