Skip to content

Conversation

@tushar912
Copy link
Contributor

Fixes #287 by @sbs2001

Description

I have added importer and tests for elixir security

@tushar912 tushar912 changed the title Elixir Elixir Security Importer Dec 5, 2020
Copy link

@steven-esser steven-esser left a comment

Choose a reason for hiding this comment

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

@tushar912 Just a few formatting and stylistic comments.

Also, please squash your minor commits into a single and write a descriptive commit message.

This helps future developers understand what exactly was added or changed when looking at the history.

Thanks for your contribution!

@sbs2001
Copy link
Collaborator

sbs2001 commented Dec 9, 2020

Thanks ! @tushar912 I've done a light review for now, see comments inline. I'll do another review once this is resolved.

Signed-off-by: Tushar912 <tushar.912u@gmail.com>

add elixir security to init.py

Signed-off-by: Tushar912 <tushar.912u@gmail.com>

add test for elixir security

Signed-off-by: Tushar912 <tushar.912u@gmail.com>

fixed code style

Signed-off-by: Tushar912 <tushar.912u@gmail.com>
Signed-off-by: Tushar912 <tushar.912u@gmail.com>
@tushar912 tushar912 requested a review from sbs2001 December 9, 2020 10:31
version_list.append(release["version"])
return version_list

def get_pkg_from_range(self, version_list, pkg_name):
Copy link
Collaborator

Choose a reason for hiding this comment

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

The function says get_pkg_from_range but returns a version list

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is get_versions_from_range better

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes

Signed-off-by: Tushar912 <tushar.912u@gmail.com>
Signed-off-by: Tushar912 <tushar.912u@gmail.com>
@tushar912 tushar912 requested a review from sbs2001 December 12, 2020 08:51
@sbs2001
Copy link
Collaborator

sbs2001 commented Dec 17, 2020

@tushar912 btw after the rebase :

  1. Add your name to https://github.com/nexB/vulnerablecode/blob/main/AUTHORS.rst
  2. Add details of the importer to https://github.com/nexB/vulnerablecode/blob/main/SOURCES.rst

@tushar912
Copy link
Contributor Author

@sbs2001 should i fetch the latest changes and resolve the conflicts

@tushar912
Copy link
Contributor Author

I think you have added a load_yaml function in helpers. I may need it.

@sbs2001
Copy link
Collaborator

sbs2001 commented Dec 18, 2020

@tushar912

@sbs2001 should i fetch the latest changes and resolve the conflicts

Yes !

I think you have added a load_yaml function in helpers. I may need it.

That will be great use it :) .

Signed-off-by: Tushar912 <tushar.912u@gmail.com>
Copy link
Collaborator

@sbs2001 sbs2001 left a comment

Choose a reason for hiding this comment

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

Thanks @tushar912 for your patience, we're almost done see my comments inline

@sbs2001
Copy link
Collaborator

sbs2001 commented Dec 19, 2020

@tushar912 what is b0e9451 ?

used load_yaml from helpers

Signed-off-by: Tushar912 <tushar.912u@gmail.com>

fix typo in importer

Signed-off-by: Tushar912 <tushar.912u@gmail.com>
@tushar912
Copy link
Contributor Author

@sbs2001 i have reworded that

Signed-off-by: Tushar912 <tushar.912u@gmail.com>
@tushar912 tushar912 requested a review from sbs2001 December 21, 2020 21:19

return packages

def get_versions_from_range(self, version_list, pkg_name):
Copy link
Collaborator

@sbs2001 sbs2001 Dec 22, 2020

Choose a reason for hiding this comment

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

A comment or docstring would be very helpful here.

Actually this function doesn't make sense it's called get_versions_from_range but the parameters don't have suggest any sort of range

Copy link
Collaborator

Choose a reason for hiding this comment

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

Plus the name of package is required, which the name of the function doesn't suggest

Copy link
Contributor Author

@tushar912 tushar912 Dec 22, 2020

Choose a reason for hiding this comment

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

should I rename it as get_versions_for_pkg_from_range_list. I would rename the parameter version_list to version_range_list. I would make sure to add comment also

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's verbose, but fine by me :) . A better design would be to decouple the obtaining of all versions of package from categorising the versions.

Signed-off-by: Tushar912 <tushar.912u@gmail.com>
@tushar912 tushar912 requested a review from sbs2001 December 22, 2020 21:25
from packageurl import PackageURL

from vulnerabilities.data_source import GitDataSource
from vulnerabilities.data_source import GitDataSourceConfiguration
Copy link
Collaborator

Choose a reason for hiding this comment

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

This import is not required

yaml_file["unaffected_versions"] = []

safe_pkg_versions, vuln_pkg_versions = self.get_versions_for_pkg_from_range_list(
yaml_file.get("patched_versions") + yaml_file.get("unaffected_versions"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need for get now

Copy link
Collaborator

@sbs2001 sbs2001 left a comment

Choose a reason for hiding this comment

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

@tushar912 This PR can be merged after fixing the few nits I've suggested.

Also add your name in the CONTRIBUTING.rst.

@tushar912
Copy link
Contributor Author

@sbs2001 what should I write in ecosystems covered in SOURCES.rst for this importer.

@sbs2001
Copy link
Collaborator

sbs2001 commented Dec 25, 2020

@tushar912 the ecosystem would be hex packages

@tushar912 tushar912 requested a review from sbs2001 December 25, 2020 14:10
@tushar912
Copy link
Contributor Author

@sbs2001 I have made the changes

SOURCES.rst Outdated
+----------------+------------------------------------------------------------------------------------------------------+----------------------------------------------------+
|postgresql | https://www.postgresql.org/support/security/ |postgresql |
+----------------+------------------------------------------------------------------------------------------------------+----------------------------------------------------+
|elixir_security | https://github.com/dependabot/elixir-security-advisories' |hex packages |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the single quote at end of the url

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh Sorry I missed it.I will make the change

Signed-off-by: Tushar912 <tushar.912u@gmail.com>

remove single quote at end of url

Signed-off-by: Tushar912 <tushar.912u@gmail.com>
Copy link
Collaborator

@sbs2001 sbs2001 left a comment

Choose a reason for hiding this comment

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

LGTM ! Thanks @tushar912 I'm merging this :)

@sbs2001 sbs2001 merged commit 9897939 into aboutcode-org:main Dec 29, 2020
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.

Collect Elixir security advisories

3 participants