diff options
author | Luca Milanesio <luca.milanesio@gmail.com> | 2023-06-19 14:56:52 +0100 |
---|---|---|
committer | Luca Milanesio <luca.milanesio@gmail.com> | 2023-11-23 12:00:36 +0000 |
commit | dcd5bbe011f4ddd4dd7655c56b350c94d9424c85 (patch) | |
tree | f688cef3491f0abcb5a8ab036f43f989f640ca57 | |
parent | 82544a059c34ad843099939a24f389888d6ba7c5 (diff) |
Introduce Documentation:searchfree_safe with local-only fonts
Gerrit documentation uses asciidoc webfonts [1] which can be flagged
as a security issue because of Content Security Policies [2].
[1] https://docs.asciidoctor.org/asciidoctor/latest/html-backend/default-stylesheet/#disable-or-modify-the-web-fonts
[2] https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
Release-Notes: Allow generating safe local-only documentation
Change-Id: Ide4369ca19473822fc5305aa0fc21665a2bc6f0c
-rw-r--r-- | Documentation/BUILD | 10 | ||||
-rw-r--r-- | Documentation/dev-bazel.txt | 13 | ||||
-rw-r--r-- | tools/bzl/asciidoc.bzl | 3 |
3 files changed, 25 insertions, 1 deletions
diff --git a/Documentation/BUILD b/Documentation/BUILD index af355ca56d..85ddbe7413 100644 --- a/Documentation/BUILD +++ b/Documentation/BUILD @@ -126,3 +126,13 @@ genasciidoc_zip( directory = DOC_DIR, searchbox = False, ) + +genasciidoc_zip( + name = "searchfree_safe", + srcs = SRCS, + attributes = documentation_attributes(), + backend = "html5", + directory = DOC_DIR, + searchbox = False, + webfonts = False, +) diff --git a/Documentation/dev-bazel.txt b/Documentation/dev-bazel.txt index 08529dfcba..a2bd6fca6e 100644 --- a/Documentation/dev-bazel.txt +++ b/Documentation/dev-bazel.txt @@ -225,6 +225,19 @@ The html files will be bundled into `searchfree.zip` in this location: bazel-bin/Documentation/searchfree.zip ---- +To use local fonts with the searchfree target: + +---- + bazel build Documentation:searchfree_safe +---- + +The html files will be bundled into `searchfree.zip` or `searchfree_safe.zip` in this location: + +---- + bazel-bin/Documentation/searchfree.zip + bazel-bin/Documentation/searchfree_safe.zip +---- + To generate HTML files skipping the zip archiving: ---- diff --git a/tools/bzl/asciidoc.bzl b/tools/bzl/asciidoc.bzl index 7977cf051d..d6b6d6320c 100644 --- a/tools/bzl/asciidoc.bzl +++ b/tools/bzl/asciidoc.bzl @@ -300,13 +300,14 @@ def genasciidoc_zip( backend = None, searchbox = True, resources = True, + webfonts = True, **kwargs): SUFFIX = "_htmlonly" _genasciidoc_htmlonly_zip( name = name + SUFFIX if resources else name, srcs = srcs, - attributes = attributes, + attributes = attributes + [] if webfonts else ["webfonts!"], backend = backend, searchbox = searchbox, **kwargs |