snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
10.83k stars 3.13k forks source link

Waiting Black Screen error in Categories Screen #15257

Closed infotronicx closed 3 weeks ago

infotronicx commented 1 month ago

Debug mode

Describe the bug

image

This screen is visible while creating Categories - /public/categories/create -> Clicking Check Box - Require users to confirm acceptance of assets in this category.

This screen is visible while creating Categories - /public/categories/create -> Clicking Check Box - Send email to user on checkin/checkout.

If we do not check the checkboxes no black screen and data saves properly.

Reproduction steps

  1. Open Application go to Settings then Categories. This screen is visible while creating Categories - /public/categories/create -> Clicking Check Box - Require users to confirm acceptance of assets in this category. 2.This screen is visible while creating Categories - /public/categories/create -> Clicking Check Box - Send email to the user on check-in/checkout.
  2. ...

Expected behavior

No Balck screen should come and data should save easily.

Screenshots

image

Snipe-IT Version

7.0.9

Operating System

CentOS

Web Server

Apache

PHP Version

8.2.18

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

welcome[bot] commented 1 month ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

snipe commented 1 month ago

We'd need to see what's in your app logs to help

infotronicx commented 1 month ago

livewire.js?id=87e1046f:3998 Mixed Content: The page at '/public/import' was loaded over HTTPS, but requested an insecure script 'http://cdn.jsinit.directfwd.com/sk-jspark_init.php'. This request has been blocked; the content must be served over HTTPS. showHtmlModal @ livewire.js?id=87e1046f:3998 showFailureModal @ livewire.js?id=87e1046f:4331 sendRequest @ livewire.js?id=87e1046f:4308 await in sendRequest send @ livewire.js?id=87e1046f:4041 (anonymous) @ livewire.js?id=87e1046f:4186 createAndSendNewPool @ livewire.js?id=87e1046f:4182 (anonymous) @ livewire.js?id=87e1046f:4158 (anonymous) @ livewire.js?id=87e1046f:4221 setTimeout bufferPoolingForFiveMs @ livewire.js?id=87e1046f:4220 add @ livewire.js?id=87e1046f:4155 requestCall @ livewire.js?id=87e1046f:4237 (anonymous) @ livewire.js?id=87e1046f:4478 [Alpine] $wire.selectFile(1) @ VM2097:3 (anonymous) @ livewire.js?id=87e1046f:1198 tryCatch @ livewire.js?id=87e1046f:1118 evaluate @ livewire.js?id=87e1046f:1142 (anonymous) @ livewire.js?id=87e1046f:9303 callAndClearComponentDebounces @ livewire.js?id=87e1046f:9286 execute @ livewire.js?id=87e1046f:9302 x-on:click @ livewire.js?id=87e1046f:9313 (anonymous) @ livewire.js?id=87e1046f:1162 tryCatch @ livewire.js?id=87e1046f:1118 (anonymous) @ livewire.js?id=87e1046f:3862 handler4 @ livewire.js?id=87e1046f:3166 (anonymous) @ livewire.js?id=87e1046f:3230 (anonymous) @ livewire.js?id=87e1046f:3168

infotronicx commented 1 month ago

image

snipe commented 1 month ago

That's helpful, but we also need app logs. https://snipe-it.readme.io/docs/getting-help#step-3-check-your-app-and-server-logs

Based on that browser error though, I'd take a look at your APP_URL and make sure it exactly matches the url you access the app from. It's showing mixed content warnings.

Snipe-IT Documentation
Getting Help
If you're having trouble setting up Snipe-IT, don't worry!
infotronicx commented 1 month ago

There is no logfile created in serverlog in laravel.log also you can check this in the screenshot below. image Issue is with iframe of livewire which opens in IMPORT/ CATEGORIES / etc. with following code.. // js/request/modal.js function showHtmlModal(html) { let page = document.createElement("html"); page.innerHTML = html; page.querySelectorAll("a").forEach((a) => a.setAttribute("target", "_top")); let modal = document.getElementById("livewire-error"); if (typeof modal != "undefined" && modal != null) { modal.innerHTML = ""; } else { modal = document.createElement("div"); modal.id = "livewire-error"; modal.style.position = "fixed"; modal.style.width = "100vw"; modal.style.height = "100vh"; modal.style.padding = "50px"; modal.style.backgroundColor = "rgba(0, 0, 0, .6)"; modal.style.zIndex = 2e5; } let iframe = document.createElement("iframe"); iframe.style.backgroundColor = "#17161A"; iframe.style.borderRadius = "5px"; iframe.style.width = "100%"; iframe.style.height = "100%"; modal.appendChild(iframe); document.body.prepend(modal); document.body.style.overflow = "hidden"; iframe.contentWindow.document.open(); iframe.contentWindow.document.write(page.outerHTML); iframe.contentWindow.document.close(); modal.addEventListener("click", () => hideHtmlModal(modal)); modal.setAttribute("tabindex", 0); modal.addEventListener("keydown", (e) => { if (e.key === "Escape") hideHtmlModal(modal); }); modal.focus(); } function hideHtmlModal(modal) { modal.outerHTML = ""; document.body.style.overflow = "visible"; }

// js/request/pool.js var RequestPool = class { constructor() { this.commits = / @PURE / new Set(); } add(commit) { this.commits.add(commit); } delete(commit) { this.commits.delete(commit); } hasCommitFor(component) { return !!this.findCommitByComponent(component); } findCommitByComponent(component) { for (let [idx, commit] of this.commits.entries()) { if (commit.component === component) return commit; } } shouldHoldCommit(commit) { return !commit.isolate; } empty() { return this.commits.size === 0; } async send() { this.prepare(); await sendRequest(this); } prepare() { this.commits.forEach((i) => i.prepare()); } payload() { let commitPayloads = []; let successReceivers = []; let failureReceivers = []; this.commits.forEach((commit) => { let [payload, succeed2, fail2] = commit.toRequestPayload(); commitPayloads.push(payload); successReceivers.push(succeed2); failureReceivers.push(fail2); }); let succeed = (components2) => successReceivers.forEach((receiver) => receiver(components2.shift())); let fail = () => failureReceivers.forEach((receiver) => receiver()); return [commitPayloads, succeed, fail]; } };

Also Check the Browser Code.

image image Pls check the above Java script it is also getting blocked in firewalls. So there is some issue with the iframe code of live wire and loader class it is not working properly. Kindly guide as there is no serverlog also.

snipe commented 1 month ago

This is not a bug in our code, this is a configuration issue on your side. You're not meant to be looking at debugbar for logs, but the actual log file itself. As I said, you're having a protocol mismatch issue. I have no idea what that URL is in the last screenshot. We do not reference that URL anywhere in our source code.

snipe commented 1 month ago

My guess here is that someone on your end modified the source code. We do not reference external CSS or JS files ever.

infotronicx commented 1 month ago

image No code is modified from our end. Application is installed automatically from the cPanel via softaculous appinstaller on our webhosting. image

snipe commented 1 month ago

You should probably contact your hosting company then - they might be doing something funny with the web requests. We do not reference outside CDNs anywhere within our codebase. Every CSS and JS file we reference is one that we compile into the code package itself.

infotronicx commented 3 weeks ago

Hi, I have contacted my hosting company, installed it locally on my machine, installed on diffrent VPS server from hostinger, Installed on Shared Hosting through Softaculous but except my local pc everywhere this black screen pops out and generates the 404 error.

I have tried to copy local files ver.7.0.11 to VPS server, copied local database to VPS server but same files and same db generates this error on the server. I think something in the Livewire is causing this to happen. Also tried to re-install the composer packages, updated it but error still remains on live server. I think there is no issue with the Softaculous , No issue with Hosting but something from livewire script which is blocked on live server and not blocked locally.

Pls check. image

snipe commented 3 weeks ago

That looks like it's still throwing (at the very least) mixed content warnings, which means that something is misconfigured. Can you share your .env contents (with the sensitive info redacted, of course.)

snipe commented 3 weeks ago

Again though, there is nothing we're doing that would be causing that CDN load. I do see you have public in your APP_URL, which you probably shouldn't.

infotronicx commented 3 weeks ago

--------------------------------------------

REQUIRED: BASIC APP SETTINGS

--------------------------------------------

APP_ENV=production APP_DEBUG=false APP_KEY=redacted APP_URL=https://subdomain.example.com/public APP_TIMEZONE='Asia/Kolkata' APP_LOCALE='en-US' MAX_RESULTS=500

--------------------------------------------

REQUIRED: UPLOADED FILE STORAGE SETTINGS

--------------------------------------------

PRIVATE_FILESYSTEM_DISK=local PUBLIC_FILESYSTEM_DISK=local_public

PRIVATE_FILESYSTEM_DISK=s3_private

PUBLIC_FILESYSTEM_DISK=s3_public

--------------------------------------------

REQUIRED: DATABASE SETTINGS

--------------------------------------------

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=redacted DB_USERNAME=redacted DB_PASSWORD=redacted DBPREFIX=redacted DB_DUMP_PATH='/usr/bin' DB_CHARSET=utf8mb4 DB_COLLATION=utf8mb4_unicode_ci

--------------------------------------------

OPTIONAL: SSL DATABASE SETTINGS

--------------------------------------------

DB_SSL=false DB_SSL_IS_PAAS=false DB_SSL_KEY_PATH=null DB_SSL_CERT_PATH=null DB_SSL_CA_PATH=null DB_SSL_CIPHER=null DB_SSL_VERIFY_SERVER=null

--------------------------------------------

REQUIRED: OUTGOING MAIL SERVER SETTINGS

--------------------------------------------

MAIL_MAILER=smtp MAIL_HOST=smtp.office365.com MAIL_PORT=587 MAIL_USERNAME=redacted MAIL_PASSWORD=redacted MAIL_FROM_ADDR=redacted MAIL_FROM_NAME='Asset Handover' MAIL_REPLYTO_ADDR=redacted MAIL_REPLYTO_NAME='Asset Handover' MAIL_AUTO_EMBED_METHOD='attachment' MAIL_TLS_VERIFY_PEER=true

MAIL_ENCRYPTION is no longer supported. SymfonyMailer will use tls if it's

advertised, and won't if it's not. If you want to use your mail server's IP but it's failing

because of certificate errors, set MAIL_TLS_VERIFY_PEER-true

--------------------------------------------

REQUIRED: IMAGE LIBRARY

This should be gd or imagick

--------------------------------------------

IMAGE_LIB=gd

--------------------------------------------

OPTIONAL: BACKUP SETTINGS

--------------------------------------------

MAIL_BACKUP_NOTIFICATION_DRIVER=null MAIL_BACKUP_NOTIFICATION_ADDRESS=null BACKUP_ENV=true ALLOW_BACKUP_DELETE=false ALLOW_DATA_PURGE=false

--------------------------------------------

OPTIONAL: SESSION SETTINGS

--------------------------------------------

SESSION_DRIVER=file SESSION_LIFETIME=12000 EXPIRE_ON_CLOSE=false ENCRYPT=false COOKIE_NAME=snipeit_session PASSPORT_COOKIE_NAME='snipeit_passport_token' COOKIE_DOMAIN=null SECURE_COOKIES=false API_TOKEN_EXPIRATION_YEARS=15 BS_TABLE_STORAGE=cookieStorage BS_TABLE_DEEPLINK=true

--------------------------------------------

OPTIONAL: SECURITY HEADER SETTINGS

--------------------------------------------

APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1 ALLOW_IFRAMING=false REFERRER_POLICY=same-origin ENABLE_CSP=false ADDITIONAL_CSP_URLS=null CORS_ALLOWED_ORIGINS=null ENABLE_HSTS=false

--------------------------------------------

OPTIONAL: CACHE SETTINGS

--------------------------------------------

CACHE_DRIVER=file QUEUE_CONNECTION=database --- changed by me for checking.

QUEUE_DRIVER=sync ----- I have tried this for SQL Que as Notifications not working. but not sucess.

CACHE_PREFIX=snipeit

--------------------------------------------

OPTIONAL: REDIS SETTINGS

--------------------------------------------

REDIS_HOST=null REDIS_PASSWORD=null REDIS_PORT=null

--------------------------------------------

OPTIONAL: MEMCACHED SETTINGS

--------------------------------------------

MEMCACHED_HOST=null MEMCACHED_PORT=null

--------------------------------------------

OPTIONAL: PUBLIC S3 Settings

--------------------------------------------

PUBLIC_AWS_SECRET_ACCESS_KEY=null PUBLIC_AWS_ACCESS_KEY_ID=null PUBLIC_AWS_DEFAULT_REGION=null PUBLIC_AWS_BUCKET=null PUBLIC_AWS_URL=null PUBLIC_AWS_BUCKET_ROOT=null

--------------------------------------------

OPTIONAL: PRIVATE S3 Settings

--------------------------------------------

PRIVATE_AWS_ACCESS_KEY_ID=null PRIVATE_AWS_SECRET_ACCESS_KEY=null PRIVATE_AWS_DEFAULT_REGION=null PRIVATE_AWS_BUCKET=null PRIVATE_AWS_URL=null PRIVATE_AWS_BUCKET_ROOT=null

--------------------------------------------

OPTIONAL: AWS Settings

--------------------------------------------

AWS_ACCESS_KEY_ID=null AWS_SECRET_ACCESS_KEY=null AWS_DEFAULT_REGION=null

--------------------------------------------

OPTIONAL: LOGIN THROTTLING

--------------------------------------------

LOGIN_MAX_ATTEMPTS=5 LOGIN_LOCKOUT_DURATION=60 LOGIN_AUTOCOMPLETE=false

--------------------------------------------

OPTIONAL: FORGOTTEN PASSWORD SETTINGS

--------------------------------------------

RESET_PASSWORD_LINK_EXPIRES=15 PASSWORD_CONFIRM_TIMEOUT=10800 PASSWORD_RESET_MAX_ATTEMPTS_PER_MIN=50

--------------------------------------------

OPTIONAL: MISC

--------------------------------------------

LOG_CHANNEL=single LOG_MAX_DAYS=10 APP_LOCKED=false APP_CIPHER=AES-256-CBC APP_FORCE_TLS=false APP_ALLOW_INSECURE_HOSTS=false GOOGLE_MAPS_API=redacted LDAP_MEM_LIM=500M LDAP_TIME_LIM=600 IMPORT_TIME_LIMIT=600 IMPORT_MEMORY_LIMIT=500M REPORT_TIME_LIMIT=12000 REQUIRE_SAML=false API_THROTTLE_PER_MINUTE=120 CSV_ESCAPE_FORMULAS=true LIVEWIRE_URL_PREFIX=null

--------------------------------------------

OPTIONAL: HASHING

--------------------------------------------

HASHING_DRIVER='bcrypt' BCRYPT_ROUNDS=10 ARGON_MEMORY=1024 ARGON_THREADS=2 ARGON_TIME=2

--------------------------------------------

OPTIONAL: SCIM

--------------------------------------------

SCIM_TRACE=false SCIM_STANDARDS_COMPLIANCE=false

infotronicx commented 3 weeks ago

Also test mail from the settings is going ok but other notifications are not coming cron job is also configured properly.

I tried logging the Cron with below output but no job run.

cat /home/xyz/snipeit_cron.log

INFO No scheduled commands are ready to run.
INFO No scheduled commands are ready to run.
INFO No scheduled commands are ready to run.
INFO No scheduled commands are ready to run.
INFO No scheduled commands are ready to run.
INFO No scheduled commands are ready to run.
INFO No scheduled commands are ready to run.
INFO No scheduled commands are ready to run.
2024-08-20 17:45:02 Running ['artisan' auth:clear-resets] ..... 1,113ms DONE ⇂ '/usr/local/apps/php82/bin/php' 'artisan' auth:clear-resets > '/dev/null' 2>&1

Only Auth clear happens nothing else. Although we do check in and checkout.

snipe commented 3 weeks ago

So, again you should not have public in your URL, ever.

But also, in researching that weird CDN issue....

Per that last one, I think your host is overriding the 404 page (which is not a good thing), which is why that CDN script is showing up. I think it's a red herring.

Only Auth clear happens nothing else. Although we do check in and checkout.

Checkin and checkout notifications are not done via cron, so that's not relevant.

LIVEWIRE_URL_PREFIX=null

Per the docs, that LIVEWIRE_URL_PREFIX needs to reflect the subdirectory it's in, which in this case is public. I strongly encourage you to not run this from the public subdirectory, because it potentially exposes your .env sensitive data to the world. Snipe-IT is NOT meant to be run in a subdirectory and if you're going to do so, you have to take extra precautions to secure your install.

If you insist on running this in a subdirectory (at your own risk), try changing LIVEWIRE_URL_PREFIX=null to LIVEWIRE_URL_PREFIX=/public

Stack Overflow
one malicious link that is still reflecting on the website
My website is a static html site, no cms. no wordpress. https://www.reternetics.com/ I was running google ads for quite sometime, but now they have disapproved my ads. they say : There is one mali...
Just a moment...
Just a moment...
snipe commented 3 weeks ago

https://snipe-it.readme.io/docs/subdirectories#add-the-livewire-config-variable

Snipe-IT Documentation
Subdirectories
Snipe-IT really wants to be run as a subdomain or on its own domain name. If you wish to run Snipe-IT in a subdirectory ( https://yourserver.com/snipe-it ) instead of at a primary domain ( http://yourserver.com ) or a sub-domain ( https://snipe-it.yourserver.com ), you'll need to go through the stan...
infotronicx commented 3 weeks ago

Thanks by changing the .htaccess file it sorted the issue.