Skip to content

Escape anti-fraud iframe src via add_query_arg() and esc_url()#125

Draft
Copilot wants to merge 2 commits intostagingfrom
copilot/sub-pr-121-yet-again
Draft

Escape anti-fraud iframe src via add_query_arg() and esc_url()#125
Copilot wants to merge 2 commits intostagingfrom
copilot/sub-pr-121-yet-again

Conversation

Copy link

Copilot AI commented Mar 4, 2026

The fingerprint iframe src was built via raw PHP string interpolation with no URL encoding, leaving it open to XSS/attribute-injection if the org/session ID values ever contain unexpected characters.

Changes

  • includes/payment-methods/class-wc-gateway-braspag-creditcard.php
    • Replace raw interpolation with add_query_arg() to encode query parameters
    • Wrap output in esc_url() before rendering into the src attribute
// Before
<iframe src="<?php echo "https://h.online-metrix.net/fp/tags.js?org_id={$this->antifraud_finger_print_org_id}&session_id={$this->antifraud_finger_print_session_id}" ?>">

// After
<iframe src="<?php echo esc_url( add_query_arg( array( 'org_id' => $this->antifraud_finger_print_org_id, 'session_id' => $this->antifraud_finger_print_session_id ), 'https://h.online-metrix.net/fp/tags.js' ) ); ?>">

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: willian-hf-rodrigues <140353340+willian-hf-rodrigues@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback from review on Release 3DS pull request Escape anti-fraud iframe src via add_query_arg() and esc_url() Mar 4, 2026
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