Files
fil/packages/elixir/lib/kreuzberg/security_limits.ex

48 lines
1.6 KiB
Elixir
Raw Normal View History

2026-06-01 23:40:55 +02:00
# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
# Issues & docs: https://github.com/kreuzberg-dev/alef
defmodule Kreuzberg.SecurityLimits do
@moduledoc """
Configuration for security limits across extractors.
All limits are intentionally conservative to prevent DoS attacks
while still supporting legitimate documents.
"""
@typedoc "Configuration for security limits across extractors."
@type t :: %__MODULE__{
max_archive_size: non_neg_integer(),
max_compression_ratio: non_neg_integer(),
max_files_in_archive: non_neg_integer(),
max_nesting_depth: non_neg_integer(),
max_entity_length: non_neg_integer(),
max_content_size: non_neg_integer(),
max_iterations: non_neg_integer(),
max_xml_depth: non_neg_integer(),
max_table_cells: non_neg_integer()
}
defstruct max_archive_size: 524_288_000,
max_compression_ratio: 100,
max_files_in_archive: 10_000,
max_nesting_depth: 1_024,
max_entity_length: 1_048_576,
max_content_size: 104_857_600,
max_iterations: 10_000_000,
max_xml_depth: 1_024,
max_table_cells: 100_000
defimpl Jason.Encoder do
@doc false
def encode(value, opts) do
value
|> Map.from_struct()
|> Enum.reject(fn {_k, v} -> v == nil end)
|> Enum.into(%{})
|> Jason.Encoder.encode(opts)
end
end
end