Skip to content

Add API for restricting operations for sensitive files#2597

Open
trancexpress wants to merge 1 commit intoeclipse-platform:masterfrom
trancexpress:gh2588_with_api
Open

Add API for restricting operations for sensitive files#2597
trancexpress wants to merge 1 commit intoeclipse-platform:masterfrom
trancexpress:gh2588_with_api

Conversation

@trancexpress
Copy link
Copy Markdown
Contributor

@trancexpress trancexpress commented Mar 30, 2026

This change adds the following API:

  • org.eclipse.core.resources.IWorkspace.isRestrictedContentEnabled()
  • org.eclipse.core.resources.IWorkspace.setRestrictedContentEnabled(boolean)
  • org.eclipse.core.resources.IFile.isContentRestricted()
  • org.eclipse.core.resources.IFile.setContentRestricted(boolean)

The goal of this API is to allow Eclipse-based IDEs to restrict certain platform functionality on a per-file basis, for sensitive files.

To restrict access to sensitive files, at runtime call:

  1. IWorkspace.setRestrictedContentEnabled(true)
  2. For each sensitive file, call: IFile.setContentRestricted(true)

Neither the IWorkspace nor the IFile flags are persisted, to enable restricted handling these flags must be set for each session.

The restrictions will apply to following functionality:

  • File search
  • Storing file history

Potentially more platform functionality will be restricted, if the workspace has restricted handling enabled.

See: #2588

@trancexpress
Copy link
Copy Markdown
Contributor Author

trancexpress commented Mar 30, 2026

@merks if you can help with the API documentation wording, that would be great!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

Test Results

    54 files  +   16      54 suites  +16   36m 51s ⏱️ + 12m 26s
 4 546 tests +  424   4 523 ✅ +  425   23 💤  - 1  0 ❌ ±0 
12 234 runs  +3 237  12 075 ✅ +3 236  159 💤 +1  0 ❌ ±0 

Results for commit fa30d36. ± Comparison against base commit 9202acf.

♻️ This comment has been updated with latest results.

@merks
Copy link
Copy Markdown
Contributor

merks commented Mar 30, 2026

@merks if you can help with the API documentation wording, that would be great!

FYI. I’m on vacation mostly monitoring from my iPhone with slow internet. Ping me when you think it’s done and I can look at it on my computer later.

@iloveeclipse iloveeclipse requested a review from Copilot March 30, 2026 12:50
Copy link
Copy Markdown
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

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

LGTM for me, just white space change on WorkspaceDescription should be reverted.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new session-scoped API in org.eclipse.core.resources to mark files as “restricted/sensitive” and to globally enable/disable restricted-content handling at the workspace level, intended to let downstream IDEs disable content-related operations for those files.

Changes:

  • Add IWorkspace.isRestrictedContentEnabled() / setRestrictedContentEnabled(boolean) workspace toggle.
  • Add IFile.isContentRestricted() / setContentRestricted(boolean) backed by a session property (RESTRICTED_CONTENT).
  • Implement the workspace toggle in internal Workspace and bump bundle version.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IWorkspace.java Adds new workspace-level restricted-content enablement API + Javadoc.
resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IFile.java Adds session-property key and default methods for per-file restricted-content marking.
resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java Implements the new IWorkspace API via an internal boolean flag.
resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/WorkspaceDescription.java Whitespace-only change.
resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF Bumps bundle version to 3.24.0.qualifier.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@trancexpress trancexpress force-pushed the gh2588_with_api branch 4 times, most recently from e8b9816 to 9c81084 Compare March 30, 2026 15:09
This change adds the following API:

* org.eclipse.core.resources.IWorkspace.isRestrictedContentEnabled()
* org.eclipse.core.resources.IWorkspace.setRestrictedContentEnabled(boolean)
* org.eclipse.core.resources.IFile.isContentRestricted()
* org.eclipse.core.resources.IFile.setContentRestricted(boolean)

The goal of this API is to allow Eclipse-based IDEs to restrict certain
platform functionality on a per-file basis, for sensitive files.

To restrict access to sensitive files, at runtime call:

1. IWorkspace.setRestrictedContentEnabled(true)
2. For each sensitive file, call: IFile.setContentRestricted(true)

Neither the IWorkspace nor the IFile flags are persisted,
to enable restricted handling these flags must be set for each session.

The restrictions will apply to following functionality:

* File search
* Storing file history

Potentially more platform functionality will be restricted,
if the workspace has restricted handling enabled.

See: eclipse-platform#2588
@iloveeclipse
Copy link
Copy Markdown
Member

From my POV this PR is ready to merge, so

  • @laeubi : please check the proposed API.
  • @merks : if you could look at wording, would be great.

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.

4 participants