# Code Injection / error "Request was rejected because user is not permitted to perform this operation"

**URL:** <https://forum.ghost.org/t/code-injection-error-request-was-rejected-because-user-is-not-permitted-to-perform-this-operation/15161>\
**Category:** Developer help\
**Created:** [June 17, 2020, 3:43am UTC](https://forum.ghost.org/t/code-injection-error-request-was-rejected-because-user-is-not-permitted-to-perform-this-operation/15161 "2020-06-17T03:43:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![getclue](https://avatars.discourse-cdn.com/v4/letter/g/b2d939/32.png) [@getclue](https://forum.ghost.org/u/getclue)\
**Post date:** [June 17, 2020, 3:43am UTC](https://forum.ghost.org/t/code-injection-error-request-was-rejected-because-user-is-not-permitted-to-perform-this-operation/15161/1 "2020-06-17T03:43:30Z")

</div>

Hi. I’m getting error “Request was rejected because user is not permitted to perform this operation” when I try to add a script using Code Injection.  
The script I’m adding is a simple JSON-LD of FAQ Schema, but it doesn’t matter which script I’m trying to add, including an empty tag.

**Details:**

- Version 3.2.0
- Production
- MySql
- URL: [http://54.92.215.188/visionlink-frequently-asked-questions/](http://54.92.215.188/visionlink-frequently-asked-questions/)
- Chrome and Firefox

**Steps to reproduce:**

1. Edit post
2. Settings → Code Injection → Post Header
3. Enter text Observe: no error
4. Enter text Observe error “Update failed: Unknown Error”
5. Attempt to update site. Observe error " Request was rejected because user is not permitted to perform this operation"

Expected: Ghost should allow me to enter a script in the header

Help needed: what do we need to check with our installation of Ghost that could cause this problem?

---

<div class="post-metadata">

**Author:** ![DavidDarnes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daviddarnes/32/3533_2.png) [@DavidDarnes](https://forum.ghost.org/u/DavidDarnes)\
**Post date:** [June 17, 2020, 2:26pm UTC](https://forum.ghost.org/t/code-injection-error-request-was-rejected-because-user-is-not-permitted-to-perform-this-operation/15161/2 "2020-06-17T14:26:49Z")

</div>

Would you be able to share the code you’re trying to add?

Thanks 😊

---

<div class="post-metadata">

**Author:** ![getclue](https://avatars.discourse-cdn.com/v4/letter/g/b2d939/32.png) [@getclue](https://forum.ghost.org/u/getclue)\
**Post date:** [June 17, 2020, 2:59pm UTC](https://forum.ghost.org/t/code-injection-error-request-was-rejected-because-user-is-not-permitted-to-perform-this-operation/15161/3 "2020-06-17T14:59:00Z")

</div>

Yes. Super simple, it doesn’t matter what I’m adding. Even adding an empty script fails:

The original script I’m trying to add is the one below, but again, it doesn’t matter what I’m adding, any script fails:

`<script type="application/ld+json">{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is VisionLink?","acceptedAnswer":{"@type":"Answer","text":"VisionLink is a telematics platform, built by Caterpillar and Trimble. It's predominately used to track Caterpillar assets, but can also be used to connect assets from other manufacturers."}},{"@type":"Question","name":"","acceptedAnswer":{"@type":"Answer","text":""}}]}</script>`

---

<div class="post-metadata">

**Author:** ![DavidDarnes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daviddarnes/32/3533_2.png) [@DavidDarnes](https://forum.ghost.org/u/DavidDarnes)\
**Post date:** [June 17, 2020, 3:36pm UTC](https://forum.ghost.org/t/code-injection-error-request-was-rejected-because-user-is-not-permitted-to-perform-this-operation/15161/4 "2020-06-17T15:36:41Z")

</div>

From re-reading the error it could be down to your user permissions the user you’re logged in as. Are you able to sign out and ensure you’re signed in as the right user? You’ve also missed out what version of Ghost you are using, this would be helpful for debugging 🙂

---

<div class="post-metadata">

**Author:** ![getclue](https://avatars.discourse-cdn.com/v4/letter/g/b2d939/32.png) [@getclue](https://forum.ghost.org/u/getclue)\
**Post date:** [June 17, 2020, 4:16pm UTC](https://forum.ghost.org/t/code-injection-error-request-was-rejected-because-user-is-not-permitted-to-perform-this-operation/15161/5 "2020-06-17T16:16:56Z")

</div>

Hi David, I’m signed in as owner, so I think should have all permissions required. We’re using version 3.2.0 - here are the details I put in the original post.  
System is installed using AWS Lightsail and Bitnami, all permissions default, we touched nothing.

**Details:**

- Version 3.2.0
- Production
- MySql
- URL: [http://54.92.215.188/visionlink-frequently-asked-questions/](http://54.92.215.188/visionlink-frequently-asked-questions/)
- Chrome and Firefox

---

<div class="post-metadata">

**Author:** ![getclue](https://avatars.discourse-cdn.com/v4/letter/g/b2d939/32.png) [@getclue](https://forum.ghost.org/u/getclue)\
**Post date:** [June 18, 2020, 2:03pm UTC](https://forum.ghost.org/t/code-injection-error-request-was-rejected-because-user-is-not-permitted-to-perform-this-operation/15161/6 "2020-06-18T14:03:52Z")

</div>

We created a brand new installation, which fixed the issue. Not sure what caused it in the first place.

---

<div class="post-metadata">

**Author:** ![rajivshah3](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/rajivshah3/32/10815_2.png) [@rajivshah3](https://forum.ghost.org/u/rajivshah3)\
**Post date:** [December 15, 2020, 5:40am UTC](https://forum.ghost.org/t/code-injection-error-request-was-rejected-because-user-is-not-permitted-to-perform-this-operation/15161/7 "2020-12-15T05:40:26Z")

</div>

For anyone else that comes across this issue and uses Cloudflare, it turns out this API might be blocked by the Cloudflare WAF if it contains a `<script>` tag or other HTML code. You can create a firewall rule that bypasses the firewall for the URI `ghost/api/v3/admin/settings/` to fix the issue.
