-
Notifications
You must be signed in to change notification settings - Fork 713
Add PDM parser #4234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add PDM parser #4234
Conversation
275c97b
to
c6a072c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks to be well on track already! I just thought I'd note you will want to add a function to create the cataloger and integrate it with the task selection, thanks for working on this!
Also make lint-fix
can help with static analysis failures.
24b5f4f
to
4bb1476
Compare
31b22ef
to
1db80a2
Compare
I see locally some failed unit tests, but it looks irrelevant to my changes.
It's hard to notice what is relevant :-/ |
@paulslaby you can safely ignore that test failure, as you noted I really don't think it is related to your changes, it seems like something I've probably caused and I don't think will be happening in CI. I'll try to get it sorted, but it shouldn't be a blocker for this PR.
|
This comment has been minimized.
This comment has been minimized.
fe2c6f3
to
7bf8766
Compare
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
7bf8766
to
31636f9
Compare
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
@kzantow I see one more issue i think it should be handled by me:
but what coverage does it expect? |
@paulslaby have a look at this test, you just need to add your newly created metadata:
|
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
@paulslaby it looks like there are some failing tests that are not related to your changes. I will have a look at this later today. Do you mind if I push to your branch? |
It's up to you :) wanna me rebase or something? |
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Hey @paulslaby I think I fixed up the test issue and the static analysis problem (schema file wasn't matching up). I had a couple notes: First, what is the purpose of the Second, it looks like files on the filesystem are referenced in the PDM file. There is a FileOwner interface that metadata can implement to return these files and indicate that the particular package "owns" them, in other words, there's a claim that the package manager is provided them. Various things happen with this information, but one is that vulnerability results can be better if, for example, one was a binary that was also surfaced by a different cataloger... the PDM package "owning" it can convey this. I think it might be better to include file references with hash values instead of just the hashes, this way it could also capture the FileOwner information and the hashes would be more useful. Last, it looks like the PDM files have dependency information in them. The catalogers return relationships with this information, users generally want this information to be surfaced, would you want to add this? Here's an example using utility functions. |
In the beginning I was thinking that this might be the way how syft manages URL dependencies. Now I am not sure, if we should parse package name from URL. Do you have a pattern for that already established? I will have a look iat the rest. Thank you for your feedback. |
@kzantow I implemented relationship parsing. but those can be conditional based on python version (or platform). You probably know, python lockfiles are not for one python version, but for constrained python version. Those conditions are currently ignored. Do you have a different opinion? |
Signed-off-by: Keith Zantow <kzantow@gmail.com> Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Keith Zantow <kzantow@gmail.com> Signed-off-by: Pavel Buchart <pavel@buchart.cz>
…#4246) Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
58f278c
to
eb0c58a
Compare
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
@paulslaby generally speaking, the philosophy of syft is to surface as much information as we find. In the case of conditional things, if there is a possibility that a dependency could be included, we generally would include this by default. For example: NPM currently includes devDependencies and Java currently includes test dependencies. I think the correct default behavior is to include the dependencies, regardless of python version constraints. I don't think this necessarily needs to be configurable as part of this PR, but we could an option to exclude things at a later time. Am I understanding the question correctly? |
@kzantow Yes, you understand it correctly. That's the way it working now. |
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
bde780c
to
6abc053
Compare
Signed-off-by: Pavel Buchart <pavel@buchart.cz>
Description
Adds parser for PDM dependency manager lockfile.
Type of change
Checklist:
I'll be honest, neither Go or Python is my primary language, but I am open to helping you. Please help me polish this PR so that it can eventually get merged into syft codebase.