Skip to content

fix(ttx): close endorsement sessions on all return paths#1893

Open
AkramBitar wants to merge 1 commit into
mainfrom
fix/1637-structured-cleanup-collectendorsements
Open

fix(ttx): close endorsement sessions on all return paths#1893
AkramBitar wants to merge 1 commit into
mainfrom
fix/1637-structured-cleanup-collectendorsements

Conversation

@AkramBitar

@AkramBitar AkramBitar commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #1637.

cleanupAudit only ran after distribution succeeded, so a failure in a later phase (requestApproval or distributeTxToParties) returned from CollectEndorsementsView.Call early and left the auditor session open — a repeatable leak of the FSC communication session on every error path (hence the security label).

Note: this does not hold any audit-DB enrollment-ID lock. That lock lives on the auditor node and is released by Append's defer Release() before the auditor signature is sent back — i.e. before requestAudit returns — so it is already released by the time any later phase can fail. The bug is strictly a leaked session handle.

Fix: close all endorsement sessions in CollectEndorsementsView.Call via a deferred, idempotent cleanupSessions (safe on repeated calls and on any return path); add TTX unit tests.

@AkramBitar AkramBitar self-assigned this Jul 10, 2026
@AkramBitar AkramBitar added security enhancement New feature or request labels Jul 10, 2026
@AkramBitar AkramBitar added this to the Q3/26 milestone Jul 10, 2026
@AkramBitar AkramBitar linked an issue Jul 10, 2026 that may be closed by this pull request
@AkramBitar AkramBitar force-pushed the fix/1637-structured-cleanup-collectendorsements branch from 9deda07 to bbf499d Compare July 10, 2026 22:16
@AkramBitar AkramBitar requested a review from adecaro July 10, 2026 22:18
Signed-off-by: AkramBitar <akram@il.ibm.com>
@adecaro adecaro force-pushed the fix/1637-structured-cleanup-collectendorsements branch from bbf499d to 4885897 Compare July 13, 2026 16:33

@adecaro adecaro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Structured Failure Handling and Resource Cleanup [MED]

2 participants