The issue arises from the `org.xwiki.store.script.TemporaryAttachmentsScriptService#uploadTemporaryAttachment` function returning an instance of `com.xpn.xwiki.doc.XWikiAttachment`, which should not be exposed to users without the `programing` right. Instead, `com.xpn.xwiki.api.Attachment` should be used as it checks the user's rights before performing dangerous operations.