Commit 9462ec23 authored by Dominick Ng's avatar Dominick Ng Committed by Commit Bot

Implement a fuzzer for the Web App Manifest.

BUG=1012164
TBR=jbroman@chromium.org

Change-Id: I58df8af772f651520a321c67f90f96f945f721dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1855620
Commit-Queue: Dominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarMax Moroz <mmoroz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705790}
parent 7249b405
......@@ -484,6 +484,20 @@ group("mediastream_unittests_data") {
]
}
fuzzer_test("web_app_manifest_fuzzer") {
sources = [
"manifest/manifest_fuzzer.cc",
]
dict = "manifest/manifest_fuzzer.dict"
seed_corpus = "manifest/fuzzer_seed_corpus"
deps = [
":modules",
"//third_party/blink/renderer/platform:blink_fuzzer_test_support",
]
}
if (use_libfuzzer) {
fuzzer_test("media_capabilities_fuzzer") {
sources = [
......
{ "name": "Manifest test app", "start_url": "manifest_test_page.html", "icons": [ { "src": "launcher-icon-1x.png", "sizes": "48x48", "type": "image/png" }, { "src": "image-512px.png", "sizes": "512x512", "type": "image/png" } ], "display": "standalone", "orientation": "landscape" }
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
}
],
"start_url": "manifest_test_page.html",
"file_handler": {
"action": "/files"
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
}
],
"start_url": "manifest_test_page.html",
"file_handler": {
"action": "/files",
"files": []
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
}
],
"start_url": "manifest_test_page.html",
"file_handler": {
"action": "/files",
"files": [{
"name": "name",
"accept": "image/png"
}]
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
}
],
"start_url": "manifest_test_page.html",
"file_handler": {
"files": [{
"name": "name",
"accept": "image/png"
}]
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
}
],
"start_url": "manifest_test_page.html",
"file_handler": {
"files": [{
"name": "name",
"accept": ["image/png", "image/jpg"]
}]
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
}
],
"start_url": "manifest_test_page.html",
"file_handler": {
"files": [
{
"name": "name",
"accept": ["image/png", "image/jpg"]
},
{
"name": "svgish",
"accept": [".svg", "xml/svg"]
}
]
}
}
{
"name": "Manifest listing related android app",
"icons": [
{
"src": "/banners/image-512px.png",
"sizes": "512x512",
"type": "image/png"
}
],
"scope": ".",
"start_url": ".",
"display": "standalone",
"prefer_related_applications": false,
"related_applications": [{
"platform": "play",
"id": "com.example.app"
}]
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "launcher-icon-3x.png",
"sizes": "144x144",
"type": "image/png",
"purpose": "maskable"
}
],
"scope": "/",
"start_url": "manifest_test_page.html",
"display": "standalone"
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "badge"
}
],
"start_url": "/",
"display": "standalone",
"display": "minimal-ui"
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "manifest_test_page.html",
"share_target": {}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "manifest_test_page.html",
"share_target": {
"action": ""
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "manifest_test_page.html",
"share_target": {
"params": {}
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "manifest_test_page.html",
"share_target": {
"action": "https://example.com/",
"params": {}
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "manifest_test_page.html",
"share_target": {
"action": "share/",
"params": {}
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "manifest_test_page.html",
"share_target": {
"action": "share/blah/",
"params": {
"text": "foo",
"title": "bar",
"url": "baz"
}
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "manifest_test_page.html",
"share_target": {
"url_template": "https://whatever.test/share?title={title}",
"action": "share/blah/",
"params": {
"text": "foo",
"title": "bar",
"url": "baz"
}
}
}
{
"name": "Manifest test app",
"icons": [
{
"src": "launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "manifest_test_page.html",
"share_target": {
"url_template": "https://whatever.test/share?title={title}",
"action": "share/blah/",
"enctype": "application/x-www-form-urlencoded",
"method": "POST",
"params": {
"text": "foo",
"title": "bar",
"url": "baz"
}
}
}
{ "short_name": "Manifest", "start_url": "https://whatever.test/pwa/manifest_test_page.html", "icons": [ { "src": "launcher-icon-1x.png", "sizes": "48x48", "type": "image/png" }, { "src": "image-512px.png", "sizes": "512x512", "type": "image/png" } ], "display": "browser", "orientation": "portrait", "theme_color": "#000", "scope": "https://whatever.test/pwa/" }
{ "short_name": "Manifest", "start_url": "https://example.com/pwa/manifest_test_page.html", "icons": [ { "src": "launcher-icon-1x.png", "sizes": "48x48", "type": "image/png" }, { "src": "image-512px.png", "sizes": "512x512", "type": "image/png" } ], "display": "browser", "orientation": "portrait", "theme_color": "#000", "scope": "https://example.com/pwa/" }
{
"prefer_related_applications": true,
"related_applications": [{
"platform": "play",
"id": "com.google.android.apps.chrome",
"url": "https://play.google.com/store/apps/details?id=123456&referrer=chrome_inline"
}]
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/manifest/manifest_parser.h"
#include "third_party/blink/renderer/platform/testing/blink_fuzzer_test_support.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
// Fuzzer for blink::ManifestParser
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
static BlinkFuzzerTestSupport test_support = BlinkFuzzerTestSupport();
String string = String::FromUTF8(reinterpret_cast<const char*>(data), size);
KURL manifest_url("https://whatever.test/manifest.json");
KURL document_url("https://whatever.test/");
ManifestParser parser(string, manifest_url, document_url);
parser.Parse();
return 0;
}
} // namespace blink
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return blink::LLVMFuzzerTestOneInput(data, size);
}
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"*"
"{"
"}"
"["
"]"
"."
"\".\""
"/"
"\"/\""
"/*"
"true"
"\"true\""
"false"
"\"false\""
"name"
"\"name\""
"short_name"
"\"short_name\""
"icons"
"\"icons\""
"src"
"\"src\""
"type"
"\"type\""
"sizes"
"\"sizes\""
"start_url"
"\"start_url\""
"display"
"\"display\""
"orientation"
"\"orientation\""
"standalone"
"\"standalone\""
"minimal-ui"
"\"minimal-ui\""
"browser"
"\"browser\""
"purpose"
"\"purpose\""
"any"
"\"any\""
"image/png"
"\"image/png\""
"url"
"\"url\""
"platform"
"\"platform\""
"id"
"\"id\""
"related_applications"
"\"related_applications\""
"prefer_related_applications"
"\"prefer_related_applications\""
"theme_color"
"\"theme_color\""
"play"
"\"play\""
"https://example.com/"
"\"https://example.com/\""
"https://example.com/some/path"
"\"https://example.com/some/path\""
"GET"
"\"GET\""
"POST"
"\"POST\""
"action"
"\"action\""
"enctype"
"\"enctype\""
"share_target"
"\"share_target\""
"url_template"
"\"url_template\""
"file_handler"
"\"file_handler\""
"params"
"\"params\""
"application/x-www-form-urlencoded"
"\"application/x-www-form-urlencoded\""
"png"
".png"
"image/png"
"\"image/png\""
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment