Skip to content

Protocol Relative URLs Don't Resolve Securely via ImageWorker #143

@markus101

Description

@markus101

If a protocol relative URL is provided to ImageWorker from WebPlatform.loadSrcTexture the image is loaded via http even if the app is loaded via https.

Changing https://github.com/WebPlatformForEmbedded/Lightning/blob/a6ba01b5a4ed9867859e05577b7085d36a6ad765/src/platforms/browser/WebPlatform.mjs#L69

to

let finalSrc = src;

if (/^\/\//.test(finalSrc)) {
  finalSrc = window.location.protocol + src;
}

const image = this._imageWorker.create(finalSrc);

I've implemented a workaround (read monkeypatch) for this in the app I'm working on, but since WebPlatform isn't exported it's not pretty. In addition to fixing the underlying issue, please consider exporting WebPlatform so it could be extended and passed in as a stage option instead of having to copy it.

I can also PR the proposed fixes if you'd like, but I wanted to file the issue first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions