Closed gavinr-maps closed 1 year ago
Just checking in on the progress on this? We have a client with a pending production release that's dependent on this fix
@gavinr-maps @mstiglingh there are security considerations here. We cannot blindly send a users token to an external URL over http://
since that isn't secure. We also should not blindly send a users token over https://
to a server or domain we don't trust. Right now the only way to verify that would be to confirm that the style and the sprites/glyph are on the same top level domain. If they are on different domains you will need to manually modify the style to incldue the token manually like so:
L.esri.Vector.vectorTileLayer("XYZ", {
token: result.access_token,
style: (style) => {
// manually add the token here
return style;
}
}).addTo(map);
The fix for this was released in v4.2.0.
@gavinr-maps the issue seems to have returned in the latest versions
@mstiglingh thanks for the note. The unit tests included in the fix for this (#192) seem to be passing, so I'm not sure what you're seeing. Could you please provide some more details including a replication case and what version the issue started happening? Thanks!
Describe the bug
(original issue: #186)
This bug is regarding when using a protected vector tile service and thus passing a
token
property in the options object (second parameter) like this:That token should be passed to the request for the sprites too, but in some cases it is not being included:
When the
sprite
property of the style JSON (root.json
) is NOT a full URL starting withhttp....
,When the
sprite
property of the style JSON (root.json
) IS a full URL starting withhttp...
,Reproduction
Logs
No response
System Info
Additional Information
I think this is where the issue is: https://github.com/Esri/esri-leaflet-vector/blob/cad5b1967536486afb2f3f2507be1a6c33efd1d8/src/Util.js#L207-L216
The fix should be as simple as moving the line that adds the token (
style.sprite += token ? '?token=' + token : '';
) out of thatif
statement.Template
Here is the demo template that is used in the replication steps above. See places where the string "XYZ" are for places where you need to replace values.