mirror of
https://github.com/unraid/api.git
synced 2026-01-05 16:09:49 -06:00
fix: update OIDC URL validation and add tests (#1646)
- Updated the OIDC issuer URL validation to prevent trailing slashes and whitespace. - Introduced a utility class `OidcUrlPatterns` for managing URL patterns and validation logic. - Added comprehensive tests for the new URL validation logic and examples to ensure correctness. - Bumped version to 4.18.1 in the configuration file. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Added strict validation for OIDC issuer URLs in the SSO configuration form, with clearer guidance to avoid trailing slashes. - Bug Fixes - Prevented misconfiguration by rejecting issuer URLs with trailing slashes (e.g., Google issuer), avoiding double slashes in discovery URLs. - Tests - Introduced comprehensive unit tests covering issuer URL validation, patterns, and real-world scenarios to ensure reliability. - Chores - Bumped version to 4.18.1. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -42,9 +42,9 @@
|
||||
"deploy:storybook:staging": "pnpm build-storybook && wrangler deploy --env staging"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ajv": "8.17.1",
|
||||
"tailwindcss": "4.1.12",
|
||||
"vue": "3.5.20",
|
||||
"ajv": "8.17.1"
|
||||
"vue": "3.5.20"
|
||||
},
|
||||
"dependencies": {
|
||||
"@headlessui/vue": "1.7.23",
|
||||
@@ -55,6 +55,7 @@
|
||||
"@jsonforms/vue-vanilla": "3.6.0",
|
||||
"@tailwindcss/cli": "4.1.12",
|
||||
"@vueuse/core": "13.8.0",
|
||||
"ajv-errors": "^3.0.0",
|
||||
"class-variance-authority": "0.7.1",
|
||||
"clsx": "2.1.1",
|
||||
"dompurify": "3.2.6",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createAjv } from '@jsonforms/core';
|
||||
import type Ajv from 'ajv';
|
||||
import addErrors from 'ajv-errors';
|
||||
|
||||
export interface JsonFormsConfig {
|
||||
/**
|
||||
@@ -20,10 +21,15 @@ export interface JsonFormsConfig {
|
||||
* This ensures all JSONForms instances have proper validation and visibility rule support
|
||||
*/
|
||||
export function createJsonFormsAjv(): Ajv {
|
||||
return createAjv({
|
||||
const ajv = createAjv({
|
||||
allErrors: true,
|
||||
strict: false,
|
||||
});
|
||||
|
||||
// Add support for custom error messages
|
||||
addErrors(ajv);
|
||||
|
||||
return ajv;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user