Closed artemy-osipov closed 11 months ago
Thanks for reporting this. As you looked up in the docs correctly, the attribute allow-uri-read
needs to be placed on the command line or the Asciidoctor API. It can't be specified in the document or include. I assume this has been done for security reasons.
As the .asciidoctorconfig
file works like an include, allow-uri-read
doesn't work there.
Adding it to the plugin's settings is the way to go.
I wonder how the user experience for this can be improved. Some options I see, please add more ideas:
allow-uri-read
is set in a file.asciidoctorconfig
file, instead show a warningI'm looking forward to your ideas and suggestions. Thanks!
Thanks for the quick response
Unfortunately, this bug leads to inconsistency between actual asciidoc generation via gradle plugin and IDEA preview
To improve the user experience, I think the following options could be considered
.asciidoctorconfig
file as Asciidoc attributes rather than document attributes. This will strengthen consistency with the gradle plugin and with the settings in IDEA and give more flexibility in specifying options. There may be some security concerns, but as far as I understand safe mode is introduced for this. Also, these attributes are not applied implicitly, but are taken from a file with an explicit list of attributes.asciidoctor/lib
interpret some options from the .asciidoctorconfig file as Asciidoc attributes rather than document attributes.
I agree this would be ideal, particularly security-related settings like allow-uri-read. I view the asciidoctorconfig file more as an API entry point than as an include.
Btw, "Asciidoc attributes rather than document attributes" is not the correct terminology. In both cases, they are document attributes. It would be correct to say security document attributes (see https://docs.asciidoctor.org/asciidoc/latest/attributes/document-attributes-ref/#security-attributes).
@artemy-osipov - yes, I can see the inconsistency there. Still, .asciidoctorconfig
works like an include/document: you can use for example ifdef
s, and include other documents/snippets. This functionality is in the way of interpreting the file as you suggest.
add integration to specify AsciiDoc attributes via a separate file
If someone would promote/support such a configuration file in Asciidoctor, and if such a configuration file would solve a case/add value by for example supporting allow-uri-read
, I'd be happy to support it in the plugin.
For those using Antora, there is already a structured way to supply attributes via a YAML file, and as far as I know allow-uri-read
is set via API there.
I'll probably pursue the path an editor notification that detects the situation and asks the user to update the settings via a quick-fix.
For those using Antora, there is already a structured way to supply attributes via a YAML file, and as far as I know allow-uri-read is set via API there.
:+1:
If someone would promote/support such a configuration file in Asciidoctor
My idea here is to mirror exactly what Antora is doing (in fact, Antora is that model). The schema of the asciidoc key would become a top-level YAML file to configure Asciidoctor. It's just a matter of tooling recognizing it.
If someone would promote/support such a configuration file in Asciidoctor, and if such a configuration file would solve a case/add value by for example supporting
allow-uri-read
, I'd be happy to support it in the plugin
It does seem to be the best option. Some file similar to .asciidoctorconfig
but with a stricter structure (ex. yaml) in which you can set asciidoctor attributes/security-related settings and potentially many others (IDEA plugin settings/VSCode extension settings/etc). Should I open a separate feature request here?
Closing this issue as no additional steps are planned for the AsciiDoc plugin.
allow-uri-read attribute must be set to include external files https://docs.asciidoctor.org/asciidoc/latest/directives/include-uri/ In addition, it must be specified through Asciidoc attributes https://github.com/asciidoctor/asciidoctorj/issues/71
Observed vs. expected behavior
allow-uri-read attribute is only recognized in the IDEA settings
Steps to reproduce
allow-uri-read
attribute in gradle extensionThe line
:allow-uri-read: true
is successfully added to the file, but the preview only shows a link to a external fileHowever, if you generate documentation (run asciidoc task), the file will be successfully included
If the attribute is set through the IDEA settings, then the preview works fine
Environment
Plugin Version: 0.35.8
IntelliJ Details: