Skip to content

๐Ÿ”’๏ธ Restore macOS security-scoped bookmarks - #625

Open
vinceglb wants to merge 10 commits into
mainfrom
vinceglb/issue-590-security-scoped-bookmarks
Open

๐Ÿ”’๏ธ Restore macOS security-scoped bookmarks#625
vinceglb wants to merge 10 commits into
mainfrom
vinceglb/issue-590-security-scoped-bookmarks

Conversation

@vinceglb

Copy link
Copy Markdown
Owner

Closes #590

Summary

  • Store versioned native macOS bookmark data on JVM and Kotlin/Native, with explicit legacy migration metadata.
  • Use supported CoreFoundation and Security APIs on JVM; macOS-only sandbox detection now fails closed.
  • Keep security-scoped access shared by normalized descendants, balanced across operations, and alive until returned streams close; release rejects new access after existing handles drain.
  • Preserve the Apple data-class model and captured JVM ABI surface.
  • Document macOS entitlements, refresh behavior, legacy reselection, and release lifecycle.

Validation

  • ./gradlew :filekit-core:jvmTest --no-daemon --console=plain
  • ./gradlew :filekit-core:macosArm64Test --no-daemon --console=plain
  • ./gradlew check assemble --no-daemon --console=plain (passed, 9m 8s)
  • Signed Kotlin/Native and JVM macOS relaunch acceptance was completed during the original implementation: persisted external-directory bookmarks restored after process termination and wrote files again without reopening a picker. The JVM check used normal Compose JAR native-library signing semantics.

@chatgpt-codex-connector chatgpt-codex-connector 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.

๐Ÿ’ก Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0fdbe8de3

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +84 to +88
fun start(): Boolean {
check(!released) { "This security-scoped bookmark has been released" }
val granted = requireNotNull(scopeUrl).startAccessingSecurityScopedResource()
if (granted) {
activeAccesses += 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Serialize access to the shared native bookmark lease

When multiple threads operate on files derived from the same Kotlin/Native macOS bookmark, start(), stop(), and release() concurrently mutate released, activeAccesses, and scopeUrl without synchronization. For example, release() can observe zero active accesses and clear scopeUrl after start() passes its check but before it increments the counter, causing the subsequent stop() to throw and leave the native scope unbalanced; two simultaneous closes can likewise decrement the counter twice. The corresponding JVM implementation synchronizes these transitions, so the native lease needs equivalent serialization.

AGENTS.md reference: AGENTS.md:L12-L12

Useful? React with ๐Ÿ‘ย / ๐Ÿ‘Ž.

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.

BUG: MacOS App Sandbox security-scoped bookmarks (JVM + Apple-native)

1 participant