Skip to content

feat: Dynamic code execution uses full Unity access by default - #1362

Merged
hatayama merged 5 commits into
v3-betafrom
feature/remove-dynamic-code-level
Jun 17, 2026
Merged

feat: Dynamic code execution uses full Unity access by default#1362
hatayama merged 5 commits into
v3-betafrom
feature/remove-dynamic-code-level

Conversation

@hatayama

@hatayama hatayama commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Dynamic code execution now uses one full-access mode for Unity APIs, .NET APIs, and project assemblies.
  • Settings no longer show separate permission controls for execute-dynamic-code; the existing tool toggle is the only visibility control.

User Impact

  • Users no longer need to choose between Restricted and Full Access before running trusted snippets.
  • The Tool Settings screen is simpler and no longer suggests that dynamic code has a separate security level.

Changes

  • Removed restricted-mode scanning, metadata validation, permission settings storage, and related tests.
  • Simplified dynamic-code compiler and executor wiring to a single full-access path.
  • Updated README, SECURITY docs, architecture notes, and generated skill guidance to match the enabled/disabled tool model.

Compatibility Note

  • Legacy permission migration is intentionally not preserved because backward compatibility for removed permission settings is out of scope for this cleanup.

Verification

  • cli/dist/darwin-arm64/uloop compile --project-path "$(git rev-parse --show-toplevel)" returned 0 errors and 0 warnings.
  • Focused EditMode test run passed: 76 passed, 0 failed.
  • DynamicCodeToolTests run passed: 122 passed, 0 failed.
  • git diff --check passed.
  • Stale security-level reference search returned no matches.

Review in cubic

hatayama added 4 commits June 17, 2026 14:01
Execute dynamic code now runs in a single full-access mode, so remove the restricted-mode policy, permissions settings storage, UI controls, and validation pipeline.

- Simplify compiler and executor wiring to a single cached runtime path
- Remove obsolete security contracts, metadata validators, settings files, and tests
- Refresh docs and skill guidance to describe the single enabled/disabled tool model
Remove stale assembly-definition references left behind by deleting the metadata validation assembly, and regenerate checked-in execute-dynamic-code skill copies from the updated source skill.
Update extension development guidance so it no longer points users to the removed dynamic-code security level setting.
Drop the remaining IMPORTANT callouts from the English and Japanese README files because the dynamic-code cleanup no longer needs extra warning blocks there.
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1bed1efa-5163-4d68-9e72-1c4557daf7df

📥 Commits

Reviewing files that changed from the base of the PR and between e2e702f and 433c530.

📒 Files selected for processing (1)
  • SECURITY.md

📝 Walkthrough

Walkthrough

Removes the entire DynamicCodeSecurityLevel security subsystem: the Restricted/FullAccess enum, SecurityViolation/DangerousApiCatalog/SourceSecurityScanner types, all IL/metadata pre-load validators, AssemblyReferencePolicy, ULoopSettingsRepository, and the security-level UI controls. The executor pool collapses to a single cached instance, and all method signatures that previously accepted a security level are made parameterless.

Changes

Dynamic Code Security Level Removal

