Fix permissions issue with iframes nested in fenced frames.

This CL fixes a bug related to permissions policies in iframes nested
within fenced frames. For policies that are not explicitly disabled in a
fenced frame, if the fenced frame's document response disallows a
permissions policy, it is still allowed in the iframe nested within the
fenced frame. It was first found with the Attribution Reporting API
policy, but this bug applies to any permissions policy that can be set
in a fenced frame.

The bug occurred because iframes nested inside of fenced frames were
always treated as fenced frames, and their permissions policies were set
with `PermissionsPolicy::CreateForFencedFrame()`, which intentionally
does not look at parent frames. While this was suitable when permissions
policies were completely disabled in fenced frames, it became
problematic when permissions started being allowed (including allowing
a document to further restrict permissions), and child frames needed to
access the embedding fenced frame's permissions policies to know which
permissions to disable.

After this fix, `PermissionsPolicy::CreateForFencedFrame()` will only
be called on a fenced frame root. Subframes nested in fenced frames
will now use the `PermissionsPolicy::CreateFromParentPolicy()` method
the same way that subframes outside of fenced frame trees currently
do.

This CL adds WPTs to check that iframes nested in fenced frames have
their permissions set as expected.

This CL also fixes an issue with client hint code that was causing an
iframe nested in a fenced frame to pull the permissions policy from the
outermost main frame rather than its fenced frame root.

Bug: 1428913
Change-Id: I590425d59a8f19e37313bd3dedf0d56b35c87f80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4377538
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1135089}
5 files changed
tree: ebf8dfdae322010c3a09d25690c0a1438b28b9c3
  1. .github/
  2. .well-known/
  3. accelerometer/
  4. accessibility/
  5. accname/
  6. acid/
  7. ambient-light/
  8. animation-worklet/
  9. annotation-model/
  10. annotation-protocol/
  11. annotation-vocab/
  12. apng/
  13. appmanifest/
  14. attribution-reporting/
  15. audio-output/
  16. autoplay-policy-detection/
  17. avif/
  18. background-fetch/
  19. background-sync/
  20. badging/
  21. battery-status/
  22. beacon/
  23. bluetooth/
  24. browsing-topics/
  25. clear-site-data/
  26. client-hints/
  27. clipboard-apis/
  28. close-watcher/
  29. common/
  30. compat/
  31. compression/
  32. compute-pressure/
  33. conformance-checkers/
  34. console/
  35. contacts/
  36. content-dpr/
  37. content-index/
  38. content-security-policy/
  39. contenteditable/
  40. cookie-store/
  41. cookies/
  42. core-aam/
  43. cors/
  44. credential-management/
  45. css/
  46. custom-elements/
  47. custom-state-pseudo-class/
  48. delegated-ink/
  49. density-size-correction/
  50. deprecation-reporting/
  51. device-memory/
  52. direct-sockets/
  53. docs/
  54. document-picture-in-picture/
  55. document-policy/
  56. dom/
  57. domparsing/
  58. domxpath/
  59. dpub-aam/
  60. dpub-aria/
  61. ecmascript/
  62. editing/
  63. element-timing/
  64. encoding/
  65. encoding-detection/
  66. encrypted-media/
  67. entries-api/
  68. event-timing/
  69. eventsource/
  70. eyedropper/
  71. feature-policy/
  72. fenced-frame/
  73. fetch/
  74. file-system-access/
  75. FileAPI/
  76. fledge/
  77. focus/
  78. font-access/
  79. fonts/
  80. forced-colors-mode/
  81. fs/
  82. fullscreen/
  83. gamepad/
  84. generic-sensor/
  85. geolocation-API/
  86. geolocation-sensor/
  87. graphics-aam/
  88. gyroscope/
  89. hr-time/
  90. html/
  91. html-aam/
  92. html-longdesc/
  93. html-media-capture/
  94. idle-detection/
  95. imagebitmap-renderingcontext/
  96. images/
  97. import-maps/
  98. IndexedDB/
  99. inert/
  100. infrastructure/
  101. input-device-capabilities/
  102. input-events/
  103. installedapp/
  104. interfaces/
  105. intersection-observer/
  106. intervention-reporting/
  107. is-input-pending/
  108. js/
  109. js-self-profiling/
  110. keyboard-lock/
  111. keyboard-map/
  112. largest-contentful-paint/
  113. layout-instability/
  114. lifecycle/
  115. loading/
  116. long-animation-frame/
  117. longtask-timing/
  118. magnetometer/
  119. managed/
  120. mathml/
  121. measure-memory/
  122. media/
  123. media-capabilities/
  124. media-playback-quality/
  125. media-source/
  126. mediacapture-extensions/
  127. mediacapture-fromelement/
  128. mediacapture-handle/
  129. mediacapture-image/
  130. mediacapture-insertable-streams/
  131. mediacapture-record/
  132. mediacapture-region/
  133. mediacapture-streams/
  134. mediasession/
  135. merchant-validation/
  136. mimesniff/
  137. mixed-content/
  138. mst-content-hint/
  139. navigation-api/
  140. navigation-timing/
  141. netinfo/
  142. network-error-logging/
  143. notifications/
  144. old-tests/
  145. orientation-event/
  146. orientation-sensor/
  147. page-lifecycle/
  148. page-visibility/
  149. paint-timing/
  150. parakeet/
  151. payment-handler/
  152. payment-method-basic-card/
  153. payment-method-id/
  154. payment-request/
  155. pending-beacon/
  156. performance-timeline/
  157. periodic-background-sync/
  158. permissions/
  159. permissions-policy/
  160. permissions-request/
  161. permissions-revoke/
  162. picture-in-picture/
  163. png/
  164. pointerevents/
  165. pointerlock/
  166. portals/
  167. preload/
  168. presentation-api/
  169. private-click-measurement/
  170. proximity/
  171. push-api/
  172. quirks/
  173. referrer-policy/
  174. remote-playback/
  175. reporting/
  176. requestidlecallback/
  177. resize-observer/
  178. resource-timing/
  179. resources/
  180. sanitizer-api/
  181. savedata/
  182. scheduler/
  183. screen-capture/
  184. screen-details/
  185. screen-orientation/
  186. screen-wake-lock/
  187. scroll-animations/
  188. scroll-to-text-fragment/
  189. secure-contexts/
  190. secure-payment-confirmation/
  191. selection/
  192. serial/
  193. server-timing/
  194. service-workers/
  195. shadow-dom/
  196. shape-detection/
  197. shared-storage/
  198. signed-exchange/
  199. soft-navigation-heuristics/
  200. speculation-rules/
  201. speech-api/
  202. storage/
  203. storage-access-api/
  204. streams/
  205. subapps/
  206. subresource-integrity/
  207. svg/
  208. svg-aam/
  209. timing-entrytypes-registry/
  210. tools/
  211. top-level-storage-access-api/
  212. touch-events/
  213. trust-tokens/
  214. trusted-types/
  215. ua-client-hints/
  216. uievents/
  217. upgrade-insecure-requests/
  218. url/
  219. urlpattern/
  220. user-timing/
  221. vibration/
  222. video-rvfc/
  223. virtual-keyboard/
  224. visual-viewport/
  225. wai-aria/
  226. wasm/
  227. web-animations/
  228. web-bundle/
  229. web-locks/
  230. web-nfc/
  231. web-otp/
  232. web-share/
  233. webaudio/
  234. webauthn/
  235. webcodecs/
  236. WebCryptoAPI/
  237. webdriver/
  238. webgl/
  239. webgpu/
  240. webhid/
  241. webidl/
  242. webmessaging/
  243. webmidi/
  244. webnn/
  245. webrtc/
  246. webrtc-encoded-transform/
  247. webrtc-extensions/
  248. webrtc-ice/
  249. webrtc-identity/
  250. webrtc-priority/
  251. webrtc-stats/
  252. webrtc-svc/
  253. websockets/
  254. webstorage/
  255. webtransport/
  256. webusb/
  257. webvr/
  258. webvtt/
  259. webxr/
  260. window-placement/
  261. workers/
  262. worklets/
  263. x-frame-options/
  264. xhr/
  265. .azure-pipelines.yml
  266. .gitattributes
  267. .gitignore
  268. .mailmap
  269. .taskcluster.yml
  270. CODE_OF_CONDUCT.md
  271. CODEOWNERS
  272. CONTRIBUTING.md
  273. LICENSE.md
  274. lint.ignore
  275. README.md
  276. wpt
  277. wpt.py
README.md

The web-platform-tests Project

Taskcluster CI Status documentation manifest Python 3

The web-platform-tests Project is a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This in turn gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.

The most important sources of information and activity are:

  • github.com/web-platform-tests/wpt: the canonical location of the project's source code revision history and the discussion forum for changes to the code
  • web-platform-tests.org: the documentation website; details how to set up the project, how to write tests, how to give and receive peer review, how to serve as an administrator, and more
  • wpt.live: a public deployment of the test suite, allowing anyone to run the tests by visiting from an Internet-enabled browser of their choice
  • wpt.fyi: an archive of test results collected from an array of web browsers on a regular basis
  • Real-time chat room: the wpt:matrix.org matrix channel; includes participants located around the world, but busiest during the European working day.
  • Mailing list: a public and low-traffic discussion list
  • RFCs: a repo for requesting comments on substantial changes that would impact other stakeholders or users; people who work on WPT infra are encouraged to watch the repo.

If you'd like clarification about anything, don't hesitate to ask in the chat room or on the mailing list.

Setting Up the Repo

Clone or otherwise get https://github.com/web-platform-tests/wpt.

Note: because of the frequent creation and deletion of branches in this repo, it is recommended to “prune” stale branches when fetching updates, i.e. use git pull --prune (or git fetch -p && git merge).

Running the Tests

See the documentation website and in particular the system setup for running tests locally.

Command Line Tools

The wpt command provides a frontend to a variety of tools for working with and running web-platform-tests. Some of the most useful commands are:

  • wpt serve - For starting the wpt http server
  • wpt run - For running tests in a browser
  • wpt lint - For running the lint against all tests
  • wpt manifest - For updating or generating a MANIFEST.json test manifest
  • wpt install - For installing the latest release of a browser or webdriver server on the local machine.
  • wpt serve-wave - For starting the wpt http server and the WAVE test runner. For more details on how to use the WAVE test runner see the documentation.

Windows Notes

On Windows wpt commands must be prefixed with python or the path to the python binary (if python is not in your %PATH%).

python wpt [command]

Alternatively, you may also use Bash on Ubuntu on Windows in the Windows 10 Anniversary Update build, then access your windows partition from there to launch wpt commands.

Please make sure git and your text editor do not automatically convert line endings, as it will cause lint errors. For git, please set git config core.autocrlf false in your working tree.

Publication

The master branch is automatically synced to wpt.live and w3c-test.org.

Contributing

Save the Web, Write Some Tests!

Absolutely everyone is welcome to contribute to test development. No test is too small or too simple, especially if it corresponds to something for which you've noted an interoperability bug in a browser.

The way to contribute is just as usual:

  • Fork this repository (and make sure you're still relatively in sync with it if you forked a while ago).
  • Create a branch for your changes: git checkout -b topic.
  • Make your changes.
  • Run ./wpt lint as described above.
  • Commit locally and push that to your repo.
  • Create a pull request based on the above.

Issues with web-platform-tests

If you spot an issue with a test and are not comfortable providing a pull request per above to fix it, please file a new issue. Thank you!