Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$sceDelegateProvider.resourceUrlWhitelist() regex security risks #4006

@josephlord

Description

@josephlord

I don't know how deeply this has been discussed but I think requiring regexs rather than a list of hosts/paths opens up risks.

If someone puts 'https://cdnhost-name12345.cdn.com.' they risk attack from anyone having a domain and creating a file at 'https://cdnhost-name12345.cdn.com.example.com". Now obviously the user should have entered: 'https://cdnhost-name12345\.cdn\.com/.' but the documentation doesn't seem to give examples. [Edited as 's weren't showing.]

I know that there are many valid uses for regexs where a number of servers or paths may be being used but that should be the advance option rather than the default and I would like it if there was stronger documentation and examples about how to (and how not to) use the regexs.

This is what my whitelist item in Rails looks like in the end and it would be all too easy to forget the escaping of the '.'s or the '/' before the '.'.
'<%= ActionController::Base.asset_host.gsub(/./, '.') %>/.
' [Edited as 's weren't showing.]

Please consider a safe easy option.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions