JQuery Upgrade

From Notes_Wiki
Revision as of 12:38, 15 May 2025 by Sunilvarma (talk | contribs) (jQuery version upgrading in the TheHive server)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

jQuery Version Upgrade

We can check the jQuery version by accessing the following URI:

http://<THEHIVE_SERVER-IP>:9000/static/bootstrap/jquery.min.js

Locate "jquery.min.js" in TheHive

By default, TheHive is installed in the directory /opt/thehive/ and all files are packaged in .jar format.

To find the jquery.min.js file within the .jar files, run the following commands:

cd /opt/thehive/lib/
for jar in *.jar; do
  unzip -l "$jar" | grep -i jquery.min.js && echo "Found in $jar"
done

After executing the above command, you should find that jquery.min.js is located inside the org.thp.thehive-frontend-5.4.10-1.jar file.

Replace the jQuery File

To safely replace the jquery.min.js file, follow these steps:

Step 1: Create a working directory:

mkdir /opt/thehive/tmpjar
cd /opt/thehive/tmpjar

Step 2: Extract the JAR file:

unzip /opt/thehive/lib/org.thp.thehive-frontend-5.4.10-1.jar

Step 3: Replace the existing jQuery file with a secure version: Note: At the time of writing, the jQuery version used is 3.7.1

wget https://code.jquery.com/jquery-3.7.1.min.js -O frontend/static/bootstrap/jquery.min.js

Step 4: Rebuild the JAR file:

zip -r org.thp.thehive-frontend-5.4.10-1.jar *

Step 5: Replace the old JAR file (make a backup first):

mv /opt/thehive/lib/org.thp.thehive-frontend-5.4.10-1.jar /opt/thehive/lib/org.thp.thehive-frontend-5.4.10-1.jar.bak
mv org.thp.thehive-frontend-5.4.10-1.jar /opt/thehive/lib/

Step 6: Restart TheHive service:

sudo systemctl restart thehive

Verify the jQuery Version

After restarting the service, verify the jQuery version by visiting the following URL in a web browser:

http://<THEHIVE_SERVER-IP>:9000/static/bootstrap/jquery.min.js