---
schema_version: "1"
id: 62c4dcf54d4219c365b6719e9a9181adb40ff31635e94d351ceab005045b7cc1
title: Block Apex Anonymous Code Execution from Managed Packages (Release Update)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/release-notes/264-0-0/rn_apex_block_exec_anon_ru.md
canonical_url: https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_block_exec_anon_ru.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: ac6200c3175107655afdbbc7b809b26fc5d09202271aa12e3e9bcbb44aaae53f
description: To strengthen subscriber org security, block managed package session IDs from authenticating anonymous Apex code. If you enable this update, installed managed packages can no longer use UserInfo.getSessionId() to obtain a session ID and then use the session ID to execute anonymous Apex.
products:
  - Cross Cloud
release: "264"
---
# Block Apex Anonymous Code Execution from Managed Packages (Release Update)

To strengthen subscriber org security, block managed package session IDs from authenticating anonymous Apex code. If you enable this update, installed managed packages can no longer use `UserInfo.getSessionId()` to obtain a session ID and then use the session ID to execute anonymous Apex.

**Where:** This change applies to Lightning Experience and Salesforce Classic in Enterprise, Performance, Unlimited, and Developer editions. The release update applies to existing first-generation (1GP) and second-generation (2GP) managed packages.

![Important](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-release-notes-salesforce_release_notes-264-0-0-production-enus/550ba85b-db1a-4608-9cd4-9a65ec96e1fa/images/icon_important.png)

Important This release update controls the behavior of existing managed packages installed in subscriber orgs. New managed packages with namespaces created in Summer ’26 and later are blocked from anonymous Apex code execution, regardless of whether the subscriber enables this release update. If code from a new managed package attempts to execute anonymous Apex code, this error is thrown: Managed package sessions are not authorized to call executeAnonymous.

**When:** Salesforce enforces this update in Summer ’27. To get the major release upgrade date for your instance, go to [Trust Status](https://status.salesforce.com/), search for your instance, and click the maintenance tab.

**Why:** With this security update, managed package developers must define all Apex classes in their package metadata so that they can run in subscriber orgs. This change means that managed package code is versioned, logged, and adheres to access controls. If a managed package must interact directly with subscriber org code, we recommend using standard mechanisms, such as a shared `global` interface and `Type.forName()`.

**How:** To review this update, from Setup, in the Quick Find box, enter Release Updates, and then select **Release Updates**. For Block Apex Anonymous Code Execution from Managed Packages, follow the testing and activation steps.

To check if any currently installed managed packages can execute anonymous Apex, go to the Apex Settings page in Setup. Review the note “Impact Assessment: Block Apex Anonymous Code Execution from Managed Packages.” The release update assessment contains either a list of identified managed packages that can execute anonymous Apex, or a confirmation that no managed packages with recent anonymous Apex execution were detected in this org.

![Impact Assessment note on the Apex Settings paging in Setup that reports that no managed packages with recent anonymous Apex execution were detected in the org.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-release-notes-salesforce_release_notes-264-0-0-production-enus/550ba85b-db1a-4608-9cd4-9a65ec96e1fa/salesforce_release_notes/images/rn_262_apex_anon_ru.png)

#### See Also

- [_Apex Developer Guide_: Anonymous Blocks](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_anonymous_block.htm)
- [_Salesforce Help_: Release Updates](https://help.salesforce.com/s/articleView?id=xcloud.release_updates.htm&type=5&language=en_US)