+
Skip to content

Conversation

svonworl
Copy link
Contributor

Description
This PR removes the auth check from AliasHelper.addWorkflowVersionAliasesAndCheck that was causing the problem described in https://ucsc-cgl.atlassian.net/browse/SEAB-6831

Basically, the auto DOI generation code was calling addWorkflowVersionAliasesAndCheck, which was throwing when a bot pushed, because no Dockstore user was present, so the "can the user write to the workflow" check failed. This exception was caught, meaning that the DOI was created, but since the alias generation code failed, no alias was saved to the db. So, the Dockstore alias link in the DOI didn't work when clicked upon.

When removing an auth check, the big danger is that you accidentally open a security hole. So, I tried to analyze the execution paths, and, on the "manual DOI generation" path, I've added a necessary equivalent check, further "upstream" (earlier). Everywhere else, I think, either the user has already been confirmed to be able to write to the workflow, or the webservice is initiating an automatic generation. Please do your own analysis to make sure.

Given the hotfix target and the sensitivity of the code, this is a minimal bug fix, and as such, I didn't clean up now-unused parameters, try to restructure for clarity, or anything like that.

Given our current testing infra, user testing might be best, ala:

  1. deploy to staging
  2. enable auto DOI generation on some workflows
  3. do a bot push of a tag, confirm that the generated DOI contains a valid alias link that resolves to the version's page on Dockstore
  4. do a regular push on a different tag, and check the DOI and link similarly

Review Instructions
See steps above.

Issue
https://ucsc-cgl.atlassian.net/browse/SEAB-6831

Security and Privacy

We are mucking with auth checks, please scrutinize to make sure we're still checking everywhere we should.

  • Security and Privacy assessed

e.g. Does this change...

  • Any user data we collect, or data location?
  • Access control, authentication or authorization?
  • Encryption features?

Please make sure that you've checked the following before submitting your pull request. Thanks!

  • Check that you pass the basic style checks and unit tests by running mvn clean install
  • Ensure that the PR targets the correct branch. Check the milestone or fix version of the ticket.
  • Follow the existing JPA patterns for queries, using named parameters, to avoid SQL injection
  • If you are changing dependencies, check the Snyk status check or the dashboard to ensure you are not introducing new high/critical vulnerabilities
  • Assume that inputs to the API can be malicious, and sanitize and/or check for Denial of Service type values, e.g., massive sizes
  • Do not serve user-uploaded binary images through the Dockstore API
  • Ensure that endpoints that only allow privileged access enforce that with the @RolesAllowed annotation
  • Do not create cookies, although this may change in the future
  • If this PR is for a user-facing feature, create and link a documentation ticket for this feature (usually in the same milestone as the linked issue). Style points if you create a documentation PR directly and link that instead.

@svonworl
Copy link
Contributor Author

We could also cherrypick this to develop and deploy to qa, so that we can user test bot pushes and results there, before releasing/deploying to staging.

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.52%. Comparing base (ceff85c) to head (e2f1d2c).
Report is 2 commits behind head on hotfix/1.16.4.

Additional details and impacted files
@@               Coverage Diff                @@
##             hotfix/1.16.4    #6057   +/-   ##
================================================
  Coverage            74.52%   74.52%           
  Complexity            5506     5506           
================================================
  Files                  381      381           
  Lines                19800    19801    +1     
  Branches              2044     2044           
================================================
+ Hits                 14756    14757    +1     
  Misses                4065     4065           
  Partials               979      979           
Flag Coverage Δ
bitbuckettests 26.64% <0.00%> (-0.01%) ⬇️
hoverflytests 27.91% <50.00%> (-0.05%) ⬇️
integrationtests 56.77% <0.00%> (-0.01%) ⬇️
languageparsingtests 11.04% <0.00%> (-0.01%) ⬇️
localstacktests 21.55% <0.00%> (-0.01%) ⬇️
toolintegrationtests 30.01% <0.00%> (-0.01%) ⬇️
unit-tests_and_non-confidential-tests 25.83% <0.00%> (-0.01%) ⬇️
workflowintegrationtests 38.04% <75.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

* @return the Workflow Version
*/
public static WorkflowVersion addWorkflowVersionAliasesAndCheck(AuthenticatedResourceInterface authenticatedResourceInterface, WorkflowDAO workflowDAO,
public static WorkflowVersion addWorkflowVersionAliases(AuthenticatedResourceInterface authenticatedResourceInterface, WorkflowDAO workflowDAO,
Copy link
Collaborator

Choose a reason for hiding this comment

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

authenticatedResourceInterface and workflowDAO parameters are now unused, you can remove them.

Can't comment directly there in the PR, but JavaDoc could be updated -- the overview (no longer only works for the owner of the entry), the user description, and remove the unused params if you remove them from code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

authenticatedResourceInterface and workflowDAO parameters are now unused, you can remove them.

Can't comment directly there in the PR, but JavaDoc could be updated -- the overview (no longer only works for the owner of the entry), the user description, and remove the unused params if you remove them from code.

Sure, I updated the javadoc comment.

I didn't remove the unused params on purpose, because the changes ripple a ways up through the call stack, and I didn't want the diffs to cloud this PR, given that it's a hotfix. I will write a ticket to clean up, which should probably happen on develop after the hotfix branch merges, could actually be best done as a slightly-bigger refactor, some of the params could change type...

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@svonworl svonworl merged commit 92b8150 into hotfix/1.16.4 Dec 18, 2024
18 of 20 checks passed
@svonworl svonworl deleted the feature/seab-6831/problems-creating-doi-alias-for-bot-push-take-2 branch December 18, 2024 00:54
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.

4 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载