URL รายการที่อนุญาต
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
คุณใช้รายการที่อนุญาตเพื่อกำหนด URL ที่เฉพาะเจาะจงซึ่งได้รับอนุมัติล่วงหน้าสำหรับการเข้าถึง
โดยสคริปต์หรือส่วนเสริม รายการที่อนุญาตช่วยปกป้องข้อมูลผู้ใช้ เมื่อกำหนดรายการที่อนุญาต โปรเจ็กต์สคริปต์จะเข้าถึง URL ที่ไม่ได้เพิ่มลงในรายการที่อนุญาตไม่ได้
ฟิลด์นี้ไม่บังคับเมื่อติดตั้งการติดตั้งใช้งานทดสอบ แต่จำเป็นเมื่อ
สร้างการติดตั้งใช้งานที่มีการควบคุมเวอร์ชัน
คุณใช้รายการที่อนุญาตเมื่อสคริปต์หรือส่วนเสริมดำเนินการต่อไปนี้
- ดึงข้อมูลจากตำแหน่งภายนอก (เช่น จุดสิ้นสุด HTTPS) โดยใช้บริการ
UrlFetch
ของ Apps Script หากต้องการเพิ่ม URL ลงในรายการที่อนุญาตสำหรับการดึงข้อมูล ให้ใส่ฟิลด์ urlFetchWhitelist
ในไฟล์ Manifest
- เปิดหรือแสดง URL เพื่อตอบสนองต่อการกระทําของผู้ใช้ (ต้องระบุสําหรับส่วนเสริมของ Google Workspace ที่เปิดหรือแสดง URL ที่อยู่นอก Google) หากต้องการเพิ่ม URL ลงในรายการที่อนุญาตเพื่อเปิด ให้ใส่ฟิลด์
addOns.common.openLinkUrlPrefixes
ในไฟล์ Manifest
การเพิ่มคำนำหน้าไปยังรายการที่อนุญาต
เมื่อระบุรายการที่อนุญาตในไฟล์ Manifest (โดยรวมฟิลด์
addOns.common.openLinkUrlPrefixes
หรือ urlFetchWhitelist
) คุณต้อง
รวมรายการคำนำหน้า URL คำนำหน้าที่คุณเพิ่มลงในไฟล์ Manifest ต้องเป็นไปตามข้อกำหนดต่อไปนี้
- แต่ละคำนำหน้าต้องเป็น URL ที่ถูกต้อง
- แต่ละคำนำหน้าต้องใช้
https://
ไม่ใช่ http://
- โดยแต่ละคำนำหน้าต้องมีโดเมนแบบเต็ม
- แต่ละคำนำหน้าต้องมีเส้นทางที่ไม่ว่าง ตัวอย่างเช่น
https://www.google.com/
ใช้ได้ แต่ https://www.google.com
ใช้ไม่ได้
- คุณใช้ไวลด์การ์ดเพื่อจับคู่คำนำหน้าโดเมนย่อยของ URL ได้
- คุณใช้
*
ไวลด์การ์ด 1 ตัวในช่อง
addOns.common.openLinkUrlPrefixes
เพื่อจับคู่ลิงก์ทั้งหมดได้ แต่เราไม่แนะนำให้ทำเช่นนี้เนื่องจากอาจทำให้ข้อมูลของผู้ใช้มีความเสี่ยงและอาจทำให้กระบวนการตรวจสอบส่วนเสริมนานขึ้น ใช้
อักขระไวด์การ์ดเฉพาะในกรณีที่ฟังก์ชันการทำงานของส่วนเสริมจำเป็นต้องใช้
เมื่อพิจารณาว่า URL ตรงกับคำนำหน้าในรายการที่อนุญาตหรือไม่ กฎต่อไปนี้จะมีผล
- การจับคู่เส้นทางจะคำนึงถึงตัวพิมพ์เล็กและตัวพิมพ์ใหญ่
- หากคำนำหน้าเหมือนกับ URL ทุกประการ แสดงว่าตรงกัน
- หาก URL เหมือนกันหรือเป็น URL ย่อยของคำนำหน้า ระบบจะถือว่าตรงกัน
เช่น คำนำหน้า https://example.com/foo
จะตรงกับ URL ต่อไปนี้
https://example.com/foo
https://example.com/foo/
https://example.com/foo/bar
https://example.com/foo?bar
https://example.com/foo#bar
การใช้ไวลด์การ์ด
คุณสามารถใช้อักขระไวลด์การ์ดตัวเดียว (*
) เพื่อจับคู่โดเมนย่อยสำหรับทั้งฟิลด์
urlFetchWhitelist
และฟิลด์ addOns.common.openLinkUrlPrefixes
คุณใช้สัญลักษณ์แทนมากกว่า 1 รายการเพื่อจับคู่โดเมนย่อยหลายรายการไม่ได้ และสัญลักษณ์แทนต้องแสดงคำนำหน้า URL
ตัวอย่างเช่น คำนำหน้า https://*.example.com/foo
จะตรงกับ URL ต่อไปนี้
https://subdomain.example.com/foo
https://any.number.of.subdomains.example.com/foo
คำนำหน้า https://*.example.com/foo
ไม่ตรงกับ URL ต่อไปนี้
https://subdomain.example.com/bar
(คำต่อท้ายไม่ตรงกัน)
https://example.com/foo
(ต้องมีโดเมนย่อยอย่างน้อย 1 รายการ)
ระบบจะบังคับใช้กฎคำนำหน้าบางอย่างเมื่อคุณพยายามบันทึกไฟล์ Manifest ตัวอย่างเช่น คำนำหน้าต่อไปนี้จะทำให้เกิดข้อผิดพลาดหากมีอยู่ใน
ไฟล์ Manifest เมื่อคุณพยายามบันทึก
https://*.*.example.com/foo
(ไม่อนุญาตให้ใช้ไวลด์การ์ดหลายรายการ)
https://subdomain.*.example.com/foo
(ต้องใช้ไวลด์การ์ดเป็นตัวอักษรขึ้นต้น)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[[["\u003cp\u003eAllowlists specify approved URLs for your script or add-on to access, enhancing user data protection by restricting access to unlisted URLs.\u003c/p\u003e\n"],["\u003cp\u003eAllowlists are necessary for scripts that fetch external data or open external links, especially for versioned deployments and Google Workspace Add-ons.\u003c/p\u003e\n"],["\u003cp\u003eWhen defining allowlists, use HTTPS prefixes with full domains, non-empty paths, and optional wildcards for subdomains, ensuring adherence to specific formatting rules.\u003c/p\u003e\n"],["\u003cp\u003eAllowlist prefixes are matched against URLs based on case-sensitive path comparisons, allowing access to identical URLs or child paths of the prefix.\u003c/p\u003e\n"],["\u003cp\u003eWildcards can represent subdomains in allowlist prefixes but must be used as the leading prefix and cannot be used to match multiple subdomains simultaneously.\u003c/p\u003e\n"]]],[],null,["# Allowlist URLs\n\nYou use allowlists to designate specific URLs that are pre-approved for access\nby your script or add-on. Allowlists help protect user\ndata; when you define an allowlist, script projects can't access URLs that have\nnot been added to the allowlist.\n\nThis field is optional when you install a test deployment, but is required when\nyou create a versioned deployment.\n\nYou use allowlists when your script or add-on performs\nthe following actions:\n\n- Retrieves or fetches information from an external location (such as HTTPS endpoints) using the Apps Script [`UrlFetch`](/apps-script/reference/url-fetch) service. To allowlist URLs for fetching, include the [`urlFetchWhitelist`](/apps-script/manifest#Manifest.FIELDS.urlFetchWhitelist) field in your manifest file.\n- Opens or displays a URL in response to a user action (Required for Google Workspace add-ons that open or display URLs that are external to Google). To allowlist URLs for opening, include the [`addOns.common.openLinkUrlPrefixes`](/apps-script/manifest/addons#Common.FIELDS.openLinkUrlPrefixes) field in your manifest file.\n\n| **Note:** *Whitelist* , as used in [`urlFetchWhitelist`](/apps-script/manifest#Manifest.FIELDS.urlFetchWhitelist), is a deprecated term that is synonymous with and replaced by *allowlist* . For more information, see [Writing inclusive documentation](https://developers.google.com/style/inclusive-documentation).\n\n### Adding prefixes to your allowlist\n\nWhen you specify allowlists in your manifest file (by including either the\n`addOns.common.openLinkUrlPrefixes` or `urlFetchWhitelist` field), you must\ninclude a list of URL prefixes. The prefixes you add to the manifest must\nsatisfy the following requirements:\n\n- Each prefix must be a valid URL.\n- Each prefix must use `https://`, not `http://`.\n- Each prefix must have a full domain.\n- Each prefix must have a non-empty path. For example, `https://www.google.com/` is valid but `https://www.google.com` is not.\n- You can use [wildcards](#using_wildcards) to match URL subdomain prefixes.\n- A single `*` wildcard can be used in the [`addOns.common.openLinkUrlPrefixes`](/apps-script/manifest/addons#Common.FIELDS.openLinkUrlPrefixes) field to match all links, but this is not recommended as it can expose a user's data to risk and can prolong the [add-on review](/workspace/add-ons/concepts/gsuite-addon-review) process. Only use a wildcard if your add-on functionality requires it.\n\nWhen determining if a URL matches a prefix in the allowlist, the following rules\napply:\n\n- Path matching is case-sensitive.\n- If the prefix is identical to the URL, it is a match.\n- If the URL is the same or a child of the prefix, it is a match.\n\nFor example, the prefix `https://example.com/foo` matches the following URLs:\n\n- `https://example.com/foo`\n- `https://example.com/foo/`\n- `https://example.com/foo/bar`\n- `https://example.com/foo?bar`\n- `https://example.com/foo#bar`\n\n### Using wildcards\n\nYou can use a single wildcard character (`*`) to match a subdomain for both the\n[`urlFetchWhitelist`](/apps-script/manifest#Manifest.FIELDS.urlFetchWhitelist)\nand [`addOns.common.openLinkUrlPrefixes`](/apps-script/manifest/addons#Common.FIELDS.openLinkUrlPrefixes)\nfields. You can't use more than one wildcard to match multiple subdomains, and\nthe wildcard must represent the leading prefix of the URL.\n\nFor example, the prefix `https://*.example.com/foo` matches the following\nURLs:\n\n- `https://subdomain.example.com/foo`\n- `https://any.number.of.subdomains.example.com/foo`\n\nThe prefix `https://*.example.com/foo` *doesn't* match the following\nURLs:\n\n- `https://subdomain.example.com/bar` (suffix mismatch)\n- `https://example.com/foo` (at least one subdomain must be present)\n\nSome of the prefix rules are enforced when you try to save your manifest. For\nexample, the following prefixes cause an error if they are present in your\nmanifest when you attempt to save:\n\n- `https://*.*.example.com/foo` (multiple wildcards are forbidden)\n- `https://subdomain.*.example.com/foo` (wildcards must be used as a leading prefix)"]]