-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
2.5.0 regression: SortedSet
assumes comparability of members, but Vulnerability
model is not comparable
#245
Comments
If I'm right, the only fix needed here is to add a Edit: Looking at the model more closely, it's not clear to me what the sorting semantics should be -- nearly every field is optional, and many are lists (which means that comparing between instances might entail comparing overlapping ranges, which is both unlikely to be semantically coherent and has bad worst-case performance). |
@woodruffw - thanks for reporting this - let me take a look. In the mean time, are you able to pin your usage to |
Thanks for looking into it!
Yep, and I've confirmed that doing so avoids the bug. |
Ah! I'm not sure how I missed that. I thought I'd covered all classes that are used in a SortedSet.
It looks like
I would suggest sort order for Vulnerability: id, description, detail, source, created, published |
Regarding a camparator on the model, here are my 2ct: |
Partial fix for CycloneDX#245. Signed-off-by: Rodney Richardson <[email protected]>
I've added a partial fix (#246), that should work in this particular situation (when credits are not set). I'm afraid I don't have time to work on this in the next week. |
Thanks @RodneyRichardson! FWIW, I'd suggest yanking the current release ( |
Partial fix for #245. Signed-off-by: Rodney Richardson <[email protected]>
my 2ct: i do not see sorted lists as a breaking change but a bachwards compatible feature. no method signatures (api) was changed backwards-incompatible. Some return types did change in backwards-compatible manner, the returned content did not change in its meaning. What is your POV? Are there breaking changes for you? |
To clarify: the breaking change I meant wasn’t the new APIs, but the fact that the current APIs stopped working when upgrading between 2.4.0 and 2.5.0 (specifically, the Vulnerability model couldn’t be used with the other APIs that it was intended with.)
In particular, pip-audit assumes the stability of the API in the 2.x series, so users who try to install it and use SBOM generation currently can’t do so. Without a yank, we’d have to explicitly carve out 2.5.0 in the range of supported versions.
Sent from mobile. Please excuse my brevity.
… On Jun 11, 2022, at 2:07 AM, Jan Kowalleck ***@***.***> wrote:
Thanks @RodneyRichardson!
FWIW, I'd suggest yanking the current release (2.5.0) from PyPI -- IMO the regression here violates SemVer's minor version rules, so users with semantic ranges might experience breakage.
my 2ct: i do not see sorted lists as a breaking change but a bachwards compatible feature. no method signatures (api) was changed, the return types did not change, the returned content did not change.
The content of sets are commutative: order of these data never mattered, no matter if a component is listed first or last as long as it is in the list(set).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
Just saw your edit 🙂 — the specific breakage we saw in pip-audit is the code in the initial comment, which works in 2.4.0 but crashes in 2.5.0. As a result, any user who currently installs pip-audit and uses CycloneDX for SBOM generation will currently see an error, since we had an open SemVer range that allows 2.5.0.
Sent from mobile. Please excuse my brevity.
… On Jun 11, 2022, at 10:49 AM, William Woodruff ***@***.***> wrote:
To clarify: the breaking change I meant wasn’t the new APIs, but the fact that the current APIs stopped working when upgrading between 2.4.0 and 2.5.0 (specifically, the Vulnerability model couldn’t be used with the other APIs that it was intended with.)
In particular, pip-audit assumes the stability of the API in the 2.x series, so users who try to install it and use SBOM generation currently can’t do so. Without a yank, we’d have to explicitly carve out 2.5.0 in the range of supported versions.
Sent from mobile. Please excuse my brevity.
>> On Jun 11, 2022, at 2:07 AM, Jan Kowalleck ***@***.***> wrote:
>>
>
> Thanks @RodneyRichardson!
>
> FWIW, I'd suggest yanking the current release (2.5.0) from PyPI -- IMO the regression here violates SemVer's minor version rules, so users with semantic ranges might experience breakage.
>
> my 2ct: i do not see sorted lists as a breaking change but a bachwards compatible feature. no method signatures (api) was changed, the return types did not change, the returned content did not change.
> The content of sets are commutative: order of these data never mattered, no matter if a component is listed first or last as long as it is in the list(set).
>
> —
> Reply to this email directly, view it on GitHub, or unsubscribe.
> You are receiving this because you were mentioned.
|
I agree - I don't think it's a breaking change in the API, but I think it's a broken release that should be recalled. Sorry I don't have time to add |
reviewed all classes that are pumped into a |
Thanks a ton for the patch release! I don't want to be a nag about the yank, but IMO the sooner the better 🙂 -- most users are unlikely to hit it now that there's a patch version, but those who do (and have similar codepaths to |
@jkowalleck It looked like |
what am i missing, @RodneyRichardson ? however, will come up with PR to add the method to both, soon. |
Ah - I didn't have access to the code when I wrote that - I think I was planning to have credits as part of the sort criteria for the Vulnerability (which would mean it needs a comparator) but I didn't. I guess we should check for use in the ComparableTuple too (but the tests should pick that up). |
I will leave everything as is, for now. Additional bug reports will show further need for tests or improvements. Therefore, i will close this issue, for now. See you next time, when we open the gates of this issue again, and continue our discussions :-) |
Hi there! Thanks a ton for this library.
We currently use it to generate SBOMs in
pip-audit
, and I noticed an interested regression upon upgrading to 2.5.0: it looks likeComponent.add_vulnerability
attempts to add the underlyingVulnerability
model to aSortedSet
, which in turn fails becauseVulnerability
doesn't appear to implement the standard comparable operators (e.g.__lt__
).Here's the failing code on our side, which worked in 2.4.0:
and the failing CI tests on 2.5.0: https://github.com/trailofbits/pip-audit/runs/6832431942?check_suite_focus=true
In my estimation, this looks like a bug/regression, rather than a SemVer breakage -- the
Vulnerability
model also comes from CycloneDX, so it probably should have been made comparable at the same time that comparability was assumed by introducingSortedSet
.xref pypa/pip-audit#292
The text was updated successfully, but these errors were encountered: