Repository navigation
Reference Operations Security
Relevant source files
The following files were used as context for generating this wiki page:
Security boundaries and validation logic protect the Kit project by enforcing strict constraints on file system access, external program execution, and data integrity during CAD format conversion. These systems prevent path traversal attacks, execution of unauthorized binaries, and resource exhaustion from malformed archives.
The project defines security scope within src/, tools/, and .github/ directories, while excluding vendor tooling and local CAD installations from the primary security perimeter. Continuous integration scans for secrets, dependency vulnerabilities, and static-analysis findings; a passing scan is bounded by its configured coverage and revision.
The security system isolates file operations and program execution through dedicated boundary modules. These modules ensure that the application only interacts with verified paths and authorized external binaries.
The PathBoundary module provides functions to resolve and validate paths for inputs, temporary files, and labels. It prevents access outside of designated workspaces.
-
ResolveInput: Resolves and verifies paths for source CAD documents. -
ResolveTemp: Manages the creation and resolution of temporary file paths for conversion artifacts. -
ValidateLabel: Enforces naming conventions on labels to ensure they are safe for use as identifiers.
The ProgramBoundary module identifies the location of authorized external tools, such as the FreeCAD oracle used for verification. Functions like GetFreecadPath ensure that the system executes only the intended version of external applications.
The conversion adapters implement deep validation for proprietary and open CAD containers. The Archive module for FreeCAD (FCStd) serves as a primary example of enforcing safety limits on ZIP structures and XML content.
The system validates ZIP archive members before extraction to prevent "zip bomb" attacks and path traversal.
| Constraint | Limit / Logic | Purpose |
|---|---|---|
KMaxEntries |
16,384 | Prevents resource exhaustion from excessive file counts. |
KMaxEntrySize |
512 MB | Limits the size of any single file within an archive. |
KMaxTotalSize |
1 GB | Limits the aggregate size of the processed archive. |
KMaxCompressionRatio |
500 | Detects and rejects potential "zip bombs." |
| Encryption | Rejected | Rejects encrypted entries to ensure content inspectability. |
| Symbolic Links | Rejected | Prevents path traversal via link redirection. |
CAD metadata stored in XML format (e.g., Document.xml) is subject to node and depth limits to prevent parser exploits.
flowchart TD
Start[XML Parsing] --> Parse[Parse Document.xml]
Parse --> NodeCount{Node Count > 2M?}
NodeCount -- Yes --> Fail[Raise ValueError]
NodeCount -- No --> DepthCheck{Depth > 256?}
DepthCheck -- Yes --> Fail
DepthCheck -- No --> SchemaCheck{Schema Version < 2?}
SchemaCheck -- Yes --> Fail
SchemaCheck -- No --> Success[Return Validated Root]
The logic walks the XML tree, incrementing counters for nodes and tracking nesting depth. It requires a minimum schema version to ensure compatibility with modern security structures.
The repository employs an extensive set of automated tools within the CI pipeline to maintain its security posture.
Automated monitoring covers secret auditing, dependency scanning, and static analysis.
- Secret Auditing: Gitleaks, TruffleHog, and detect-secrets scan for leaked credentials.
-
Dependency Scanning:
pip-audit, Safety, OSV-Scanner, Grype, and Trivy check for known vulnerabilities in theuv.lockdependency set. - Static Analysis: Bandit, Semgrep, CodeQL, and dlint analyze Python code for security flaws.
-
Infrastructure & Workflow: Checkov audits IaC, while
zizmorandactionlintverify GitHub Actions safety.
The project enforces strict workflow boundaries for delegated agents to prevent unauthorized modifications to the repository history.
-
Branch Protection: Agents are prohibited from committing directly to the
mainbranch. - Worktree Isolation: Every delegated agent must run in its own isolated worktree.
Published from repository revision 1149072d · PR #50 is awaiting merge · Maintenance guide
- Home
- Getting started
- API reference
- Architecture
- Conversion engine
- Contributing
- Change entries
- Gotchas
- Maintaining the wiki
- Assembly & Constraints Model
- Boundary Representation (B-Rep)
- Neutral Document Model
- Parametric Features Model