Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Configuration Inheritance: System.Object

Syntax

Microsoft.OData.Mcp.Core.Configuration.InputValidationConfiguration

Summary

Configuration for input validation and sanitization.

Remarks

Input validation configuration controls how user-provided data is validated and sanitized before processing. This helps prevent injection attacks, data corruption, and ensures data integrity throughout the application.

Constructors

.ctor

Syntax

public InputValidationConfiguration()

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

AllowSpecialCharacters

Gets or sets a value indicating whether special characters are allowed in input.

Syntax

public bool AllowSpecialCharacters { get; set; }

Property Value

Type: bool true to allow special characters; otherwise, false.

Remarks

Special characters can be used in injection attacks but may also be legitimate parts of user data. This setting controls the balance between security and functionality.

EnableStrictValidation

Gets or sets a value indicating whether strict validation is enabled.

Syntax

public bool EnableStrictValidation { get; set; }

Property Value

Type: bool true to enable strict validation; otherwise, false.

Remarks

Strict validation applies more rigorous rules to input data, rejecting potentially dangerous content. This provides better security but may be more restrictive for legitimate use cases.

MaxStringLength

Gets or sets the maximum allowed length for string inputs.

Syntax

public int MaxStringLength { get; set; }

Property Value

Type: int The maximum string length in characters.

Remarks

String length limits prevent buffer overflow attacks and ensure predictable resource usage. This applies to all string inputs unless overridden by specific field validation rules.

Methods

Clone

Creates a copy of this input validation configuration.

Syntax

public Microsoft.OData.Mcp.Core.Configuration.InputValidationConfiguration Clone()

Returns

Type: Microsoft.OData.Mcp.Core.Configuration.InputValidationConfiguration A new instance with the same settings.

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

Lenient

Creates an input validation configuration with lenient rules.

Syntax

public static Microsoft.OData.Mcp.Core.Configuration.InputValidationConfiguration Lenient()

Returns

Type: Microsoft.OData.Mcp.Core.Configuration.InputValidationConfiguration A validation configuration suitable for environments requiring flexible input handling.

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

MergeWith

Merges another input validation configuration into this one.

Syntax

public void MergeWith(Microsoft.OData.Mcp.Core.Configuration.InputValidationConfiguration other)

Parameters

NameTypeDescription
otherMicrosoft.OData.Mcp.Core.Configuration.InputValidationConfigurationThe configuration to merge into this one.

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

Strict

Creates an input validation configuration with strict rules.

Syntax

public static Microsoft.OData.Mcp.Core.Configuration.InputValidationConfiguration Strict()

Returns

Type: Microsoft.OData.Mcp.Core.Configuration.InputValidationConfiguration A validation configuration suitable for high-security environments.

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?

Validate

Validates the input validation configuration.

Syntax

public System.Collections.Generic.IEnumerable<string> Validate()

Returns

Type: System.Collections.Generic.IEnumerable<string> A collection of validation errors, or empty if the configuration is valid.