Layer / File(s) Summary
Security domain types and settings contracts removed
Packages/src/Editor/Domain/DynamicCodeSecurityLevel.cs, Packages/src/Editor/ToolContracts/Security/SecurityViolation.cs, Packages/src/Editor/ToolContracts/Security/SecurityValidationResult.cs, Packages/src/Editor/ToolContracts/Security/DangerousApiCatalog.cs, Packages/src/Editor/ToolContracts/Security/SourceSecurityScanner.cs, Packages/src/Editor/Domain/ULoopSettings.cs, Packages/src/Editor/Domain/ULoopSettingsData.cs, Packages/src/Editor/ToolContracts/UnityCliLoopConstants.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Compilation/CompilationResult.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Compilation/CompiledAssemblyLoadResult.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Compilation/ICompiledAssemblyLoader.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Compilation/IDynamicCompilationServiceFactory.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/IDynamicCodeExecutor.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/ExecuteDynamicCodeResponse.cs
Removes DynamicCodeSecurityLevel, SecurityViolation/SecurityValidationResult, DangerousApiCatalog, SourceSecurityScanner, IULoopSettingsPort/ULoopSettings facade, ULoopSettingsData; strips HasSecurityViolations/SecurityViolations from CompilationResult/CompiledAssemblyLoadResult; removes SecurityLevel parameter from ICompiledAssemblyLoader.Load and IDynamicCompilationServiceFactory.Create; removes SecurityViolations from ExecutionStatistics; removes SecurityLevel property from ExecuteDynamicCodeResponse and adds Error alias for ErrorMessage; renames settings file constant to ULOOP_TOOL_SETTINGS_FILE_NAME.
Compilation pipeline security stages removed
Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/AssemblyReferencePolicy.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCodeSecurityManager.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/FirstPartyDynamicCodeSettings.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/CompilationCacheManager.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/CompiledAssemblyLoader.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/CompiledAssemblyLoadService.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/DynamicCodeCompiler.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/DynamicCodeCompilationServiceFactory.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DESIGN.md
Removes AssemblyReferencePolicy, DynamicCodeSecurityManager, FirstPartyDynamicCodeSettings; strips security-violation caching from CompilationCacheManager; simplifies CompiledAssemblyLoader.Load to accept only byte[] (removes pre/post-load validation); removes source-scan (CreateSourceSecurityFailure) and assembly-security (CreateAssemblySecurityFailure) stages from DynamicCodeCompiler; makes DynamicCodeCompilationServiceFactory.Create parameterless; updates DESIGN.md invariants.
MetadataValidation subsystem removed
Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/MetadataValidation/IPreloadAssemblySecurityValidator.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/MetadataValidation/IOverrideDefaultPreloadAssemblySecurityValidation.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/MetadataValidation/PreloadAssemblySecurityValidatorRegistry.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/MetadataValidation/PreloadIlSecurityValidator.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/IlSecurityValidator.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/MetadataValidation/SystemReflectionMetadataPreloadValidator.cs, Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSettingsRepository.cs
Removes all preload validation contracts and implementations; removes security-migration side-effect call from UnityCliLoopEditorSettingsRepository.LoadSettings.
Execution pipeline security-level references removed
Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/DynamicCodeExecutionRequest.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/IDynamicCodeExecutorPool.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/DynamicCodeExecutorPool.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/DynamicCodeExecutionFacade.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/DynamicCodeExecutor.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/DynamicCodeExecutorStub.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/DynamicCodeForegroundWarmupRunner.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Factory/IDynamicCodeExecutorProvider.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Factory/RegistryDynamicCodeExecutorFactory.cs, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/ExecuteDynamicCodeUseCase.cs
Removes SecurityLevel from DynamicCodeExecutionRequest; changes IDynamicCodeExecutorPool.GetOrCreate/IDynamicCodeExecutorProvider.Create to be parameterless; DynamicCodeExecutorPool collapses from a per-level dictionary to a single cached _executor; DynamicCodeExecutor removes CreateSecurityFailureResult/BuildViolationMessages; ExecuteDynamicCodeUseCase no longer resolves or propagates security level through the execution pipeline, retry, cancellation, or exception response paths.
Settings infrastructure and application wiring updated
Packages/src/Editor/Infrastructure/Settings/ULoopSettingsRepository.cs, Packages/src/Editor/Application/UseCases/ToolSettingsUseCase.cs, Packages/src/Editor/CompositionRoot/UnityCliLoopApplicationRegistration.cs
Removes ULoopSettingsRepository (settings.permissions.json persistence layer including security-level migration); removes GetDynamicCodeSecurityLevel/SetDynamicCodeSecurityLevel from ToolSettingsUseCase; adjusts UnityCliLoopApplicationRegistration.Register() initialization order.
Settings window UI security controls removed
Packages/src/Editor/Presentation/UnityCliLoopSettingsWindowViewData.cs, Packages/src/Editor/Presentation/UIToolkit/Components/ToolSettingsSection.cs, Packages/src/Editor/Presentation/UIToolkit/UnityCliLoopSettingsWindowUI.cs, Packages/src/Editor/Presentation/UnityCliLoopSettingsWindow.cs, Packages/src/Editor/Presentation/UIToolkit/UnityCliLoopSettingsWindow.uxml, Packages/src/Editor/Presentation/UIToolkit/UnityCliLoopSettingsWindow.uss
Removes DynamicCodeSecurityLevel field from ToolSettingsSectionData; removes OnSecurityLevelChanged event from ToolSettingsSection and UnityCliLoopSettingsWindowUI; adds OnConfigurationFoldoutChanged, OnToolSettingsFoldoutChanged, OnToolToggled events; removes Permissions card from UXML; removes all security-related USS selectors; removes UpdateDynamicCodeSecurityLevel handler.
Tests updated and security test fixtures removed
Assets/Tests/Editor/DynamicCodeToolTests/AssemblyReferencePolicyTests.cs, Assets/Tests/Editor/DynamicCodeToolTests/CompiledAssemblyLoaderTests.cs, Assets/Tests/Editor/DynamicCodeToolTests/DangerousApiCatalogTests.cs, Assets/Tests/Editor/DynamicCodeToolTests/DynamicCodeSecurityLevelTests.cs, Assets/Tests/Editor/DynamicCodeToolTests/DynamicCodeSecurityManagerTests.cs, Assets/Tests/Editor/ULoopSettingsTests.cs, Assets/Tests/Editor/DynamicCodeToolTests/DynamicCodeExecutionFacadeTests.cs, Assets/Tests/Editor/DynamicCodeToolTests/DynamicCodeExecutorPoolTests.cs, Assets/Tests/Editor/DynamicCodeToolTests/ExecuteDynamicCodeUseCaseTests.cs, Assets/Tests/Editor/ToolSettingsSectionTests.cs, Assets/Tests/Editor/OnionAssemblyDependencyTests.cs, Assets/Tests/Editor/StaticFacadeStateGuardTests.cs, Assets/Tests/Editor/UnityCliLoopSettingsWindowRefreshPolicyTests.cs
Removes six entire test fixtures (AssemblyReferencePolicyTests, CompiledAssemblyLoaderTests, DangerousApiCatalogTests, DynamicCodeSecurityLevelTests, DynamicCodeSecurityManagerTests, ULoopSettingsTests); updates remaining tests to remove security-level parameterization, try/finally wrappers, per-level provider tracking, and fixture constants; adjusts dependency/facade assertions.
Documentation updated
Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Skill/SKILL.md, .agents/skills/uloop-execute-dynamic-code/SKILL.md, .claude/skills/uloop-execute-dynamic-code/SKILL.md, .codex/skills/uloop-execute-dynamic-code/SKILL.md, Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Skill/references/undo-operations.md, README.md, README_ja.md, SECURITY.md, docs/architecture/execute-dynamic-code-rebuild.md, docs/architecture/unity-cli-loop-onion-refactor-plan.md
Replaces "Forbidden" directive in SKILL.md files with prefer-terminal guidance; updates JSON output schema to remove securityLevel and add updatedCode/diagnosticsSummary/diagnostics; fixes stray numeric artifacts in undo-operations.md examples; updates README/README_ja to remove Restricted/FullAccess security level descriptions; updates SECURITY.md policy scope; updates architecture docs to reflect single-executor pool and no security-level resolution in use case.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#901: Introduced security-scoped executor pooling and the DynamicCodeSecurityLevel-parameterized GetOrCreate in DynamicCodeExecutorPool and related interfaces that this PR removes.
  • hatayama/unity-cli-loop#835: Added the dynamicCodeSecurityLevel segmented control UI in ToolSettingsSection/ToolSettingsSectionData and wired the OnSecurityLevelChanged event that this PR removes.
  • hatayama/unity-cli-loop#1310: Shares direct overlap in deleting/modifying the same security test fixtures (DynamicCodeSecurityManagerTests and other restricted-mode test cases) that this PR also removes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/remove-dynamic-code-level

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 103 files

Note: This PR contains a large number of files. cubic only reviews up to 100 files per PR, so some files may not have been reviewed. cubic prioritizes the most important files to review.
On a pro plan you can use ultrareview for larger PRs.

Re-trigger cubic

Keep SECURITY.md focused on the private vulnerability reporting path and remove outdated support, timeline, and best-practice guidance.
@hatayama
hatayama merged commit 5b64443 into v3-beta Jun 17, 2026
9 checks passed
@hatayama
hatayama deleted the feature/remove-dynamic-code-level branch June 17, 2026 07:57
@github-actions github-actions Bot mentioned this pull request Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant