Skip to content
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

Review comments won't be added for manually merged add-ons #3279

Open
nvdaes opened this issue Apr 18, 2024 · 15 comments
Open

Review comments won't be added for manually merged add-ons #3279

nvdaes opened this issue Apr 18, 2024 · 15 comments
Labels

Comments

@nvdaes
Copy link
Sponsor Contributor

nvdaes commented Apr 18, 2024

If someone submits an add-on which fails codeQl analysis, and NV Access merges it manually, the review URL won't be shown in the store.

@seanbudd
Copy link
Member

I think there needs to be a mechanism to create exceptions for certain add-on versions (i.e. like approved submitters, but for addon SHAs).
That way after manual approval the issue can be relabeled and handled automatically. Perhaps we could allow specific errors, but I think that's risky as context could change over time.

@nvdaes
Copy link
Sponsor Contributor Author

nvdaes commented Apr 18, 2024

In fact, I think that allowing errors is risky. Perhaps a workflow maybe created for create a review comment, then merge, then transform, with a workflow_dispatch event to be triggered manually.

@seanbudd
Copy link
Member

What do you think about the mechanism of allowing add-on version SHAs to bypass codeQL and virus total checks

@nvdaes
Copy link
Sponsor Contributor Author

nvdaes commented Apr 18, 2024

What do you think about the mechanism of allowing add-on version SHAs to bypass codeQL and virus total checksWhat do you think about the mechanism of allowing add-on version SHAs to bypass codeQL and virus total checks?

I don't understand this mechanism well, since a version is supposed to be submitted just once, an two version of different add-ons may be completely different.

@seanbudd
Copy link
Member

The idea is that when the submission fails, a PR is opened to add the SHA to a list of human reviewed submissions. If NV Access overrules the code scanning, the PR is merged. Then the issue can be relabeled, and the submission action can succeed.

@XLTechie
Copy link
Contributor

XLTechie commented Apr 18, 2024 via email

@nvdaes
Copy link
Sponsor Contributor Author

nvdaes commented Apr 18, 2024

The idea is that when the submission fails, a PR is opened to add the SHA to a list of human reviewed submissions. If NV Access overrules the code scanning, the PR is merged. Then the issue can be relabeled, and the submission action can succeed.

Ah, seems a good idea.

@nvdaes
Copy link
Sponsor Contributor Author

nvdaes commented Apr 18, 2024

Luke wrote:

It could check whether any merged add-on has no review URL, and if not, create one.

I think this may cause problems and unpredictable effects, since several calls to GitHub API to create discussions may be needed, and I remember that these multiple API calls didn't work for my tests.

@nvdaes
Copy link
Sponsor Contributor Author

nvdaes commented Apr 28, 2024

Another approach would be to create an "overruled" label to be applied to the PR opened when the issue was labelled. Then, the PR could be merged and further jobs maybe also called. In this way,relabelling the issue and closing the created PR with the add-on metadata wouldn't be needed. Also, pull request for overruled add-ons would hava a label to make easier to distinghish or search them on GitHub.
Also, a job to create a JSON file with data about overruled add-ons, like issue and PR number, sha256, id of publisher etc., maybe called too.

@seanbudd
Copy link
Member

Another approach would be to create an "overruled" label to be applied to the PR opened when the issue was labelled. Then, the PR could be merged and further jobs maybe also called. In this way,relabelling the issue and closing the created PR with the add-on metadata wouldn't be needed. Also, pull request for overruled add-ons would hava a label to make easier to distinghish or search them on GitHub.

I don't think this is a viable solution as it would allow users with labelling permissions to get around our security checks

@nvdaes
Copy link
Sponsor Contributor Author

nvdaes commented Apr 30, 2024

I don't think this is a viable solution as it would allow users with labelling permissions to get around our security checks

OK, I understand.

@nvdaes
Copy link
Sponsor Contributor Author

nvdaes commented Apr 30, 2024

I think we may use a custom composite action to check if the add-on is added to trustedAddons, since this may also be used for virusTotalAnalysys in the future, so creating an action to be used as a single step maybe much easier.
I think I'll try to create it, like I did with the used build-discussion action.

@nvdaes
Copy link
Sponsor Contributor Author

nvdaes commented May 1, 2024

I'mve started the creation of a composite action to be used as a single step when secure analysis (or, eventually, virus total in the future) fails.
For now it can read the sha256 of a file specified as an input, and add the sha256 with a value of true or false.
Later, my plan is to add another step in the composite action to create a PR if the add-on sha256 hasn't previously added.
The action, in its initial stage, can be found at

https://github.com/nvdaes/setTrustedNvdaAddons

@nvdaes
Copy link
Sponsor Contributor Author

nvdaes commented May 2, 2024

I comment here about my progress, in case this isnot the right direction.
For now, my composite action can add an array with sha256 of trusted add-ons, and create a PR.
I've thought to add a step in the CodeQL analysis job, to see if the sha256 of the current add-on is included in the array of trusted add-ons. If it's included, other stepsof the would be skipped.
If the analysis is performed and it fails, then aPR adding the sha256 to trusted add-ons will be created.
In this way, if the PR is merged and the issue is relabelled, code analysis will check that the add-on is trusted and further steps will be skipped.

@nvdaes
Copy link
Sponsor Contributor Author

nvdaes commented May 6, 2024

I'll try another approach after many tests. I think that when analysis has succeeded, the sha256 should also be added to a trustedAddons array in a file named trustedAddons.json. Then, merge master will deppend on a job named verifyTrustedAddons, which can check if the sha256 of the current submission is there. A trusted add-on can be added when analysis has been successful, and also if a created PR when analysis has failed is merged.

seanbudd pushed a commit that referenced this issue May 16, 2024
…3397)

Fixes issue #3279

Summary of the issue
When security analysis fails for an add-on, if the created pull request is merged manually, review comment and transform Actions aren't performed.

Development strategy
Created a reviewed.json file, to store addon ids with an array of sha256 of reviewed add-on versions.
The branch created for the add-on in the submission issue is checked out in the getAddonId job, to upload the add-on metadata json file as an artifact. This will be used by the securityAnalysis.js file to calculate the addonId and sha256, to be writen in the reviewed.json file if analysis fails.
If sha256 of the current submission is included in reviewedAddons.json, the workflow won't fail, so that mergeToMaster is run when the branch for the created issue is removed and the issue is relabelled.
If analysis fails, a PR including the sha256 to the reviewedAddons.json will be created, and a comment will be added to the submission issue showing the direct link to analysis results and more details about the process.
If that PR is merged, the authorIssuenumber Branch should be deleted and the issue relabeled to trigger a new workflow, this time with the sha256 of the add-on added to the reviewedAddons.json file.
After that, the analysis workflow won't fail and the mergeMaster and further Jobs Will be run.
As extra features arised during the development of this PR, paths to be validated are closed in quotation marks so that add-on ids with spaces are accepted, and the security analysis workflow includes an additional job to show non critical security errors to authors, which won't prevent the submission merge. To determine if these low severity errors (considered warnings) will be excluded, we use different configuration files available in the .github/codeql folder. The github/codeql-action/init action is used to determine the languages to be analyzed, and the configuration file to be used for each job.
In the first job, we exclude critical security errors and the analysis may fail. In the second one, the default configuration is used and the analysys won't file and won't prevent to merge submissions. Instead, warnings will be reported on the submission issue to be considered by authors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants