You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "karthikchundi-commits (via GitHub)" <gi...@apache.org> on 2026/09/15 11:48:02 UTC

[PR] Reject party/role combinations the party does not hold for TimesheetRole and RequirementRole [ofbiz-framework]

karthikchundi-commits opened a new pull request, #2006:
URL: https://github.com/apache/ofbiz-framework/pull/2006

   ## Summary
   
   `createTimesheetRole` and `createRequirementRole` have the identical unvalidated-PartyRole gap already fixed for TaxAuthority (#1692), Invoice/BillingAccount/FinAccount roles (#1727), and BudgetRole (#1736): a free-choice RoleType dropdown (`AddTimesheetRole` in `TimesheetForms.xml`, `AddRequirementRole` in `RequirementForms.xml`) feeding straight into an unconditional `ensurePartyRole` invoke-eca, so any party/role combination is silently accepted and a spurious `PartyRole` gets fabricated even when the party doesn't already hold that role.
   
   Both forms submit directly to their respective create service, and neither service has any other caller anywhere in the codebase (verified with a search across XML, Groovy, and Java — not just the immediate eca/form pair). That makes the fix a direct mirror of the already-merged/reviewed pattern: an `in-validate` eca calling the existing `checkPartyRoleExists` service before the `invoke` eca that runs `ensurePartyRole`.
   
   No JIRA ticket filed for this one specifically — found via a source-reading sweep for the same bug shape after the sibling PRs, rather than a separate bug report. Happy to file one if that's preferred before review.
   
   ## Scope note — two related findings deliberately NOT included here
   
   While sweeping for this pattern, two more services turned up with the same free-choice "assign role" form: `createContentRole` and `createQuoteRole`. Neither is included in this PR, because both are **also** the actual mechanism their own components use internally to legitimately grant a brand-new role to a party that doesn't hold it yet:
   
   - `createContentRole` is called by `ContentManagementServices.java`'s `updateSiteRoles`/`addRoleToUser` to bootstrap a user's first-time site access.
   - `createQuoteRole` is called by `QuoteServicesScript.groovy` to assign `REQ_TAKER`/`INTERNAL_ORGANIZATIO` when a quote is created, and to copy roles when a customer request converts to a quote.
   
   A blanket `in-validate` eca on either service would reject those legitimate internal grants along with the real vulnerability in their respective "assign role" forms. Fixing those two properly needs validation scoped to the form-submission path rather than the service itself, which is a different (and more careful) change — flagging here in case it's worth a separate ticket, rather than silently dropping the finding or risking a regression by rushing a blanket fix into this PR.
   
   ## Testing
   
   - `applications/workeffort/servicedef/secas.xml`, `applications/order/servicedef/secas.xml`, and `applications/workeffort/testdef/workefforttests.xml` all validate against their real XSD schemas (`xmllint --schema`).
   - Added `TimesheetRoleTests` (new file) and two tests to the existing `OrderRequirementTests`, both following the established pattern from the BillingAccount/FinAccount fixes: a negative case using `DemoCustomer` + `CARRIER` (a role its seeded `PartyRole` set — `BILL_TO_CUSTOMER`/`CONTACT`/`CUSTOMER`/`END_USER_CUSTOMER`/`PLACING_CUSTOMER`/`SHIP_TO_CUSTOMER` — provably does not include) and a positive case using a role it already holds.
   - `./gradlew compileTestGroovy checkstyleMain checkstyleTest codenarcMain codenarcTest` — all `BUILD SUCCESSFUL`.
   - No running OFBiz + DB instance available in this environment to execute the Groovy tests end-to-end — disclosed honestly, same limitation as the prior PRs in this series.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org