mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 16:47:29 +09:00
[places] Prevent some abuse of smart queries.
This commit is contained in:
parent
257e674bde
commit
b3deb955e9
2 changed files with 14 additions and 4 deletions
|
|
@ -39,6 +39,7 @@
|
||||||
#include "mozilla/dom/OSFileSystem.h"
|
#include "mozilla/dom/OSFileSystem.h"
|
||||||
#include "mozilla/dom/Promise.h"
|
#include "mozilla/dom/Promise.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
|
#include "nsReadableUtils.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
@ -644,6 +645,13 @@ DataTransfer::PrincipalMaySetData(const nsAString& aType,
|
||||||
NS_WARNING("Disallowing adding x-moz-file or x-moz-file-promize types to DataTransfer");
|
NS_WARNING("Disallowing adding x-moz-file or x-moz-file-promize types to DataTransfer");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disallow content from creating x-moz-place flavors, so that it cannot
|
||||||
|
// create fake Places smart queries exposing user data.
|
||||||
|
if (StringBeginsWith(aType, NS_LITERAL_STRING("text/x-moz-place"))) {
|
||||||
|
NS_WARNING("Disallowing adding moz-place types to DataTransfer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -908,6 +908,7 @@ this.PlacesUtils = {
|
||||||
* @param type
|
* @param type
|
||||||
* The content type of the blob.
|
* The content type of the blob.
|
||||||
* @returns An array of objects representing each item contained by the source.
|
* @returns An array of objects representing each item contained by the source.
|
||||||
|
* @throws if the blob contains invalid data.
|
||||||
*/
|
*/
|
||||||
unwrapNodes: function PU_unwrapNodes(blob, type) {
|
unwrapNodes: function PU_unwrapNodes(blob, type) {
|
||||||
// We split on "\n" because the transferable system converts "\r\n" to "\n"
|
// We split on "\n" because the transferable system converts "\r\n" to "\n"
|
||||||
|
|
@ -939,7 +940,7 @@ this.PlacesUtils = {
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
}
|
}
|
||||||
// note: this._uri() will throw if uriString is not a valid URI
|
// note: this._uri() will throw if uriString is not a valid URI
|
||||||
if (this._uri(uriString)) {
|
if (this._uri(uriString) && this._uri(uriString).scheme != "place") {
|
||||||
nodes.push({ uri: uriString,
|
nodes.push({ uri: uriString,
|
||||||
title: titleString ? titleString : uriString,
|
title: titleString ? titleString : uriString,
|
||||||
type: this.TYPE_X_MOZ_URL });
|
type: this.TYPE_X_MOZ_URL });
|
||||||
|
|
@ -952,11 +953,12 @@ this.PlacesUtils = {
|
||||||
for (let i = 0; i < parts.length; i++) {
|
for (let i = 0; i < parts.length; i++) {
|
||||||
let uriString = parts[i];
|
let uriString = parts[i];
|
||||||
// text/uri-list is converted to TYPE_UNICODE but it could contain
|
// text/uri-list is converted to TYPE_UNICODE but it could contain
|
||||||
// comments line prepended by #, we should skip them
|
// comments line prepended by #, we should skip them, as well as
|
||||||
if (uriString.substr(0, 1) == '\x23')
|
// empty URIs
|
||||||
|
if (uriString.substr(0, 1) == '\x23' || uriString == "")
|
||||||
continue;
|
continue;
|
||||||
// note: this._uri() will throw if uriString is not a valid URI
|
// note: this._uri() will throw if uriString is not a valid URI
|
||||||
if (uriString != "" && this._uri(uriString))
|
if (this._uri(uriString).scheme != "place")
|
||||||
nodes.push({ uri: uriString,
|
nodes.push({ uri: uriString,
|
||||||
title: uriString,
|
title: uriString,
|
||||||
type: this.TYPE_X_MOZ_URL });
|
type: this.TYPE_X_MOZ_URL });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue