Address reported security issues in the panoramapublic module#655
Open
vagisha wants to merge 2 commits into
Open
Address reported security issues in the panoramapublic module#655vagisha wants to merge 2 commits into
vagisha wants to merge 2 commits into
Conversation
* The three actions (SetupMockNcbiService, RestoreNcbiService, RegisterMockPublication) swap a process-wide service and were reachable on production via a forge-able GET (ReadOnlyApiAction does no CSRF check), despite @RequiresSiteAdmin * Added requireDevModeForMockNcbiService(): the actions now return 404 in non-dev mode * Changed actions to MutatingApiAction (correct type for state mutation; also enforces a CSRF token) * Updated PublicationSearchTest to use SimplePostCommand; verified passing with the mock (POST path) and against real NCBI Co-Authored-By: Claude <noreply@anthropic.com>
…od) from ExperimentModificationGetter.TestCase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
A security review of the panoramapublic module identified three issues. Two are addressed here. The third is noted below as out of scope by decision.
Changes
Test actions globally swap the NcbiPublicationSearchService singleton with no audit event (Informational)
SetupMockNcbiServiceAction,RestoreNcbiServiceAction,RegisterMockPublicationAction) swap a process-wide singleton. They are @RequiresSiteAdmin but otherwise reachable in production, and extended ReadOnlyApiAction, which does no CSRF check and is reachable by a plain GET.requireDevModeForMockNcbiService(): the actions now return 404 on a non-dev-mode server. Dev machines and TeamCity run in dev mode, so tests are unaffected.ReadOnlyApiActiontoMutatingApiAction, since they mutate global state, which also requires a POST with a CSRF token.Uses System.out instead of Log4J2 (Informational)
ExperimentModificationGetter: removed System.out helpers printStructuralMod and printIsotopicMod and their call sites.Tests
PublicationSearchTest: invoke the three mock-NCBI actions withSimplePostCommandinstead ofSimpleGetCommand.Not in scope (by decision)