> ## Documentation Index
> Fetch the complete documentation index at: https://amd-gaia.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Security

# Security

<Badge text="development" color="orange" />

## 18.1 Path Validation

**Import:** `from gaia.security import PathValidator`

```python theme={null}
from gaia.security import PathValidator

# Initialize validator
validator = PathValidator()

# Check if path is allowed
if validator.is_path_allowed("/home/user/documents/file.txt"):
    # Safe to access
    process_file("/home/user/documents/file.txt")

# Add allowed path
validator.add_allowed_path("/home/user/work")

# Paths are persisted in ~/.gaia/cache/
```

***

## 18.2 Symlink Detection

```python theme={null}
from gaia.rag.sdk import RAGSDK, RAGConfig

# RAG automatically detects and blocks symlinks
rag = RAGSDK(RAGConfig())

# This is blocked if it's a symlink — PathValidator raises PermissionError
try:
    rag.index_document("/suspicious/symlink.pdf")
except PermissionError as e:
    print(f"Security error: {e}")
```

***

## 18.3 File Size Limits

```python theme={null}
from gaia.rag.sdk import RAGConfig, RAGSDK

config = RAGConfig(
    max_file_size_mb=50  # Reject files > 50MB
)

rag = RAGSDK(config)

# Automatically rejects large files
try:
    rag.index_document("huge_file.pdf")  # 100MB
except ValueError as e:
    print(f"File too large: {e}")
```

***

## Related Topics

* [Core Agent System](/docs/sdk/core/agent-system) - Agent security configuration
* [RAG SDK](/docs/sdk/sdks/rag) - Document security
* [File Operations](/docs/sdk/mixins/tool-mixins#file-operations-mixin) - File tool security
* [Best Practices](/docs/sdk/best-practices) - Security best practices

***

<small style="color: #666;">
  **License**

  Copyright(C) 2024-2026 Advanced Micro Devices, Inc. All rights reserved.

  SPDX-License-Identifier: MIT
</small>
