Skip to content

Commit

Permalink
Allow SharedStorage APIs in FLEDGE fenced frames.
Browse files Browse the repository at this point in the history
Right now, features like SharedStorage's selectURL() are not allowed
inside of a fenced frame created with FLEDGE. There is no
security/privacy benefit to having this restriction, so it should be
removed to have consistent behavior across fenced frames loaded with
different APIs.

Bug: 1450902
Change-Id: I5714e584ee445eab2d2c42c654cb0fd1971ce691
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4584988
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Commit-Queue: Liam Brady <lbrady@google.com>
Cr-Commit-Position: refs/heads/main@{#1152619}
  • Loading branch information
Liam Brady authored and Chromium LUCI CQ committed Jun 2, 2023
1 parent a699b1b commit 314cd86
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2606,7 +2606,7 @@ TEST_F(PermissionsPolicyTest, CreateForFledgeFencedFrame) {
EXPECT_FALSE(policy->IsFeatureEnabled(kDefaultSelfFeature));
EXPECT_TRUE(policy->IsFeatureEnabled(
mojom::PermissionsPolicyFeature::kAttributionReporting));
EXPECT_FALSE(policy->IsFeatureEnabled(
EXPECT_TRUE(policy->IsFeatureEnabled(
mojom::PermissionsPolicyFeature::kSharedStorage));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ namespace blink {
constexpr blink::mojom::PermissionsPolicyFeature
kFencedFrameFledgeDefaultRequiredFeatures[] = {
blink::mojom::PermissionsPolicyFeature::kAttributionReporting,
blink::mojom::PermissionsPolicyFeature::kPrivateAggregation};
blink::mojom::PermissionsPolicyFeature::kPrivateAggregation,
blink::mojom::PermissionsPolicyFeature::kSharedStorage,
blink::mojom::PermissionsPolicyFeature::kSharedStorageSelectUrl};

constexpr blink::mojom::PermissionsPolicyFeature
kFencedFrameSharedStorageDefaultRequiredFeatures[] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,23 @@ async function runDefaultEnabledFeaturesTest(t, should_load, fenced_origin,
"frame loaded using FLEDGE or shared storage.");

if (generator_api == "fledge") {
assert_false(
assert_true(
document.featurePolicy.allowsFeature('shared-storage'),
"Shared storage should be disallowed if the fenced " +
"Shared Storage should be allowed if the fenced " +
"frame loaded using FLEDGE.");
assert_true(
document.featurePolicy.allowsFeature('private-aggregation'),
"Private Aggregation should be allowed if the fenced " +
"frame loaded using FLEDGE.");
} else {
assert_true(
document.featurePolicy.allowsFeature('shared-storage'),
"Shared storage should be allowed if the fenced " +
"frame loaded using shared storage.");
"Shared Storage should be allowed if the fenced " +
"frame loaded using Shared Storage.");
assert_false(
document.featurePolicy.allowsFeature('private-aggregation'),
"Private Aggregation should be disabled if the fenced " +
"frame loaded using Shared Storage.");
}
}, [generator_api]);
}

0 comments on commit 314cd86

Please sign in to comment.