function makeWritableValueAtPath(key, sourceRef, targetRef) {
  const enumerable = Reflect.getOwnPropertyDescriptor(
    sourceRef,
    key
  )?.enumerable
  Reflect.defineProperty(targetRef, key, {
    configurable: false,
    enumerable,
    set(newValue) {
      sourceRef[key] = newValue
    },
    get() {
      return sourceRef[key]
    },
  })
}
Sets up the getter and setter pair so that the specific targetRef field is
effectively writeable and the value propagates to sourceRef. This implements
the `'write'` permission for a global in a specific resource.

@param {string} key
@param {Record<string, any>} sourceRef
@param {Record<string, any>} targetRef