Network Working Group | G. Bedford, Ed. |
Internet-Draft | Verve Interactive Pty Ltd |
Intended status: Informational | November 17, 2019 |
Expires: May 20, 2020 |
application/importmap+json MIME Type Registration
draft-bedford-app-importmap-media-reg-00
Media type registration for JSON import map definitions that control the behavior of JavaScript imports.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on May 20, 2020.
Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
This memo defines a media type Section 4.1 for application/importmap+json.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
{ "imports": { "pkg": "/lib/pkg/main.js" } }
<script type="importmap" src="/application.importmap"></script> <script type="module"> // loads /lib/pkg/main.js import pkg from 'pkg'; </script>
An example application.importmap, following the import maps specification (https://wicg.github.io/import-maps/) can be written:
The following security considerations apply when using application/importmap+json: Control of the import map should be considered to be a form of execution-level application control. This is because import maps have the ability to direct which module resolutions are to be provided for all module import specifiers in a given JavaScript environment, including for example the ability to map arbitrary import specifiers into data: URLs. Integration with existing policy systems, such as CORS and CSP, can be used to mitigate and restrict unwanted target URLs from being executed. The import maps specification states that only those import maps served to browsers with the `application/importmap+json` MIME type will be executed allowing for server-level control of import map deployment to mitigate unintended usage in browsers.
This document defines a single action for IANA:
The application/importmap+json Media Type is defined as follows:
Thanks to Domenic Denicola for their work in specifying import maps and the browser integration of JavaScript modules.
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997. |
[RFC8174] | Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017. |
[RFC8259] | Bray, T., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, December 2017. |
[W3C.WD-CSP3] | Kesteren, A., "Content Security Policy Level 3", World Wide Web Consortium CR WD-CSP3, February 2019. |
[WHATWG-fetch] | Kesteren, A., "Fetch Standard - CORS Protocol", WHATWG Living Standard WHATWG-fetch, October 2019. |