<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>314979</bug_id>
          
          <creation_ts>2026-05-17 09:17:26 -0700</creation_ts>
          <short_desc>REGRESSION (313328@main): Multiple WebKit framework build phases produce &quot;Operation not permitted&quot; errors under user script sandboxing</short_desc>
          <delta_ts>2026-05-17 14:19:36 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>313032</dependson>
    
    <dependson>314977</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="David Kilzer (:ddkilzer)">ddkilzer</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2211527</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-05-17 09:17:26 -0700</bug_when>
    <thetext>With `ENABLE_USER_SCRIPT_SANDBOXING = YES` set in `Source/WTF/Configurations/Base.xcconfig` and `Source/WebKit/Configurations/Base.xcconfig` (Bug 313032, 271107@main), Xcode auto-generates a sandbox profile for each `PBXShellScriptBuildPhase` from its declared `inputPaths` and `outputPaths`. When a script reads or writes files outside its declared inputs/outputs, `sandbox-exec` denies the operation, producing `Operation not permitted` errors. Three build phases trigger such errors during a `make release SDKROOT=macosx.internal` build, although only the WTF changes caused a non-fatal error: message.

1. The `Verify Module` phase in the `WTF` target runs `Source/WTF/Scripts/modules-verifier/library-modules-verifier.py`, which invokes `xcrun clang -fmodules -fsyntax-only` against generated `Test.cpp`/`Test.mm` files that include `wtf/*.h`, `wtf/module.modulemap`, and `WebKitAdditions/pas_mte_additions.h` from `$(BUILT_PRODUCTS_DIR)$(WK_LIBRARY_HEADERS_FOLDER_PATH)/`. These transitive reads cannot be enumerated as `inputPaths`. Sample output:

```
fatal error: cannot open file &apos;.../WebKitBuild/Release/usr/local/include/wtf/module.modulemap&apos;: Operation not permitted
.../WebKitBuild/WTF.build/Release/WTF.build/VerifyModule/WTF/objective-c++/Test.framework/Headers/Test.h:1:9: fatal error: cannot open file &apos;.../WebKitBuild/Release/usr/local/include/wtf/ASCIICType.h&apos;: Operation not permitted
.../MacOSX26.4.Internal.sdk/usr/local/include/wtf/Assertions.h:28:10: fatal error: cannot open file &apos;.../WebKitBuild/Release/usr/local/include/wtf/Platform.h&apos;: Operation not permitted
.../MacOSX26.4.Internal.sdk/usr/local/include/bmalloc/./BPlatform.h:37:19: fatal error: cannot open file &apos;.../WebKitBuild/Release/usr/local/include/WebKitAdditions/pas_mte_additions.h&apos;: Operation not permitted
4 errors generated.

[...]
error: Failed to verify module.
Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure
```

The phase&apos;s shell script touches `${SCRIPT_OUTPUT_FILE_0}` (the timestamp file) at the end regardless of the verifier&apos;s exit, so the build proceeds, but module verification is silently broken, and the `--depfile` output is incomplete so incremental rebuilds cannot track the headers the verifier actually consumes.

2. The `Create symlinks to XPC services and dylibs` phase in the `WebKit` framework target creates a top-level `WebKit.framework/XPCServices` symlink in addition to the per-XPC service symlinks under `Versions/A/XPCServices/`. Only the per-service symlinks are listed in `outputPaths`, so the sandbox denies the top-level `ln -sfhv &quot;Versions/Current/XPCServices&quot; &quot;${BUILT_PRODUCTS_DIR}/WebKit.framework/XPCServices&quot;`. Sample output:

```
ln: .../WebKitBuild/Release/WebKit.framework/XPCServices: Operation not permitted
.../WebKit.framework/Versions/A/XPCServices/com.apple.WebKit.WebContent.xpc -&gt; ../../../../com.apple.WebKit.WebContent.xpc
.../WebKit.framework/Versions/A/XPCServices/com.apple.WebKit.WebContent.CaptivePortal.xpc -&gt; ../../../../com.apple.WebKit.WebContent.CaptivePortal.xpc
[...other per-service symlinks succeed...]
```

The top-level symlink is platform-conditional in the script (only created on macOS / Mac Catalyst / iosmac), which `outputPaths` cannot express. The remaining XPC service symlinks succeed because they are listed in `outputPaths`, but the missing top-level symlink leaves the framework bundle structurally incomplete on the affected platforms.

3. The `Update Info.plist for RunningBoard management` phase in the `WebContent`, `WebContent.CaptivePortal`, `WebContent.EnhancedSecurity`, `Networking`, and `GPU` targets invokes `Scripts/update-info-plist-for-runningboard.sh` from `Source/WebKit`, but only the target&apos;s `Info.plist` is listed in `inputPaths`. Sample output (one per affected target):

```
/bin/sh: Scripts/update-info-plist-for-runningboard.sh: Operation not permitted
```

The script&apos;s conditional `PlistBuddy` edits never run on internal macOS builds with `WK_USE_RESTRICTED_ENTITLEMENTS = YES`, silently dropping `LSDoNotSetTaskPolicyAutomatically`, `XPCService:_AdditionalProperties:RunningBoard:Managed`, and `XPCService:_AdditionalProperties:RunningBoard:Reported` from each XPC service&apos;s `Info.plist`.

All three sets of errors are non-fatal -- the build reports `** BUILD SUCCEEDED **` -- but produce noisy build logs and silently break each phase&apos;s intended behavior (module verification, framework bundle layout, RunningBoard management Info.plist keys).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2211528</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-05-17 09:17:33 -0700</bug_when>
    <thetext>&lt;rdar://problem/177287735&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2211531</commentid>
    <comment_count>2</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-05-17 09:48:06 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/65066</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2211568</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-05-17 14:19:34 -0700</bug_when>
    <thetext>Committed 313381@main (2daa97082eab): &lt;https://commits.webkit.org/313381@main&gt;

Reviewed commits have been landed. Closing PR #65066 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>