mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-14 03:09:39 +03:00
Can't save SQL-Statements #3287
Closed
opened 2026-02-05 06:14:31 +03:00 by OVERLORD
·
20 comments
No Branch/Tag Specified
development
l10n_development
release
v25-12
llm_only
vectors
v25-11
docker_env
drawio_rendering
user_permissions
ldap_host_failover
svg_image
prosemirror
captcha_example
fix/video-export
v25.12.3
v25.12.2
v25.12.1
v25.12
v25.11.6
v25.11.5
v25.11.4
v24.11.4
v25.11.3
v25.11.2
v25.11.1
v25.11
v25.07.3
v25.07.2
v25.07.1
v25.07
v25.05.2
v25.05.1
v25.05
v25.02.5
v25.02.4
v25.02.3
v25.02.2
v25.02.1
v25.02
v24.12.1
v24.12
v24.10.3
v24.10.2
v24.10.1
v24.10
v24.05.4
v24.05.3
v24.05.2
v24.05.1
v24.05
v24.02.3
v24.02.2
v24.02.1
v24.02
v23.12.3
v23.12.2
v23.12.1
v23.12
v23.10.4
v23.10.3
v23.10.2
v23.10.1
v23.10
v23.08.3
v23.08.2
v23.08.1
v23.08
v23.06.2
v23.06.1
v23.06
v23.05.2
v23.05.1
v23.05
v23.02.3
v23.02.2
v23.02.1
v23.02
v23.01.1
v23.01
v22.11.1
v22.11
v22.10.2
v22.10.1
v22.10
v22.09.1
v22.09
v22.07.3
v22.07.2
v22.07.1
v22.07
v22.06.2
v22.06.1
v22.06
v22.04.2
v22.04.1
v22.04
v22.03.1
v22.03
v22.02.3
v22.02.2
v22.02.1
v22.02
v21.12.5
v21.12.4
v21.12.3
v21.12.2
v21.12.1
v21.12
v21.11.3
v21.11.2
v21.11.1
v21.11
v21.10.3
v21.10.2
v21.10.1
v21.10
v21.08.6
v21.08.5
v21.08.4
v21.08.3
v21.08.2
v21.08.1
v21.08
v21.05.4
v21.05.3
v21.05.2
v21.05.1
v21.05
v21.04.6
v21.04.5
v21.04.4
v21.04.3
v21.04.2
v21.04.1
v21.04
v0.31.8
v0.31.7
v0.31.6
v0.31.5
v0.31.4
v0.31.3
v0.31.2
v0.31.1
v0.31.0
v0.30.7
v0.30.6
v0.30.5
v0.30.4
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.3
v0.29.2
v0.29.1
v0.29.0
v0.28.3
v0.28.2
v0.28.1
v0.28.0
v0.27.5
v0.27.4
v0.27.3
v0.27.2
v0.27.1
v0.27
v0.26.4
v0.26.3
v0.26.2
v0.26.1
v0.26.0
v0.25.5
v0.25.4
v0.25.3
v0.25.2
v0.25.1
v0.25.0
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.2
v0.23.1
v0.23.0
v0.22.0
v0.21.0
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.0
v0.18.5
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.1
v0.13.0
v0.12.2
v0.12.1
v0.12.0
v0.11.2
v0.11.1
v0.11.0
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.2
v0.8.1
v0.8.0
v0.7.6
v0.7.5
v0.7.4
v0.7.3
0.7.2
v.0.7.1
v0.7.0
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
Labels
Clear labels
🎨 Design
📖 Docs Update
🐛 Bug
🐛 Bug
:cat2:🐈 Possible duplicate
💿 Database
☕ Open to discussion
💻 Front-End
🐕 Support
🚪 Authentication
🌍 Translations
🔌 API Task
🏭 Back-End
⛲ Upstream
🔨 Feature Request
🛠️ Enhancement
🛠️ Enhancement
🛠️ Enhancement
❤️ Happy feedback
🔒 Security
🔍 Pending Validation
💆 UX
📝 WYSIWYG Editor
🌔 Out of scope
🔩 API Request
:octocat: Admin/Meta
🖌️ View Customization
❓ Question
🚀 Priority
🛡️ Blocked
🚚 Export System
♿ A11y
🔧 Maintenance
> Markdown Editor
pull-request
Mirrored from GitHub Pull Request
No Label
🐕 Support
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/BookStack#3287
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kdagutat on GitHub (Oct 18, 2022).
Attempted Debugging
Searched GitHub Issues
Describe the Scenario
Hey,
I have the following problem:
When I try to save a SQL script, the error message "ERR_CONNECTION_RESET" comes up. In #1792 the problem was also described, but I could not find a solution there. On the demo website the problem does not occur. The problem occurs both in the Markdown editor and in the WYSIWYG editor.
Examples:
Can't be saved:
, (SELECT count(*) FROM [BODA].[dbo].[WK_tabReRpZo_Zuordnung] WHERE [ReRpZo_Report] = 'TFKU286')But this can be saved:
SELECT count(*) FROM [BODA].[dbo].[WK_tabReRpZo_Zuordnung] WHERE [ReRpZo_Report] = 'TFKU286'Even this can't be saved:
SELECT (SELECT COUNT(*) FROM (SELECTAnd even correct statements like this, can't be saved:
SELECT (SELECT COUNT(*) FROM (SELECT [ReRpBo_Block] FROM [BODA].[dbo].[WK_tabReRp_Report], [BODA].[dbo].[WK_tabReRpZo_Zuordnung], [BODA].[dbo].[WK_tabReRpBo_Block], [BODA].[dbo].[WK_tabReRpAw_Auswertung] WHERE [ReRp_Report] = 'TFKU286' AND [ReRp_Report] = [ReRpZo_Report] AND [ReRpZo_Block] = [ReRpBo_Block] AND [ReRpBo_Block] = [ReRpAw_Block] GROUP BY [ReRpBo_Block]) as bribra) as NumBlocksInTotal, (SELECT count(*) FROM [BODA].[dbo].[WK_tabReRpZo_Zuordnung] WHERE [ReRpZo_Report] = 'TFKU286') as NumBlocksInBlocksExact BookStack Version
22.09.1
Log Content
laravel.log
In the httpd (apache) log is no error message regarding this problem. If still needed or wanted I will provide it too.
PHP Version
PHP 8.0.24
Hosting Environment
RHEL 8
Linux mydomain.com 4.18.0-372.26.1.el8_6.x86_64 # 1 SMP Sat Aug 27 02:44:20 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux
MySQL (MariaDB)
Version: mysql Ver 15.1 Distrib 10.3.35-MariaDB, for Linux (x86_64) using readline 5.1
@ssddanbrown commented on GitHub (Oct 18, 2022):
Hi @kdagutat,
This sounds like the kind of behaviour of
mod_securityfor apache. Could you confirm ifmod_securityis active?@kdagutat commented on GitHub (Oct 18, 2022):
I already checked this. It seems like it is not activated (not even installed).
I do not have found any configfile for it and it is not listed in phpinfo
PHP 8.0.24 - phpinfo().pdf
I also put this in my .htaccess file
Update: I tried it in xampp. There everything works as it should
@ssddanbrown commented on GitHub (Oct 18, 2022):
@kdagutat Are there any other layers involved in the stack? Any proxies or things like cloudlfare in use?
@kdagutat commented on GitHub (Oct 19, 2022):
I am quite new to the company, but as far as my colleague and I know there are no other layers. Do you have any idea how we could check this? It runs as a virtuel host (apache). If I'm not mistaken, the main domain runs on cloudflare and the bookstack subdomain (which we ONLY use on the intranet and which is also only available there) was created (and I think hosted) in Azure. We use bookstack ONLY on the intranet.
Interestingly, the SQL script works if you replace the
count(*)withcount(-). You can only usecount(*)if you don't have aSELECT (SELECTbefore it.Thanks for you help!
@ssddanbrown commented on GitHub (Oct 19, 2022):
So, just to confirm, is the bookstack subdomain set-up on Cloudflare?
If so, is it set-up as a proxied domain (Orange cloud in cloudflare) or a DNS only record?
@kdagutat commented on GitHub (Oct 19, 2022):
Hey, sorry I forgot a part of the sentence...
If I'm not mistaken, the main domain
domain.comis hosted on cloudflare and the bookstack subdomainbookstack.domain.comwas created via azure.@ssddanbrown commented on GitHub (Oct 19, 2022):
@kdagutat Thanks, although it's still not too clear to me that requests are not proxied through cloudflare.
Domains, and their subdomains, are usually managed within the same place.
There may be some confusion here between where a domain is managed vs where the applications are hosted?
As something else to check, do you get an entry in the apache access log when you attempt to save such a sql-containing page? Just wondering if there's any indication of the requests getting through to the BookStack host system.
@kdagutat commented on GitHub (Oct 20, 2022):
First, thank you so much for your support, I really appreciate it!
When you open the edit page, an entry is created. When saving NOT.
Edit: in the error.log no entry is created.
bookstack.access.log
@ssddanbrown commented on GitHub (Oct 20, 2022):
That to me indicates something is stopping the request before it hits the server.
@kdagutat commented on GitHub (Oct 20, 2022):
Yes, I think that too. I am very confused, because some SQL-Statements are saveable some are not.
@kdagutat commented on GitHub (Oct 20, 2022):
I have news regarding the host question.
The bookstack domain is hosted in our ad (Active Directory) (as an dns entry)
@ssddanbrown commented on GitHub (Oct 20, 2022):
Okay. It's still not clear that there are no other layers that these request are going through on your network. If available, you could use something like
traceroute <hostname>to check the request path.I'd also be sceptical that mod_security is not at play. Reading about I noticed you mentioned this:
It's not actually that common that
.htaccessfiles are used to alter apache config in modern setups.More common is setting up a virtualhost. Are you sure your environment is using the
.htaccessfile that you altered?Additionally, do you get any output from
sudo httpd -M | grep security?Other than that, I can only advise checking for other WAF/security layers on the system. Any intrusion detection or security packages, like Crowdsec, that may be doing active security checking on requests.
@kdagutat commented on GitHub (Oct 20, 2022):
We set it up as a virtualhost. I have edited the file only out of desperation.
sudo httpd -M | grep security
traceroute bookstack.wkgt.com
I'm off for the day, I wish you a great day. And once again thanks for your work and support!
@kdagutat commented on GitHub (Oct 21, 2022):
Little Update, I dont know if it help us:
When I go to
http://bookstack.wkgt.com/etc/passwd, I get the same error message (connection reset).Even this page is not accessible:
https://bookstack.wkgt.com/etc/passwdddddddddddddddaffafafsdgfndfguidfgnjuidngThese pages do not exist.
Other websites (which also do not exist) I can call up normally and get an error message from bookstacks (page does not exist)
So as soon as etc/passwd is in the url, this error message appears.
mod_security is not installed and not enabled. I add the configuration to disable it in my vhost.conf, without any changes to the error.
@ssddanbrown commented on GitHub (Oct 21, 2022):
It's another indicator that some level of active intrusion detection or a web application firewall is at play, blocking requests to suspicious requests. Is it you that sets up such machines? If not, might be worth consult the person that does to query if there might be such software at play.
Since you're using RHEL, could also be worth checking SELinux logs just in case. Didn't think it handles data within network requests, but maybe there's an onset affect at play.
@kdagutat commented on GitHub (Oct 21, 2022):
Thanks for your suggestions, I did not set up the machine, a work colleague of mine did. I'll have a word with him on Monday.
I had also deactivated Selinux for testing purposes - without success.
I wish you a nice weekend.
@kdagutat commented on GitHub (Nov 3, 2022):
Well just as little update, we did not manage to solve this issue. But we use bookstack anyway.
Thanks for your help and advices. If I get any updates in relation of this problem I'll share it here.
@ssddanbrown commented on GitHub (Nov 3, 2022):
Thanks for the update. I'll therefore close this off since there's not much else I can advise without deeper knowledge of your environment. If you ever find a BookStack-based cause feel free to raise it with us but I'm fairly confident this is something environment specific.
@kdagutat commented on GitHub (Mar 10, 2023):
After all this time, we finally found out today what the problem was. Your guess was right, a vulnerability scan (as far as I know, within Palo) intervened and broke the connection. I wanted to share it here in case someone has the same problem.
@ssddanbrown commented on GitHub (Mar 10, 2023):
@kdagutat Thanks for sharing the update, happy to hear your found the cause.