CanopusFalling / recycle-extension

Chrome extension to allow users to determine if a product is recyclable or not.
MIT License
2 stars 0 forks source link

Scraper Overhaul #27

Closed CanopusFalling closed 3 years ago

CanopusFalling commented 3 years ago

Complete overhaul of the current scraper system to make it easier to expand the functionality and also fix the lack of sanitation of the data from that branch.

CanopusFalling commented 3 years ago

The salted identity is a bit of an odd one, we could probably redo these functions but for the moment I have just moved them to the correct place rather than playing with the functions themselves. That was supposed to salt the ID from different sites with the name of the site so that if two products had the same ID from different sites they would be unique to each site in our ID system. It's not really used at the moment though.

The code snippet listed:

function sanitiseObject(obj) {
    for (let key in obj) {
        obj[key] = sanitizeStringHTML(obj[key]);
    }
}

Just sanitises all the strings in the product object from the site so that if one of those sites tries to perform an xxs attack at no point can it effect our popup or anywhere else that string might be displayed.