Repository navigation
Conversation
Extend the distribution contract coverage for the packaged binary by asserting that the bundled Flysystem rejects malformed paths while still normalizing valid paths as expected. This also captures the related Flysystem lockfile update that the new assertions depend on.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The broad security-sensitive credential migration, locking behavior, selection precedence, and packaged-runtime impact require final human verification.
Review effort: Balanced
Findings: None
What changed in this PR
Introduces multi-merchant credential storage and selection for Quickpay CLI, replacing the previous single-credential authentication workflow.
Changes:
- Adds secure named merchant storage, project bindings, explicit selection, and merchant management commands.
- Pins authenticated clients to resolved credentials and surfaces merchant context for sensitive operations.
- Updates documentation, tests, the bundled skill, and Flysystem.
| File | Description |
|---|---|
tests/Unit/Credentials/MerchantNameTest.php |
Tests merchant-name validation. |
tests/Unit/Credentials/MerchantConfigurationJsonTest.php |
Tests duplicate JSON-property detection. |
tests/Unit/Credentials/ApiKeyResolverTest.php |
Tests credential-selection precedence and conflicts. |
tests/Integration/Credentials/ProjectMerchantFileTest.php |
Tests project binding discovery and validation. |
tests/Integration/Credentials/MerchantStoreTest.php |
Tests secure, atomic merchant persistence. |
tests/Integration/Credentials/CredentialFileTest.php |
Removes obsolete single-credential tests. |
tests/Feature/Quickpay/MerchantAuthenticationCheckTest.php |
Tests merchant-scope validation. |
tests/Feature/Quickpay/AuthenticatedQuickpayFactoryTest.php |
Tests pinned authenticated credentials. |
tests/Feature/Console/AuthenticatedCommandTest.php |
Covers merchant-aware authenticated commands. |
tests/Feature/Commands/Payments/PaymentMutationCommandsTest.php |
Isolates project selection in mutation tests. |
tests/Feature/Commands/Payments/ListPaymentsCommandTest.php |
Adapts missing-credential behavior and setup. |
tests/Feature/Commands/Payments/GetPaymentCommandTest.php |
Isolates project selection. |
tests/Feature/Commands/Payments/CreatePaymentLinkCommandTest.php |
Isolates project selection. |
tests/Feature/Commands/Payments/CreatePaymentCommandTest.php |
Isolates project selection. |
tests/Feature/Commands/Merchants/MerchantCommandsTest.php |
Covers merchant-management workflows. |
tests/Feature/Commands/Callbacks/WatchCallbacksCommandTest.php |
Isolates callback project selection. |
tests/Feature/Commands/Callbacks/ReplayCallbackCommandTest.php |
Isolates callback project selection. |
tests/Feature/Commands/Authentication/AuthenticationCommandsTest.php |
Removes superseded authentication tests. |
tests/Feature/Commands/Api/ApiRequestCommandTest.php |
Isolates raw API project selection. |
tests/Feature/CommandHelpTest.php |
Verifies merchant options and skill commands. |
tests/Feature/ApplicationIdentityTest.php |
Updates the public command inventory. |
tests/Architecture/SkillContractTest.php |
Validates bundled skill naming and references. |
tests/Architecture/DistributionContractTest.php |
Tests updated Flysystem path handling. |
skills/quickpay-cli/SKILL.md |
Documents merchant-aware agent workflows. |
SECURITY.md |
Documents credential and selection invariants. |
README.md |
Documents merchant setup and usage. |
CONTRIBUTING.md |
Updates the skill path. |
composer.lock |
Updates Flysystem to 3.35.3. |
app/Quickpay/MerchantAuthenticationCheck.php |
Adds merchant-scope authentication checks. |
app/Quickpay/AuthenticatedQuickpayFactory.php |
Supports explicit merchant resolution. |
app/Providers/AppServiceProvider.php |
Registers the new credential services. |
app/Credentials/ProjectMerchantFile.php |
Implements project merchant bindings. |
app/Credentials/MerchantStore.php |
Implements locked named-credential storage. |
app/Credentials/MerchantName.php |
Validates merchant labels. |
app/Credentials/MerchantConfigurationJson.php |
Rejects ambiguous duplicate properties. |
app/Credentials/CredentialFile.php |
Removes single-credential persistence. |
app/Credentials/ApiKeyResolver.php |
Implements merchant-selection precedence. |
app/Credentials/ApiKey.php |
Carries merchant-selection context. |
app/Console/AuthenticatedCommand.php |
Adds --merchant and context output. |
app/Commands/Payments/AbstractPaymentMutationCommand.php |
Adds merchant details to confirmations. |
app/Commands/Merchants/SelectMerchantCommand.php |
Adds global and project selection. |
app/Commands/Merchants/RemoveMerchantCommand.php |
Adds credential removal. |
app/Commands/Merchants/ListMerchantsCommand.php |
Adds merchant listing. |
app/Commands/Merchants/AddMerchantCommand.php |
Adds validated credential enrollment. |
app/Commands/Merchants/ActiveMerchantCommand.php |
Adds local and checked status reporting. |
app/Commands/Callbacks/WatchCallbacksCommand.php |
Reports pinned watcher context. |
app/Commands/Authentication/LogoutCommand.php |
Removes obsolete logout command. |
app/Commands/Authentication/LoginCommand.php |
Removes obsolete login command. |
app/Commands/Authentication/AuthCommand.php |
Removes obsolete auth command. |
app/Commands/Api/ApiRequestCommand.php |
Reports merchant context for mutations. |
AGENTS.md |
Updates repository guidance and invariants. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Split the merchant command feature tests into one file per command with shared helpers in tests/Pest.php, simplify the merchant and credential code paths, and trim the README and bundled skill. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Make the duplicate-property scan in merchant configuration JSON immune to regex backtracking limits and reject the file if it fails - Reject project merchant bindings not owned by the current user - Refuse merchants:add --replace for a merchant that is not saved - Point to merchants:select when no default merchant is selected, and say so after merchants:remove clears the default - Warn after merchants:add that the old single-key config file is unused and can be deleted, without reading it - Print the merchant context for payments:create and payments:link - Name the binding file in binding errors and give stale bindings their own message - Show "Merchant: none" in merchants:active without credentials and drop the constant API base URL and version lines from its human output Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each saved merchant stores read and write flags. QuickpayClient refuses any request they block before sending it: GET is a read and every other method is a write. Capture, refund, cancel and raw mutations check access before inspecting a payment or asking for confirmation. The credential check behind merchants:add and merchants:active --check is exempt. merchants:add takes --no-read and --no-write, and the new merchants:access command shows or changes the flags. Blocking works anywhere; allowing requests again needs an interactive terminal and a confirmation. merchants:list and merchants:active report the flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hant callbacks:watch and callbacks:replay now print a warning when the QUICKPAY_PRIVATE_KEY override is set while a saved merchant is selected, since the override may belong to a different merchant than the one in use. The warning goes to stderr in --json mode and is skipped for the QUICKPAY_API_KEY environment key, where pairing the two is deliberate. Also records the branch in the CHANGELOG, with the removed login, logout and auth commands and the old config file marked as breaking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
composer audit flagged seven advisories in symfony/http-foundation, symfony/http-kernel and symfony/mime. This moves them to 7.4.23, 7.4.23 and 7.4.22, with their dependencies, within the existing constraints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- merchants:add --replace now asks before a --read or --write flag lifts a saved block, and prints the access whenever it changes. - merchants:access only asks when a flag lifts a block, so scripts can block with --read --no-write. Allowing what is already allowed is dropped, so it cannot undo a block saved in the meantime. A declined allow still applies the blocks requested with it. - callbacks:watch checks read access before announcing the watch. - The label for both flags off is now "reads and writes blocked", so it no longer contradicts the credential check. - README and SECURITY.md say that a running callbacks:watch keeps the flags it started with. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blocking reads protected little and cost a lot: capture, refund,
cancel and callbacks all need reads, and most access edge cases came
from it. Saved merchants now carry a single write flag, and a
read-only merchant may send only GET.
- Removes --read and --no-read from merchants:add and merchants:access.
- The saved config is {"api_key": ..., "write": bool}; a read flag is
rejected like any other extra field.
- merchants:list and merchants:active report write only.
- Drops the ping exemption and the read check in callbacks:watch,
which only existed for merchants that blocked reads.
- Blocked writes now fail with "The selected merchant is read-only".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--no-write came from Symfony's negation of a write option, which is not what anyone looks for. The protection now uses the common read-only name. - merchants:add <name> --read-only and merchants:access <name> --read-only make a merchant read-only. - merchants:access <name> --read-write allows writes again after a confirmation in an interactive terminal; giving both flags fails. - merchants:add --replace keeps a read-only merchant read-only, so merchants:access is the only way to allow writes again. - The saved config and the JSON output use read_only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Replaces single-key authentication with named, saved merchants, so one install can work with several Quickpay merchants and each project can choose its own. Any saved merchant can also be made read-only.
Added
merchants:add,merchants:list,merchants:select,merchants:activeandmerchants:removesave and choose between several merchants. Every authenticated command takes--merchant.merchants:select <name> --localwrites.quickpay-cli.json, so commands in that folder and below use that merchant.merchants:add --read-onlyormerchants:access --read-onlyblocks every request exceptGETbefore anything is sent.merchants:access --read-writeallows writes again, and only after a confirmation in an interactive terminal, so a script or agent can't undo it.callbacks:watchandcallbacks:replaywarn whenQUICKPAY_PRIVATE_KEYis set while a saved merchant is selected, since it may belong to another merchant.Changed
quickpaytoquickpay-cli.composer auditadvisories that failed the Package metadata check.Breaking
login,logoutandauthcommands are removed. Save a merchant withquickpay merchants:add <name>, and usemerchants:active --checkinstead ofauth --check.~/.config/quickpay/config.jsonis no longer read. Add the merchant again withmerchants:add, then delete the old file.merchants:addreminds you while it still exists.Testing
composer checkpasses: the Pest suite, PHPStan and Pint.🤖 Generated with Claude Code