Skip to content
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

fix(security): prevent reflected xss #1200

Open
wants to merge 6 commits into
base: v4
Choose a base branch
from

Conversation

joerivanveen
Copy link
Contributor

@joerivanveen joerivanveen commented Nov 26, 2024

INT-740

@joerivanveen joerivanveen marked this pull request as ready for review November 26, 2024 19:49
@joerivanveen joerivanveen requested a review from a team as a code owner November 26, 2024 19:49
@@ -35,8 +35,6 @@ class WCMP_API extends WCMP_Rest
*/
public function __construct($key)
{
parent::__construct();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Waarom is deze weggehaald?

Copy link
Contributor Author

@joerivanveen joerivanveen Nov 27, 2024

Choose a reason for hiding this comment

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

De parent heeft geen __construct() meer omdat ie geen dingen meer hoeft te initialiseren voor de instance.

@@ -559,7 +559,7 @@ public function addShipments(array $order_ids, bool $process): array
} catch (Exception $ex) {
$errorMessage = sprintf(
__('error_export_order_id_failed_because', 'woocommerce-myparcel'),
$order_id, __($ex->getMessage(), 'woocommerce-myparcel')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wordt dit nu niet en nooit niet vertaald? Anders kunnen we deze ook door die esc_html__ halen denk ik om de vertaalfunctie voor de message niet kwijt te raken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dit werd volgens mij nooit vertaald.

@@ -15,102 +15,6 @@
*/
class WCMP_Rest
Copy link
Collaborator

Choose a reason for hiding this comment

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

Waarom zijn al deze functionaliteiten hier uit gehaald?

Copy link
Contributor Author

@joerivanveen joerivanveen Nov 27, 2024

Choose a reason for hiding this comment

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

Als je het curl gedeelte bedoelt: dat werd helemaal niet meer gebruikt, ten gunste van wp_remote_get en wp_remote_post, wat aanbevolen is.

Comment on lines +191 to +193
esc_html($date),
selected($date, $selected),
$dateString
esc_html($dateString)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Deze data zou volgens mij niet escaped hoeven worden

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Volgens mij ook niet, en dat geldt voor meer dingen, maar de WP waakhond wil dat wel echt.

@@ -1375,7 +1374,7 @@ private function getConfirmationData(DeliveryOptions $deliveryOptions): ?array
];

if (WCMYPA()->setting_collection->isEnabled(WCMYPA_Settings::SETTING_SHOW_DELIVERY_DAY)) {
$confirmationData[__('Date:', 'woocommerce')] = wc_format_datetime(new WC_DateTime($deliveryOptions->getDate() ?? ''));
$confirmationData[__('Date:', 'woocommerce-myparcel')] = wc_format_datetime(new WC_DateTime($deliveryOptions->getDate() ?? ''));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Klopt het dat deze vertaling nu niet meer uit Wooc zelf gehaald wordt? En daardoor misschien nu ontbreekt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dat is correct en helaas. Aan de andere kant, op andermans vertaalbestanden dependen zonder dat expliciet te maken is ook niet zo netjes.

exit($e);
}
return;
try {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hier wordt ondersteuning voor Wooc < 2.7 gedropped?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ik zal inbouwen dat onze plugin minimaal versie 5.x moet hebben (dat is al zo vanwege een functie die de landen uitleest), dus de plugin werkte sowieso al niet met oudere versies, ook al declarede die dat niet netjes.

// Remove placeholder values (IE8 & 9)
add_action('woocommerce_checkout_update_order_meta', [$this, 'remove_placeholders'], 10, 2);

// Fix weird required field translations
Copy link
Collaborator

Choose a reason for hiding this comment

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

Waarom is dit verwijderd?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deze translations zijn niet meer van toepassing, heb ik gecontroleerd, WooC doet dat nu netjes. IE ondersteunen we helemaal niet meer.

* @return string Normalized screen ID.
* @since 4.6.0-dev
*/
public static function normalize_wc_screen_id($slug = 'wc-settings')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Moet dit niet worden opgelost met de version check uit het gerefereerde ticket in dit docblock (ipv helemaal weggehaald)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmtja, dit werkt ook gewoon, tegenwoordig.

@@ -139,21 +139,10 @@ public static function set_props($object, $props, $compat_props = [])
*/
public static function set_address_prop(WC_Order $order, $prop, $address = 'billing', $value = null, $save = true)
{
if (WC_Core::is_wc_version_gte_3_0()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hier wordt ook weer compatibiliteit verwijderd?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes ik zal dit netjes doen.

woocommerce-myparcel.php Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants