Skip to content

TRUNK-6556 : Lower CVSS Score from 6.1#5796

Open
sudhanshu-raj wants to merge 7 commits intoopenmrs:masterfrom
sudhanshu-raj:TRUNK-6556
Open

TRUNK-6556 : Lower CVSS Score from 6.1#5796
sudhanshu-raj wants to merge 7 commits intoopenmrs:masterfrom
sudhanshu-raj:TRUNK-6556

Conversation

@sudhanshu-raj
Copy link
Copy Markdown
Contributor

@sudhanshu-raj sudhanshu-raj commented Feb 13, 2026

Description of what I changed

During the OWASP Dependency Check, we found two vulnerable dependencies i.e, jQuery 1.7.1 & jQuery UI 1.8.2, that's why our CVSS score was medium which is around 6.1. So this aim is to reduce the CVSS score hence reduce vulnerabilities found.

Earlier, we were using jQuery very old versions like jQuery 1.7.1 and jQuery UI 1.8.2 from around 2011, which has few vulnerabilities(around 7) found via the OWASP Dependency Check and this is the only reason for CVSS score 6.1, fixing this would solve the problem.

So, I updated both the jQuery dependency to latest version which is jQuery 1.7.1 > 3.7.1 and jQuery UI 1.8.2 > 1.13.3,
which has no any vulnerabilities and CVSS score reduced to 0 as there is no any vulnerability found. I added the latest jquery.min.js and jquery-ui.custom.min.js along with jquery-migrate.min.js which provides compatibility and ensures the smooth running of deprecated jQuery methods even after shifting to newer version. I did some changes like replaced the deprecated method with new one manually but there could be more such place where we need to replace with newer method that's why jquery-migrate will be helpful here and did few changes for progress bar updates compatible for newer version.
After this I tested the initial setup page for core, and this seems to be working as expected.

Issue I worked on

see https://issues.openmrs.org/browse/TRUNK-6556

Checklist: I completed these to help reviewers :)

  • My IDE is configured to follow the code style of this project.

    No? Unsure? -> configure your IDE, format the code and add the changes with git add . && git commit --amend

  • I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

    No? -> write tests and add them to this commit git add . && git commit --amend

  • I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

    No? -> execute above command

  • All new and existing tests passed.

    No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.

  • My pull request is based on the latest changes of the master branch.

    No? Unsure? -> execute command git pull --rebase upstream master

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Hi @dkayiwa , is there anything wrong with nvdApiKey --nvdApiKey ${{ secrets.NVD_API_KEY }} on dependency-check.yml ?

@RajPrakash681
Copy link
Copy Markdown

Hi @dkayiwa , is there anything wrong with nvdApiKey --nvdApiKey ${{ secrets.NVD_API_KEY }} on dependency-check.yml ?

yes i also had same doubt mine is also failing! do you figured out something @sudhanshu-raj

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Hi @dkayiwa , is there anything wrong with nvdApiKey --nvdApiKey ${{ secrets.NVD_API_KEY }} on dependency-check.yml ?

yes i also had same doubt mine is also failing! do you figured out something @sudhanshu-raj

I guess something is wrong with nvdApiKey, may be it is missing or invalid. We can't do much here.

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 15, 2026

Repository secrets are not passed to workflows triggered by pull requests from forks. This is a deliberate security measure to prevent untrusted code from exfiltrating sensitive information.

@YO-WHATS-UP2
Copy link
Copy Markdown
Contributor

@dkayiwa @sudhanshu-raj @RajPrakash681 Are you guys also facing the issue of ObsValidatorTest Failure in [Build with Maven / build (ubuntu-latest, 21, true) because of groupmember. I identified the most likely fix as to change the groupMember to groupMembers in lines 427 and 445 of the file api/src/main/java/org/openmrs/validator/ObsValidator.java. Not sure though.

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 16, 2026

I have seen that on many other pull requests. Are you able to reproduce it locally?

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 16, 2026

I can see the @wikumChamith created a ticket for the same exact problem. https://openmrs.atlassian.net/browse/TRUNK-6559

@YO-WHATS-UP2
Copy link
Copy Markdown
Contributor

@dkayiwa Nope it happens only on github actions/github ci. Can't produce it locally.

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Hi @dkayiwa , meanwhile can we review the changes, any thoughts ?

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 17, 2026

What results to you get when you run the dependency check tool?

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

If i check the workflow for dependency check failure, it directly showing - Missing argument for option: nvdApiKey

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

sudhanshu-raj commented Feb 17, 2026

I debug the dependency check workflow to verify whether this path /opt/jdk exist or not, and found that it doesn't. Maybe it be most important reason for workflow failure . And can view the logs on my dependency check workflow run.

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Okay so i removed the nvd api key part and it's passing owasp dependency check, probably working without nvd key which clearly depicts there is something wrong with the key only. Isn't @dkayiwa ?

@RajPrakash681
Copy link
Copy Markdown

Okay so i removed the nvd api key part and it's passing owasp dependency check, probably working without nvd key which clearly depicts there is something wrong with the key only. Isn't @dkayiwa ?

yes this is the only reason most probably now

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 17, 2026

Is your JIRA ticket link correct?

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Is your JIRA ticket link correct?

Thanks for pointing out that, fixed it.

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 17, 2026

What output do you get when you run the dependency check tool mvn org.owasp:dependency-check-maven:aggregate

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

So I got the report generated , and on that report found no vulnerabilities , actual result :

dependency-check version: 12.2.0
Report Generated On: Tue, 17 Feb 2026 23:56:48 +0530
Dependencies Scanned: 302 (245 unique)
Vulnerable Dependencies: 0
Vulnerabilities Found: 0
Vulnerabilities Suppressed: 0
NVD API Last Checked: 2026-02-17T23:56:23+0530
NVD API Last Modified: 2026-02-17T18:20:36Z

--failOnCVSS 6.2
--enableRetired
--suppression dependency-check-suppressions.xml
--nvdApiKey ${{ secrets.NVD_API_KEY }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to the ticket?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No , actually I did this for testing, reverting it back

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.87%. Comparing base (8a7aad2) to head (c98606e).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5796      +/-   ##
============================================
- Coverage     57.88%   57.87%   -0.02%     
+ Complexity     9137     9134       -3     
============================================
  Files           685      685              
  Lines         37143    37143              
  Branches       5432     5432              
============================================
- Hits          21500    21495       -5     
- Misses        13731    13735       +4     
- Partials       1912     1913       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 19, 2026

Did you test these changes in the user interface to confirm that all is well?

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

sudhanshu-raj commented Feb 20, 2026

Yes I have tested the interface specially the setup page, it's working as expected

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 21, 2026

Can you share some screenshots?

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Sure, I also though of adding the screen recording. of user interface. Here it is at 2x :

OpenMRS_InStp.mov

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 24, 2026

Compile the latest snapshot version of the legacyui module and try to run it on the latest snapshot version of openmrs-core with your changes. Take a look at the admin screen of the legacyui module and click all the links to confirm that all is well.

@sonarqubecloud
Copy link
Copy Markdown

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Compile the latest snapshot version of the legacyui module and try to run it on the latest snapshot version of openmrs-core with your changes. Take a look at the admin screen of the legacyui module and click all the links to confirm that all is well.

I tested the changes with Legacy UI 2.1.0-SNAPSHOT and Core 2.8.4-SNAPSHOT. Almost all functionality is working as expected. I made a small CSS adjustment due to the newer jQuery version. There are no UI changes, except for a minor update to the Add - Upgrade Module popup close button. The newer jQuery replaced anchor tag with button, so the CSS has adjusted accordingly.

I’ve attached a short video for this.

Uploading OpenMRS_LegacyUI_Module.mov…

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 26, 2026

I expect the changes to be on core 3.0.0-SNAPSHOT

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Can we run the legacy model with core 3.0.0 snapshot ?

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 26, 2026

Yes, the latest snapshot version.

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

I mean core 3.0.0 snapshot requires tomcat 10 I guess, and legacyUI module not works with tomact 10 , as i tried pairing both on tomcat 10 but got error which saying it need a class not sure but that's got removed from core 3.0.0 and it's there on previous version. This is my assumption, from what I tried .

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

And I see after the commit of d9f6827 , openmrs platform welcome page is not opening as I checked , I found dispatcher servlet didn't find the mapping for index.htm and thus getting 404 error page now and even after fixing this 404 page , still I getting errors for creating beans as it not found the class it referencing too.

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Feb 27, 2026

Which openmrs core version are you running?

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

3.0.0-SNAPSHOT

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

sudhanshu-raj commented Feb 27, 2026

Oh, sorry I was testing the old legacyui module , as I see the changes on this let me build on new changes and then will test

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

On the Admin Create Patient page, there is some unexpected behavior. The birthdate field is not working correctly. When moving to the second step of the Create Patient flow, the birthdate entered on the first step does not appear. Even when the birthdate is entered again on the second step, it is not converted to a date and a type mismatch error is shown, preventing the patient from being saved.

No jQuery changes were implemented here. This issue is most likely related to the shift to OpenMRS 3.x and the Spring version upgrade hence I guess it need some changes on legacyui module. Let me know if this seems to be problem for me only and I using 3.x snapshot for both legacyui and core module in this.

patient_pg_is.mp4

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

sudhanshu-raj commented Feb 28, 2026

After digging into root cause, found global custom editors not getting loaded on platform 3.x . Created the bug on TRUNK-6579

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

sudhanshu-raj commented Mar 2, 2026

There is another bug found , on the admin page , create the bug on LUI-208. And this is that screenshot :
image

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Did we intentionally removed the Default Theme option from Locales And Themes on 3.x ?
image

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Mar 3, 2026

Did we intentionally removed the Default Theme option from Locales And Themes on 3.x ? image

openmrs/openmrs-module-legacyui#221 (comment)

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

sudhanshu-raj commented Mar 3, 2026

Got ClassCastException during the mulitpart form submissions, in legacyUI 3.x . Created the issue LUI-209 and also fixed it PR

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Updated the legacyUI module jQuery code to compatible with this latest version . Raised the pr :PR

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Mar 6, 2026

@sudhanshu-raj did you test the legacyui and confirm that all is well?

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

@sudhanshu-raj did you test the legacyui and confirm that all is well?

Yes after all these changes, all looks good

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Mar 6, 2026

Do you wanna share some screenshots?

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

I quickly got some screenshots , for some pages although I guess screen recording will be more efficient , isn't ? Anyway here is the google drive link for those screenshots DriveLink

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

And another thing do we need to update the legacyui module after the junit migration from 4 > 5 done in core , as i can't run tests

@sudhanshu-raj
Copy link
Copy Markdown
Contributor Author

Hi @dkayiwa , just a quick reminder. Please share your thoughts when you get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants