Documentation
¶
Overview ¶
Package validation provides interfaces and implementations for validating policy expressions, file paths, and directory paths used in fxconfig operations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// PolicyChecker validates Fabric policy DSL expressions.
PolicyChecker PolicyChecker
// FileChecker validates file existence and accessibility.
FileChecker FileChecker
// DirectoryChecker validates directory existence and accessibility.
DirectoryChecker DirectoryChecker
}
Context holds validation interfaces for domain input verification.
func NewValidationContext ¶
func NewValidationContext() Context
NewValidationContext creates a validation context with OS-based validators. Returns a Context configured with PolicyDSLChecker, OSFileChecker, and OSDirectoryChecker.
type DirectoryChecker ¶
type DirectoryChecker interface {
// Exists verifies that the path exists and is a directory.
Exists(path string) error
}
DirectoryChecker validates directory paths and existence.
type FileChecker ¶
type FileChecker interface {
// Exists verifies that the path exists and is a regular file.
Exists(path string) error
}
FileChecker validates file paths and existence.
type OSDirectoryChecker ¶
type OSDirectoryChecker struct{}
OSDirectoryChecker validates directory paths using os.Stat. Prevents path traversal attacks and ensures paths reference directories.
func (OSDirectoryChecker) Exists ¶
func (OSDirectoryChecker) Exists(path string) error
Exists verifies that the path exists and is a directory. Returns an error if the path is empty, doesn't exist, is a file, or contains path traversal.
type OSFileChecker ¶
type OSFileChecker struct{}
OSFileChecker validates file paths using os.Stat. Prevents path traversal attacks and ensures paths reference regular files.
func (OSFileChecker) Exists ¶
func (OSFileChecker) Exists(path string) error
Exists verifies that the path exists and is a regular file. Returns an error if the path doesn't exist, is a directory, or contains path traversal.
type PolicyChecker ¶
type PolicyChecker interface {
// Check validates a policy expression string.
Check(e string) error
}
PolicyChecker validates Fabric policy DSL expressions.
type PolicyDSLChecker ¶
type PolicyDSLChecker struct{}
PolicyDSLChecker validates Fabric policy DSL expressions using the policydsl parser.
func (PolicyDSLChecker) Check ¶
func (PolicyDSLChecker) Check(e string) error
Check validates a policy DSL expression string. Returns an error if the expression cannot be parsed.