title: Security sidebar_position: 99 id: security license: | Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Use this page when a Dart reader accepts bytes from outside the application's trust boundary. Fory reconstructs application values; it does not authenticate the sender, protect transport integrity, or decide whether a valid value is authorized for a business operation.
Before deserialization:
Security-related configuration:
checkStructVersion: true with compatible: false for intentional same-schema payloads.maxDepth to reject unexpectedly deep payload shapes.maxGraphMemoryBytes at the default for most inputs, or set an explicit positive byte gate for known trusted collection/map/struct-heavy payloads.Add negative tests for the boundary as well as normal round trips. Verify that the configured reader rejects unexpected application types, excessive nesting, resource-limit violations, and malformed input. After a failed read, verify that a valid root can still be read with the same Fory instance.
See Configuration for the complete option reference and Type Registration for the Fory registration API.