-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PO-243 changing escaping for attributes #24
Changes from all commits
215bc9b
4843f32
1e5a518
d42eb12
4dd3bb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,11 +29,9 @@ function razorpay_view_button() | |
$previous_page_url = admin_url('admin.php?page=razorpay_button_elementor&paged='.$pagenum); | ||
$button_detail = $this->fetch_button_detail(sanitize_text_field($_REQUEST['btn'])); | ||
|
||
$show = "jQuery('.overlay').show()"; | ||
$hide = "jQuery('.overlay').hide()"; | ||
echo '<div class="wrap"> | ||
<div class="content-header"> | ||
<a href="'.$previous_page_url.'"> | ||
<a href="' . esc_url($previous_page_url) . '"> | ||
<span class="dashicons rzp-dashicons dashicons-arrow-left-alt"></span> Button List | ||
</a> | ||
<span class="dashicons rzp-dashicons dashicons-arrow-right-alt2"></span>'. esc_html($button_detail['title']) . ' | ||
|
@@ -52,12 +50,12 @@ function razorpay_view_button() | |
<div class="col-sm-4 panel-label">Button Status</div> | ||
<div class="col-sm-8 panel-value"> | ||
<span class="status-label">' . esc_html($button_detail['status']) . '</span> | ||
<button onclick="'.$show.'" class="status-button">' . esc_html($button_detail['btn_pointer_status']) . '</button> | ||
<button onclick="jQuery(\'.overlay\').show()" class="status-button">' . esc_html($button_detail['btn_pointer_status']) . '</button> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-sm-4 panel-label">Total Quantity Sold</div> | ||
<div class="col-sm-8 panel-value">' . htmlentities($button_detail['total_item_sold']) . '</div> | ||
<div class="col-sm-8 panel-value">' . esc_html($button_detail['total_item_sold']) . '</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-sm-4 panel-label">Total revenue</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
View Dataflow Graphflowchart LR
classDef invis fill:white, stroke: none
classDef default fill:#e7f5ff, color:#1c7fd6, stroke: none
subgraph File0["<b>templates/razorpay-button-view-templates.php</b>"]
direction LR
%% Source
subgraph Source
direction LR
v0["<a href=https://github.com/razorpay/payment-button-elementor-plugin/blob/1e5a518adbfbe46a517cc8662d101952419fcf42/templates/razorpay-button-view-templates.php#L28 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 28] $_REQUEST</a>"]
end
%% Intermediate
subgraph Traces0[Traces]
direction TB
v2["<a href=https://github.com/razorpay/payment-button-elementor-plugin/blob/1e5a518adbfbe46a517cc8662d101952419fcf42/templates/razorpay-button-view-templates.php#L28 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 28] $pagenum</a>"]
v3["<a href=https://github.com/razorpay/payment-button-elementor-plugin/blob/1e5a518adbfbe46a517cc8662d101952419fcf42/templates/razorpay-button-view-templates.php#L29 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 29] $previous_page_url</a>"]
end
v2 --> v3
%% Sink
subgraph Sink
direction LR
v1["<a href=https://github.com/razorpay/payment-button-elementor-plugin/blob/1e5a518adbfbe46a517cc8662d101952419fcf42/templates/razorpay-button-view-templates.php#L32 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 32] echo '<div class="wrap"><br> <div class="content-header"><br> <a href="' . esc_url($previous_page_url) . '"><br> <span class="dashicons rzp-dashicons dashicons-arrow-left-alt"></span> Button List<br> </a><br> <span class="dashicons rzp-dashicons dashicons-arrow-right-alt2"></span>'. esc_html($button_detail['title']) . '<br> </div><br> <div class="container rzp-container"><br> <div class="row panel-heading"><br> <div class="text">' . esc_html($button_detail['title']) . '</div><br> </div><br> <div class="row panel-body"><br> <div class="col-md-5 panel-body-left"><br> <div class="row"><br> <div class="col-sm-4 panel-label">Button ID</div><br> <div class="col-sm-8 panel-value">' . esc_html($button_detail["id"]) . '</div><br> </div><br> <div class="row"><br> <div class="col-sm-4 panel-label">Button Status</div><br> <div class="col-sm-8 panel-value"><br> <span class="status-label">' . esc_html($button_detail['status']) . '</span><br> <button onclick="jQuery(\'.overlay\').show()" class="status-button">' . esc_html($button_detail['btn_pointer_status']) . '</button><br> </div><br> </div><br> <div class="row"><br> <div class="col-sm-4 panel-label">Total Quantity Sold</div><br> <div class="col-sm-8 panel-value">' . esc_html($button_detail['total_item_sold']) . '</div><br> </div><br> <div class="row"><br> <div class="col-sm-4 panel-label">Total revenue</div><br> <div class="col-sm-8 panel-value"><span class="rzp-currency">₹ </span>' . esc_html($button_detail['total_revenue']) . '</div><br> </div><br> <div class="row"><br> <div class="col-sm-4 panel-label">Created on</div><br> <div class="col-sm-8 panel-value">' . esc_html($button_detail['created_at']) . '</div><br> </div><br> </div><br> <div class="col-md-7">'.$button_detail['html_content_item'].'</div><br> </div> <br> </div><br> <br> </div>';</a>"]
end
end
%% Class Assignment
Source:::invis
Sink:::invis
Traces0:::invis
File0:::invis
%% Connections
Source --> Traces0
Traces0 --> Sink
Button List
'. esc_html($button_detail['title']) . '
' . esc_html($button_detail['title']) . '
Button ID
' . esc_html($button_detail["id"]) . '
Button Status
' . esc_html($button_detail['status']) . '
' . esc_html($button_detail['btn_pointer_status']) . '
Total Quantity Sold
' . esc_html($button_detail['total_item_sold']) . '
Total revenue
₹ ' . esc_html($button_detail['total_revenue']) . '
Created on
' . esc_html($button_detail['created_at']) . '
'.$button_detail['html_content_item'].'
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Semgrep Assistant thinks this might be safe to ignore. The user input is sanitized using 'sanitize_text_field' and 'esc_url', which are appropriate sanitization functions for this context, mitigating the risk of cross-site scripting. AI-generated comment; review carefully. |
||
|
@@ -85,10 +83,10 @@ function razorpay_view_button() | |
<p>' . esc_html($button_detail["modal_body_content"]) . '</p> | ||
</div> | ||
<div class="Modal__actions"> | ||
<button type="button" onclick="'.$hide.'" class="btn btn-default">No, don`t!</button> | ||
<button type="submit" onclick="'.$hide.'" name="btn_action" value="' . esc_html($button_detail['btn_pointer_status']) . '" class="btn btn-primary">Yes, ' . esc_html($button_detail['btn_pointer_status']) . '</button> | ||
<input type="hidden" name="btn_id" value="' . esc_html($button_detail['id']) . '"> | ||
<input type="hidden" name="paged" value="'.$pagenum.'"> | ||
<button type="button" onclick="jQuery(\'.overlay\').hide()" class="btn btn-default">No, don`t!</button> | ||
<button type="submit" onclick="jQuery(\'.overlay\').hide()" name="btn_action" value="' . esc_attr($button_detail['btn_pointer_status']) . '" class="btn btn-primary">Yes, ' . esc_html($button_detail['btn_pointer_status']) . '</button> | ||
<input type="hidden" name="btn_id" value="' . esc_attr($button_detail['id']) . '"> | ||
<input type="hidden" name="paged" value="' . esc_attr($pagenum) . '"> | ||
<input type="hidden" name="action" value="rzp_btn_elementor_action"> | ||
</div> | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Echo
ing user input risks cross-site scripting vulnerability. You should usehtmlentities()
when showing data to users.🧹 Fixed in commit 4843f32 🧹
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semgrep Assistant thinks this might be safe to ignore. The user input is sanitized using 'sanitize_text_field' and 'esc_url', which are appropriate sanitization functions for preventing xss in this context. therefore, the risk of cross-site scripting is mitigated.
AI-generated comment; review carefully.
Leave a 👍 reaction to ignore the finding. Reacting with 👍 or 👎 also provides feedback to improve Assistant's future comments.