Skip to content

Added Liferay advisories - #1794

Closed
Dedsec0098 wants to merge 4 commits into
aboutcode-org:mainfrom
Dedsec0098:liferay-advisories
Closed

Added Liferay advisories #1794
Dedsec0098 wants to merge 4 commits into
aboutcode-org:mainfrom
Dedsec0098:liferay-advisories

Conversation

@Dedsec0098

@Dedsec0098 Dedsec0098 commented Mar 4, 2025

Copy link
Copy Markdown

Fixed #1410

Changes Made :

  1. Added liferay importer
  2. Registered the importer in init.py

Also ran the tests for importers locally and it is working completely fine.

@Rishi-source

Copy link
Copy Markdown

Hi @Dedsec0098 , I am encountering error while running this importer pipeline
First error :

AttributeError: type object 'LiferayAdvisoryPipeline' has no attribute 'qualified_name'

to resolve this error I have added qualified_name = "LiferayPipeline" in the header of LiferayAdvisoryPipeline

Second error :

Importing data using LiferayPipeline
INFO Starting import for LiferayPipeline
Traceback (most recent call last):
  File "../vulnerablecode/vulnerabilities/management/commands/import.py", line 70, in import_data
    ImportRunner(importer).run()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "../vulnerablecode/vulnerabilities/import_runner.py", line 60, in run
    advisory_datas = importer_class().advisory_data()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'LiferayAdvisoryPipeline' object has no attribute 'advisory_data'
Failed to run importer LiferayPipeline. Continuing...
CommandError: 1 failed!: LiferayPipeline

Signed-off-by: Shrish0098 <shrish409@gmail.com>
@Dedsec0098

Dedsec0098 commented Mar 5, 2025

Copy link
Copy Markdown
Author

Hey @Rishi-source this issue has already been addressed in this commit.

@Dedsec0098

Copy link
Copy Markdown
Author

@ziadhany I have tested this branch locally and it is passing all the tests but there Checks are failing on github. How should approach this problem to solve it.

@Rishi-source

Copy link
Copy Markdown

Hey @Rishi-source this issue has already been addressed in this commit.

Still the importer is not working and throwing this error.

Importing data using LiferaySecurityAdvisoriesImporter
INFO Starting import for LiferaySecurityAdvisoriesImporter
ERROR Error in Liferay pipeline: cannot access local variable 'data' where it is not associated with a value
Traceback (most recent call last):
  File "/Users/rishigarg/Downloads/pullreq2/vulnerablecode/vulnerabilities/management/commands/import.py", line 70, in import_data
    ImportRunner(importer).run()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "../vulnerablecode/vulnerabilities/import_runner.py", line 61, in run
    count = self.process_advisories(advisory_datas=advisory_datas, importer_name=importer_name)
  File "../vulnerablecode/vulnerabilities/import_runner.py", line 101, in process_advisories
    for data in advisory_datas:
                ^^^^^^^^^^^^^^
  File "../vulnerablecode/vulnerabilities/pipelines/liferay_advisories.py", line 212, in advisory_data
    raise
RuntimeError: No active exception to reraise
Failed to run importer LiferaySecurityAdvisoriesImporter. Continuing...
CommandError: 1 failed!: LiferaySecurityAdvisoriesImporter

I would recommend you to first run the importer on your local machine and check in your database whether the advisories are imported or not. You can make the super user via python manage.py createsuperuser command and then login to the database models via /admin endpoint. You can run the command python manage.py import --list to get the list of all the importer and then run the command python manage.py import Importer_name in order to run the importer.

@Rishi-source

Copy link
Copy Markdown

I have tested this branch locally and it is passing all the tests but there Checks are failing on github.

One reason is because of which your test are failing on github is that you have added a new python library fake_useragent and while installing dependencies no fake_useragent library is being installed because of which importer fails in the initial stages. I would recommend you to either add the required library in requirements.txt file or make the importer just like other importers without using this library.

Signed-off-by: Shrish0098 <shrish409@gmail.com>
@Dedsec0098

Copy link
Copy Markdown
Author

@Rishi-source We don't need to use these commands because it will make the process unnecessarily complicated by creating a super user. You can just make your own virtual environment by using this command source venv/bin/activate and then use command ./manage.py improve your_pipeline_name to test the pipeline and it will give you the following results.

Improving data using liferay_advisories
INFO 2025-03-07 04:55:28.947 Pipeline [LiferayAdvisoryPipeline] starting
INFO 2025-03-07 04:55:28.947 Step [fetch_advisories] starting
INFO 2025-03-07 04:55:32.410 Response size: 360887 bytes
INFO 2025-03-07 04:55:32.411 Step [fetch_advisories] completed in 3 seconds
INFO 2025-03-07 04:55:32.412 Step [parse_advisories] starting
INFO 2025-03-07 04:55:32.477 Found 146 potential CVE mentions
INFO 2025-03-07 04:55:32.477 Successfully parsed advisory for CVE-2024-25148
INFO 2025-03-07 04:55:32.478 Successfully parsed advisory for CVE-2023-44311
INFO 2025-03-07 04:55:32.478 Successfully parsed advisory for CVE-2023-33941
INFO 2025-03-07 04:55:32.478 Successfully parsed advisory for CVE-2022-42128
INFO 2025-03-07 04:55:32.478 Successfully parsed advisory for CVE-2022-42116
INFO 2025-03-07 04:55:32.478 Successfully parsed advisory for CVE-2021-33321
INFO 2025-03-07 04:55:32.479 Successfully parsed advisory for CVE-2021-33328
INFO 2025-03-07 04:55:32.479 Step [parse_advisories] completed in 0 seconds
INFO 2025-03-07 04:55:32.479 Step [collect_and_store_advisories] starting
INFO 2025-03-07 04:55:32.479 Collecting 7 advisories
INFO 2025-03-07 04:55:32.524 Successfully collected 7 advisories
INFO 2025-03-07 04:55:32.524 Step [collect_and_store_advisories] completed in 0 seconds
INFO 2025-03-07 04:55:32.524 Step [import_new_advisories] starting
INFO 2025-03-07 04:55:32.626 Importing 7 new advisories
INFO 2025-03-07 04:55:32.795 Successfully imported 7 new advisories
INFO 2025-03-07 04:55:32.795 Step [import_new_advisories] completed in 0 seconds
INFO 2025-03-07 04:55:32.795 Pipeline completed in 4 seconds

@Dedsec0098

Copy link
Copy Markdown
Author

Hey @pombredanne I have made the changes and all the test are passing successfully i my local machine. If you have any suggestions please let me know I will make the changes required.

@keshav-space keshav-space added the vibe-code Completely AI-generated code label Mar 20, 2025
@pombredanne

Copy link
Copy Markdown
Member

@Dedsec0098 This is not actionable until tested with code. Please take the push tests for your code and stop submitting code that does not run and is AI-generated, wasting precious review time from the maintainers.

If you are able to submit code that is minimally tested and does run and is not AI generated, come back, but only then with a new PR.
I am going to close all your other PRs for the same reason

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

Labels

vibe-code Completely AI-generated code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Liferay advisories

4 participants