The source of the claim is in the Docutils documentation, at https://docutils.sourceforge.io/docs/ref/rst/directives.html#include:
Warning
The "include" directive represents a potential security hole. It can be disabled with the "file_insertion_enabled" runtime setting.
What exactly is it that I should be concerned about, and if it's a potential security hole why hasn't it been removed?
To understand the security risks, you need to build up a specific context, such as generating a web site from Sphinx files.
First, in .rst files people can write bad JavaScript code in
rawdirective,Second,
includedirective allows you to include files you might not fully controlled (for example, a file from an external storage, or simply out of your working directory).So, if you didn't pay enough attention to what you include and someone really hacks the contents included in your Sphinx files, then the final generated sites can contain malicious code and harm the end users who view those pages.
To minimize such risks, clearly
includecompletely as that documentation page says, but you lose this useful feature.