adobe / aio-lib-files

An abstraction on top of cloud blob storage exposing a file system like API
https://www.adobe.io
Apache License 2.0
10 stars 14 forks source link

Fix for URL access from outside runtime actions #143

Open purplecabbage opened 5 months ago

purplecabbage commented 5 months ago

Description

This changes the default url types returned. internalUrls are of the form .blob.core.windows.net and urls are using our files cdn firefly.azureedge.net

Some other fixes to make sure we are formatting urls correctly, switched to use the Url class instead of problematic string modification.

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

Checklist:

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (d772fdc) 100.00% compared to head (965b566) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #143 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 5 5 Lines 567 570 +3 Branches 109 107 -2 ========================================= + Hits 567 570 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

purplecabbage commented 5 months ago

This needs to be a major when released because presignedUrls used to always be https://.blob.core.windows.net and now they use our cdn firefly.azureedge.net

purplecabbage commented 5 months ago

actually, looks like there is an issue with presignedurl sigs now

purplecabbage commented 5 months ago

just one open point:

An alternative could be to keep using internal URLs when running in a Runtime action. We could do something similar to what @shazron is doing in lib state

This would add complexity but would guarantee the same behavior within runtime actions (so no major is needed). The CDN likely brings its limitations and we should be a bit careful.

Wdyt?

That is not a reliable way of detecting runtime since it could still be in wskdebug. Plus I provide all those values when running action code on localhost. https://github.com/adobe/aio-lib-state/blob/ccdb0953ba386387cdf797b30be022b3c3d4f543/lib/utils.js#L51

I'm not crazy about the complexity this would add, but there could potentially be a flag added to say the code is definitively NOT running in a runtime container.