Skip to content

Commit 99ba96e

Browse files
authored
security: restrict content script matches to specific domain in favicon sample (#1610)
* security: restrict content script matches to specific domain instead of <all_urls> * docs: update README to reflect domain restriction
1 parent ddf0e9a commit 99ba96e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

functional-samples/sample.favicon-cs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Fetching a favicon in a content script
22

3-
This example fetches the favicon from www.google.com and inserts it at the top left of every page.
3+
This example fetches the favicon from www.google.com and inserts it at the top left of Google search pages.
44

55
Note: This extension does not work on `chrome://extensions`.
66

@@ -9,7 +9,7 @@ See [Fetching favicons](https://developer.chrome.com/docs/extensions/mv3/favicon
99
## Testing the extension
1010

1111
1. Follow the instructions to load an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked).
12-
2. Navigate to [www.example.com](https://www.example.com/).
12+
2. Navigate to [www.google.com](https://www.google.com/).
1313

1414
It should look like this:
1515

functional-samples/sample.favicon-cs/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "Favicon API in content scripts",
33
"version": "1.1",
4-
"description": "Demonstrates fetching the favicon from www.google.com and inserting it at the top left of every page.",
4+
"description": "Demonstrates fetching the favicon from www.google.com and inserting it at the top left of the specified pages.",
55
"manifest_version": 3,
66
"content_scripts": [
77
{
8-
"matches": ["<all_urls>"],
8+
"matches": ["https://www.google.com/*"],
99
"js": ["content.js"],
1010
"css": ["style.css"]
1111
}
@@ -14,7 +14,7 @@
1414
"web_accessible_resources": [
1515
{
1616
"resources": ["_favicon/*"],
17-
"matches": ["<all_urls>"],
17+
"matches": ["https://www.google.com/*"],
1818
"use_dynamic_url": true
1919
}
2020
]

0 commit comments

Comments
 (0)