developmentseed / tipg

Simple and Fast Geospatial OGC Features and Tiles API for PostGIS.
https://developmentseed.org/tipg/
MIT License
153 stars 23 forks source link

generate popup contents without string concat. #94

Closed jackharrhy closed 1 year ago

jackharrhy commented 1 year ago

What I am changing

How I did it

How you can test it

Insert this table into the db:

CREATE TABLE xss (name varchar primary key, geom geometry, description varchar);
INSERT INTO xss VALUES ('XSS Test', 'POINT(0 0)', '<p onclick="alert(1)">click me!</p>');

Navigate to http://localhost:8000/collections/public.xss/items/XSS%20Test

On current main: notice that clicking on the popup, and then clicking on the text, will popup with an alert:

image

On this branch, the popup will render the true contents, and is not clickable as before:

image

jackharrhy commented 1 year ago

fyi @krishnaglodha

krishnaglodha commented 1 year ago

Ohh I see. This one makes more sense. Thanks a lot for clarification

vincentsarago commented 1 year ago

🥳 thanks @jackharrhy could you update https://github.com/developmentseed/tipg/blob/main/CHANGES.md?plain=1#L15 to add link to this PR and your name as co-author of this feature 🙏

jackharrhy commented 1 year ago

done @vincentsarago

vincentsarago commented 1 year ago

🥳