Skip to content

[1.x] Refine URL signing policy#6

Merged
timkelty merged 3 commits into
1.xfrom
timkelty/fixed-policy-url-signing
Jun 11, 2026
Merged

[1.x] Refine URL signing policy#6
timkelty merged 3 commits into
1.xfrom
timkelty/fixed-policy-url-signing

Conversation

@timkelty

Copy link
Copy Markdown
Contributor

Description

Refines URL signing into a fixed-policy verifier model so signed URLs do not carry their own component policy, while keeping the Cloud transform migration path configurable through UrlSigningConfig.

@timkelty timkelty force-pushed the timkelty/fixed-policy-url-signing branch from f968d50 to 62474f5 Compare June 11, 2026 15:56
@timkelty timkelty requested a review from Copilot June 11, 2026 16:20
@timkelty timkelty merged commit 8b407cb into 1.x Jun 11, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Refactors the URL signing subsystem toward a “fixed-policy verifier” approach: signed URLs now carry only a signature, while the verifier derives the signature input from its configured policy (UrlSigningConfig) instead of reading per-URL policy from a signature-input query parameter. This also extracts shared utilities for signature-input construction and base64url handling, and updates component derivation behavior and documentation accordingly.

Changes:

  • Remove signature-input as an emitted URL query parameter; build signature input from verifier/signer configuration via UrlSignatureInput.
  • Introduce Base64Url and QueryParamComponent, and adjust component derivation for @method and @query-param.
  • Update unit tests, README PHP requirements, and bump PHPStan to v2.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/Unit/Url/UrlVerifierTest.php Updates verifier tests for config-driven signature input and adds invalid base64url coverage.
tests/Unit/Url/UrlSignerTest.php Updates signer tests to assert only signature is appended and signature changes with configured components/expiration.
tests/Unit/ComponentDeriverTest.php Updates expectations for @method casing and @query-param parsing/edge cases.
src/Url/UrlVerifier.php Removes parsing of signature-input from URL; derives signature input from config and uses Base64Url::decode.
src/Url/UrlSigningConfig.php Removes signatureInputParam option and updates factory accordingly.
src/Url/UrlSigner.php Stops appending signature-input and delegates signature-input creation to UrlSignatureInput; uses Base64Url::encode.
src/Url/UrlSignatureInput.php New helper to construct the structured-field InnerList signature input from config + algorithm.
src/Url/Base64Url.php New base64url encode/decode helper with stricter decode validation.
src/Signer.php Simplifies component identifier parsing for structured-field parameterized identifiers.
src/QueryParamComponent.php New implementation of @query-param derivation using URLSearchParams, with stronger validation.
src/ComponentDeriver.php Switches @query-param derivation to QueryParamComponent and preserves method case.
README.md Updates stated PHP requirement and feature wording.
composer.json Bumps PHPStan to ^2.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Url/UrlSigner.php
Comment on lines +57 to 60
// Strip any existing signature param
$cleanUrl = Modifier::wrap($uriString)
->removeQueryPairsByKey($this->config->signatureParam, $this->config->signatureInputParam)
->removeQueryPairsByKey($this->config->signatureParam)
->toString();
Comment thread src/Url/UrlVerifier.php
Comment on lines +74 to 77
// Strip signature param to get the clean URL
$cleanUrl = Modifier::wrap($uriString)
->removeQueryPairsByKey($this->config->signatureParam, $this->config->signatureInputParam)
->removeQueryPairsByKey($this->config->signatureParam)
->toString();
Comment on lines 50 to 52
$this->assertSame('1', $params['keep']);
$this->assertSame('keep', $params['signature-input']);
$this->assertNotSame('old', $params['signature']);
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.

2 participants