Skip to content

fix: report failed credential cleanup and close the save/cleanup race - #103

Merged
somethingwithproof merged 1 commit into
mainfrom
fix/credential-cleanup-review
Nov 20, 2026
Merged

somethingwithproof merged 1 commit into
mainfrom
fix/credential-cleanup-review

Conversation

@somethingwithproof

Copy link
Copy Markdown
Owner

Follow-up to #102, which was squash-merged before its last CodeRabbit review (on e6cc1d0) was settled.

  • Credential removal: SecretRepository::delete() ignored the DELETE result, so a failed removal was recorded in the audit log and reported as a successful save. The result now propagates through CredentialStore::forget(), and the page reports "The account was saved, but the stored credential could not be removed." without recording a credential change.
  • Save/cleanup race: valid but narrow (two admins editing one account at once). Request A (File) could delete the credential request B (Vault) had just stored. Instead of a lock around two helpers, cleanup is now one DELETE ... JOIN plugin_cloud_account ... credential_source <> 'vault', which is atomic and leaves nothing to interleave. A save that moved the account back to the vault keeps its credential; the audit entry is written only when the credential is actually gone.

Tests: unit tests for the result propagation and the statement shape (Pest, 303 pass). Translations for the new message in all five catalogs; locales/build_gettext.sh --check passes. The JOIN delete itself is not exercised against a real database by the existing integration suite.

SecretRepository::delete() discarded the DELETE result, so a failed
credential removal was audited and reported as a successful save. It now
returns the result, and the account page reports that the account was
saved but the credential could not be removed.

The cleanup also ran as a separate step after the save, so a concurrent
save that moved the account back to the vault could lose its new
credential. The cleanup is now one DELETE that skips accounts on the
vault.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d499ab4a-b668-4958-bb15-4417b3c22918
Commits

Reviewing files that changed from the base of the PR and between c342e44 and 82f6164.

Files selected for processing: 15

  • cloud_accounts.php
  • lib/CredentialStore.php
  • lib/SecretRepository.php
  • locales/LC_MESSAGES/ar-SA.mo
  • locales/LC_MESSAGES/es-419.mo
  • locales/LC_MESSAGES/es-ES.mo
  • locales/LC_MESSAGES/hi-IN.mo
  • locales/LC_MESSAGES/zh-CN.mo
  • locales/po/ar-SA.po
  • locales/po/cacti.pot
  • locales/po/es-419.po
  • locales/po/es-ES.po
  • locales/po/hi-IN.po
  • locales/po/zh-CN.po
  • tests/Unit/VaultTest.php
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sonarqubecloud

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@somethingwithproof
somethingwithproof merged commit d608123 into main Nov 20, 2026
18 checks passed
@somethingwithproof
somethingwithproof deleted the fix/credential-cleanup-review branch November 20, 2026 06:43
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.

1 participant