Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Url Signature Laravel Package

dsentker/url-signature

Laravel/PHP package to create and verify signed URLs. Add a signature to query strings to protect routes and parameters from tampering, with simple helpers for generating signatures and validating incoming requests, including optional expiry support.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Security & Fraud Prevention: Strengthens URL tamper-proofing for payment links, affiliate tracking, or sensitive redirects by ensuring deterministic parameter ordering in HMAC signatures. Mitigates edge cases where parameter reordering could break validation (e.g., ?amount=100&sig=X vs ?sig=X&amount=100), addressing a critical vulnerability in stateless URL signing.
  • Build vs. Buy: Eliminates custom query string normalization logic, reducing dev time and technical debt. Aligns with zero-trust security principles by offloading cryptographic edge cases to a maintained package.
  • Roadmap Alignment: Critical for compliance-heavy products (e.g., fintech, healthcare) where URL integrity must be auditable and deterministic. Directly supports PCI DSS, GDPR, or HIPAA requirements for secure data transmission.
  • Use Cases:
    • High-value transactions: Payment links where parameter order affects validation (e.g., ?user_id=123&amount=100&sig=...).
    • Affiliate marketing: Prevents click fraud by ensuring affiliate IDs or campaign parameters cannot be silently altered.
    • OAuth flows: Protects state or redirect_uri parameters from manipulation in callback URLs.
    • Internal tools: Secure admin actions (e.g., ?action=delete&id=456&sig=...) where parameter order may vary across clients.
    • Legacy system integration: Safely handles URLs generated by third-party tools or user input where parameter ordering is non-deterministic.

When to Consider This Package

Adopt if:

  • Your app relies on URL parameters for critical actions and requires deterministic HMAC validation (parameter order must not affect signature verification).
  • You need lightweight, stateless validation for URL integrity with minimal maintenance overhead.
  • Your stack is PHP/Laravel, and you prioritize simplicity over custom crypto libraries.
  • Parameter ordering in URLs is non-deterministic (e.g., generated by third-party tools, user input, or legacy systems), and you need consistent validation.
  • Security patches are critical: This release fixes a query string ordering vulnerability that could allow signature bypass.
  • Low-maintenance security is a priority—this package now automatically normalizes query strings before signing/verification.

Look elsewhere if:

  • You require JWT or OAuth 2.0 token signing (use firebase/php-jwt or league/oauth2-server).
  • Your URLs are extremely high-volume (this package remains stateless but may require additional caching for performance at scale).
  • You need audit logs or revocation of signed URLs (this is stateless; pair with a database or cache like Redis).
  • Your team lacks PHP/Laravel expertise—alternatives like Python’s itsdangerous or Node’s jsonwebtoken may fit better.
  • You cannot tolerate any breaking changes in query string handling:
    • Existing signed URLs with non-normalized parameters will fail verification post-update.
    • Requires migration effort to re-sign long-lived URLs (e.g., affiliate links, OAuth callbacks).
  • You rely on exact parameter order for business logic (e.g., ?sort=asc&page=1 vs ?page=1&sort=asc must behave differently).

How to Pitch It (Stakeholders)

For Executives: "This update fixes a critical security vulnerability in our URL signing system. Previously, attackers could exploit parameter reordering to bypass signatures—for example, swapping ?amount=100&sig=X to ?sig=X&amount=100 to invalidate our fraud checks. The new version automatically normalizes parameter order, ensuring signatures remain tamper-proof regardless of how the URL is constructed. This is a direct mitigation for payment fraud, affiliate abuse, and OAuth security risks. The trade-off? A one-time effort to re-sign existing URLs (e.g., affiliate links), but the upside is closed compliance gaps and zero false positives in security validation. Implementation is straightforward: a Composer update and a migration script. Risk? Minimal—this is a bug fix, not a feature change."

For Engineering: *"We’re updating to v1.1.0 of the URL signature package to fix a query string ordering vulnerability. Here’s the impact:

  • What changed: The QueryString helper now canonicalizes parameter order (e.g., ?a=1&b=2 → always sorted alphabetically) before signing/verifying. This prevents attackers from bypassing signatures by reordering parameters.
  • Breaking change: Existing signed URLs with non-normalized parameters will fail verification. We must:
    1. Update all URL generation to use the new sign() method (which normalizes order).
    2. Re-sign long-lived URLs (e.g., affiliate links, OAuth callbacks) or implement a migration path.
  • Why this matters: This was a security flaw—parameter reordering could invalidate signatures without detection.
  • Implementation:
    // Old (vulnerable):
    $url = UrlSignature::sign('https://example.com/pay', ['amount' => 100]);
    
    // New (secure):
    $url = UrlSignature::sign('https://example.com/pay', ['amount' => 100]); // Internally sorts params
    
  • Migration plan:
    • Prioritize high-risk flows (payments, admin actions).
    • For affiliate links, batch-re-sign URLs or add a temporary fallback.
    • Test all signed URL endpoints post-update.
  • Risks: Low—this is a security patch, but requires coordination to avoid breaking existing traffic. I’ll draft a migration script by [date] and need input on handling legacy URLs."*

For Security Teams: *"This update resolves a query string ordering vulnerability in URL signatures. Key changes:

  • Fix: The package now canonicalizes parameter order (e.g., ?a=1&b=2 → always ?a=1&b=2) before HMAC generation/validation.
  • Impact:
    • Mitigated: Attackers could no longer bypass signatures by reordering parameters (e.g., ?sig=X&amount=1 vs ?amount=1&sig=X).
    • Caveat: Existing signed URLs with non-canonical order will fail verification. We must:
      1. Re-sign all long-lived URLs (e.g., affiliate links, OAuth callbacks) immediately.
      2. Add a temporary fallback for legacy URLs if needed (e.g., whitelist or rate-limited validation).
  • Recommendation: Treat this as a security patch—prioritize migration for high-risk flows (payments, admin actions). Enable logging for validation failures to detect any unexpected issues post-update. Do not deploy without testing the migration on a staging environment with real signed URLs."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky