-
Notifications
You must be signed in to change notification settings - Fork 25
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
Product Changes | PDF Download Button #104
Conversation
Development merge for LocalStack support
Just had a little time to take a quick look at the code itself before I write some tests.
should be more like
|
vince/views.py
Outdated
else: | ||
prods = list(VendorProduct.objects.all().values_list('name', flat=True)) | ||
|
||
print('prods: ', prods) |
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.
Don't use debug prints use logger always.
@sei-vsarvepalli Do you have an example in the code currently reflecting your suggestion to question (3)? So far the database calls for other views/models appear to be done similarly to what we've written. I worry about our timeline here in pushing these features into production by May 1st. Another concern I have is data migration testing of these product features when they are put into production. How will currently saved products in existing CVE details be handled when our changes are implemented? Will you and your team be able to handle that? Will follow up via email as well. |
For simplifying Products management An example could be the the method Line 474 in e6d1088
BTW - it is not in critical path for code implementation itself. _On current data migration for Products _ I am assuming it will just be ignored from a quick view of your code. They will not be in the Products DB until, an edit and change of the Product. I have not tested it. |
- Use multi-line JavaScript comments for minify script - Remove URLs as hard-coded and use HTML data-attributes - Send dictionary from ajax_calls, avoid array/list to allow for extensions - Check to see if GET parameter is useable
Running some Tests against the database. Some UI issues found in click tester from Chrome. The Products already added cannot be modified. May consider "onfocus=blur" on those rows. Same can be applied for the CWE rows to reduce confusion on editing already added CWE's with new autocomplete entries. |
@sei-vsarvepalli Could you clarify the issue that you are seeing? On our end everytime we seek to edit a product we are able to on our end. And that should be allowed as far as we understand, because products entered in, a coordinator or even a vendor could make a mistake that needs to be fixed. Or affected products of a CVE may need to be updated. |
It looks like there are a few problems with VINCE/vince/static/vince/js/cve.js Lines 78 to 109 in 70806f9
Will have to rewrite the On HTML elements inline Javascript will fail on the AWS side as the CSP headers will block these too. Don't use onchange/onclick event handlers inside the HTML elements. These should all be triggered from document.ready() with bind or jQuery.on event handlers. Line 2367 in 70806f9
I will update in a couple of days with new code. |
|
||
sector = ArrayField( models.CharField( max_length = 50 ), blank = True, null = True ) | ||
|
||
uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True) |
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.
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.
I was not aware that unique_together was a thing, but that makes sense. In that case, would we need to change this to be UUIDv5? I believe UUIDv5 is deterministically calculated based on the combination of organization and name or does the UUID library somehow do this with UUIDv5?
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.
No need to move to UUIDv5 - just the uniqueness can be enforced. Should the uniqueness be also be case insensitive? I can take care of the updates in the code.
for example "Vendor - newProduct" and "Vendor - NewProduct" should not be allowed - correct?
Verify from your ops to ensure that this is correct.
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.
Thank You,
@mstrad I believe this would be correct.
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.
Yes I believe that's correct
vince/views.py
Outdated
organization=contact[0].vendor_name)) | ||
|
||
#check if vendorProduct exists, if not create it. | ||
checkprod = VendorProduct.objects.filter(name = cd['cve_affected_product']) |
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.
Shouldn't this check for organization match as well? like below
checkprod = VendorProduct.objects.filter(name = cd['cve_affected_product'], organization=contact[0])
Preferably
checkprod = VendorProduct.objects.filter(name__iexact = cd['cve_affected_product'], organization=contact[0])
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.
Few bugs found when running further Test Cases against VendorProduct with multi vendors. A duplicate product name under two vendors causes Null-Property reference exception. On delete the cascade will also fail.
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.
Shouldn't this check for organization match as well? like below
checkprod = VendorProduct.objects.filter(name = cd['cve_affected_product'], organization=contact[0])
Preferably
checkprod = VendorProduct.objects.filter(name__iexact = cd['cve_affected_product'], organization=contact[0])
Yes, it should be!
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.
Few bugs found when running further Test Cases against VendorProduct with multi vendors. A duplicate product name under two vendors causes Null-Property reference exception. On delete the cascade will also fail.
I guess it makes sense why it is failing, because there is a single VendorProduct table with reference to contact_fk and no uniqueness is built into that table property ['name']
I wonder how to solve this? Accessing UUID instead of name fields? Prepending the contact['name'] to a vendorproduct['name'] so ACME_Product1 when saving?
Then when displaying or modifying the name break the string on contact['name']_ ?
Or add a different another property as this above and keeping the ['name'] field?
Based on your feedback, I can spend some time working on a patch tomorrow for both this and what I can come up with for org_auto above.
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.
@z-priest Don't bother more development, Part of the testCases suggest some patches. I will apply and run the test cases again and push updates later. This way we can avoid duplicate work as it is hard to push test outputs to you in our current setup.
- Add unique_together for name+organization under VendorProduct - Check uniqueness of VendorProduct caseInsensitive - Convert org_auto and cwe_auto to Factory pattern - Merge <label> fields for multiple-row fields with disitinct id's to support accessibility - Bugs in CWE lookup - Added Cached lookup for CWE and Products with same filters.
After the 6e12387 push one problem remains, on change trigger to clear and repopulate autocomplete. |
It looks like the problem is related to redirect issue in the server side Line 10519 in 6138197
Fix is
|
This code is now running as v2.0.8 in AWS for testing. Chrome click testing in progress. |
Current gaps observed by users, coordinators/operators and vendor-meeting feedback
Related urls from CVE Program and CSAF issues: |
Just came out yesterday from oss-security pointed out by @laurie-tyz - May consider this with 2.1.1 release candidate for Monday May 8th https://www.djangoproject.com/weblog/2023/may/03/security-releases/ |
This PR contains the working prototype implementation of the following features:
Issue #70
Issue #67