[PR #1354] [MERGED] Fix OpenID provider configuration panic with unsafe type assertions #3365

Closed
opened 2026-03-22 14:42:09 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/1354
Author: @Copilot
Created: 8/29/2025
Status: Merged
Merged: 8/31/2025
Merged by: @kolaente

Base: mainHead: copilot/fix-1340


📝 Commits (3)

  • 1154865 Initial plan
  • c467a65 Fix OpenID provider panic with unsafe type assertions
  • e8e5f55 fix: address lint errors in OpenID providers test

📊 Changes

2 files changed (+108 additions, -6 deletions)

View changed files

📝 pkg/modules/auth/openid/providers.go (+22 -6)
pkg/modules/auth/openid/providers_test.go (+86 -0)

📄 Description

  • Fix OpenID provider configuration panic with unsafe type assertions
  • Add comprehensive test coverage for type safety scenarios
  • Address lint errors (errcheck and gofmt) in test file
    • Fix unchecked error returns for keyvalue.Del() calls
    • Apply proper gofmt formatting

Changes Made

  1. Fixed OpenID Provider Panic: Added proper type checking with "comma ok" idiom to prevent panic when configuration is in unexpected formats
  2. Added Test Coverage: Created comprehensive tests to verify type safety handling for various invalid configuration formats
  3. Fixed Lint Issues:
    • Added explicit error ignoring (_ = keyvalue.Del(...)) for cleanup operations in tests
    • Applied proper gofmt formatting throughout the test file

The fix now gracefully handles all configuration formats:

  • map[string]interface{} (JSON format) - works correctly
  • map[interface{}]interface{} (YAML format) - works correctly
  • []interface{} (invalid format) - logs error, no panic
  • string and other invalid types - logs error, no panic

Fixes #1340.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/1354 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 8/29/2025 **Status:** ✅ Merged **Merged:** 8/31/2025 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `copilot/fix-1340` --- ### 📝 Commits (3) - [`1154865`](https://github.com/go-vikunja/vikunja/commit/1154865de86d3e0c3bc478b56714378806db5bf0) Initial plan - [`c467a65`](https://github.com/go-vikunja/vikunja/commit/c467a652f099853c07739b5b309071d788b7ab8d) Fix OpenID provider panic with unsafe type assertions - [`e8e5f55`](https://github.com/go-vikunja/vikunja/commit/e8e5f555142569cc5f3770a2a505a20d1956bf78) fix: address lint errors in OpenID providers test ### 📊 Changes **2 files changed** (+108 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `pkg/modules/auth/openid/providers.go` (+22 -6) ➕ `pkg/modules/auth/openid/providers_test.go` (+86 -0) </details> ### 📄 Description - [x] Fix OpenID provider configuration panic with unsafe type assertions - [x] Add comprehensive test coverage for type safety scenarios - [x] Address lint errors (errcheck and gofmt) in test file - [x] Fix unchecked error returns for `keyvalue.Del()` calls - [x] Apply proper gofmt formatting ## Changes Made 1. **Fixed OpenID Provider Panic**: Added proper type checking with "comma ok" idiom to prevent panic when configuration is in unexpected formats 2. **Added Test Coverage**: Created comprehensive tests to verify type safety handling for various invalid configuration formats 3. **Fixed Lint Issues**: - Added explicit error ignoring (`_ = keyvalue.Del(...)`) for cleanup operations in tests - Applied proper gofmt formatting throughout the test file The fix now gracefully handles all configuration formats: - ✅ `map[string]interface{}` (JSON format) - works correctly - ✅ `map[interface{}]interface{}` (YAML format) - works correctly - ✅ `[]interface{}` (invalid format) - logs error, no panic - ✅ `string` and other invalid types - logs error, no panic Fixes #1340. <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-22 14:42:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#3365