Repository navigation
fix: webhook project scoping, OAuth request state, no-op transactions, view child posts and delete events - #289
Merged
Conversation
…, view child posts and delete events - Webhook lookups return the owning project, so a posted id that belongs to another project is refused; the persistence layer refuses it as well. - OAuthProcessor keeps the parsed token grants in a local variable instead of a field shared by all requests. - FederatedNodePersistence.commitChanges opens its transaction only when there is something to save, so a write that changes nothing leaves none open. - DefaultNodeService.createOrUpdate iterates a copy of the updated map, since view services add generated elements to it while processing. - DefaultNodeService.delete publishes the commit event like createOrUpdate. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
HuiJun
approved these changes
Nov 17, 2026
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.
Summary
Fixes five defects in code that has been on
developsince the persistence refactor and has not been released yet. Four were reproduced against a runningdevelopbuild before the change; the OAuth one was fixed from reading the code.Webhooks (
WebhooksController,FederatedWebhookPersistence)develop:FederatedWebhookPersistence.findById/findByProjectIdAndUrlreturned aWebhookJsonwithout_projectId. Posting a webhook with an existing id returned 500 (NullPointerExceptioninwebhookExists), and re-posting an existing URL returned 400 "Cannot move webhooks between projects".NullPointerException:savelooked the webhook up by id without checking its project.webhookExistsreturns an id match even when it belongs to another project so the controller answers 400, andsaveitself refuses an id owned by another project.OAuth (
OAuthProcessor)grantswas a field on a singleton bean, written and read duringvalidateAuthToken, so concurrent validations could read each other's grants. It is now a local variable.No-op writes (
FederatedNodePersistence.commitChanges)toSaveNodeMap.isEmpty()check and never completed on the empty path. Ondevelop, deleting elements that do not exist left connectionsidle in transaction, and a later request handled by one of those threads (a project creation) returned 200 without its data being committed.View posts (
DefaultNodeService.createOrUpdate)CameoViewService/MsosaViewServiceadd generated properties and associations tochanges.getUpdatedMap()fromextraProcessPostedElement, whilecreateOrUpdatewas iterating that map. Posting a view with_childViewstogether with other elements returned 500 (ConcurrentModificationException). The loop now iterates a copy.Deletes (
DefaultNodeService.delete)deletedid not publish the commit event thatcreateOrUpdatepublishes, so webhooks were not called for deletions. It now publishes it when something was deleted.Testing
DefaultNodeServiceTest,FederatedNodePersistenceTest,FederatedWebhookPersistenceTest. Run against the unchanged production code, the tests for each defect fail; with the fixes all pass, along with the rest of./gradlew test.developbuild were rerun against a build of this branch (PostgreSQL, Elasticsearch 9.5.6): a foreign webhook id returns 400 and the original webhook is unchanged, update by id and re-post of an existing URL return 200, a webhook listener receives the delete event, the_childViewspost returns 200, and 60 concurrent no-op deletes leave no connectionidle in transaction.Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/d9f10869eb3d4b268da3834fb1b42689
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/d9f10869eb3d4b268da3834fb1b42689?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings