annotate runtime/indent/README.txt @ 33664:06b59278bfcf v9.0.2070

patch 9.0.2070: [security] disallow setting env in restricted mode Commit: https://github.com/vim/vim/commit/6b89dd6a7257a1e2e9c7ea070b407bc4674a5118 Author: Christian Brabandt <cb@256bit.org> Date: Thu Oct 26 22:14:17 2023 +0200 patch 9.0.2070: [security] disallow setting env in restricted mode Problem: [security] disallow setting env in restricted mode Solution: Setting environment variables in restricted mode could potentially be used to execute shell commands. Disallow this. restricted mode: disable allow setting of environment variables Setting environment variables in restricted mode, may have some unwanted consequences. So, for example by setting $GCONV_PATH in restricted mode and then calling the iconv() function, one may be able to execute some unwanted payload, because the `iconv_open()` function internally uses the `$GCONV_PATH` variable to find its conversion data. So let's disable setting environment variables, even so this is no complete protection, since we are not clearing the existing environment. I tried a few ways but wasn't successful :( One could also argue to disable the iconv() function completely in restricted mode, but who knows what other API functions can be influenced by setting some other unrelated environment variables. So let's leave it as it is currently. closes: #13394 See: https://huntr.com/bounties/b0a2eda1-459c-4e36-98e6-0cc7d7faccfe/ Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 26 Oct 2023 22:30:03 +0200
parents 1b862a461d93
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 This directory contains files to automatically compute the indent for a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 type of file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 If you want to add your own indent file for your personal use, read the docs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 at ":help indent-expression". Looking at the existing files should give you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 inspiration.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 If you make a new indent file which would be useful for others, please send it
32770
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 28517
diff changeset
9 to the vim-dev mailing list <vim-dev@vim.org>. Include instructions for
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 28517
diff changeset
10 detecting the file type for this language, by file name extension or by
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 28517
diff changeset
11 checking a few lines in the file. And please stick to the rules below.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 If you have remarks about an existing file, send them to the maintainer of
32779
1b862a461d93 runtime: Remove Brams email in indent/README.txt
Christian Brabandt <cb@256bit.org>
parents: 32774
diff changeset
14 that file. Only when you get no response send a message to the vim-dev
1b862a461d93 runtime: Remove Brams email in indent/README.txt
Christian Brabandt <cb@256bit.org>
parents: 32774
diff changeset
15 mailing list: <vim-dev@vim.org>.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 If you are the maintainer of an indent file and make improvements, e-mail the
32774
1b2730ece70e runtime: Add a few more remarks about Bram and new runtime files
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
18 new version to the vim-dev mailing list: <vim-dev@vim.org>.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 Rules for making an indent file:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 You should use this check for "b:did_indent":
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 " Only load this indent file when no other was loaded yet.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 Always use ":setlocal" to set 'indentexpr'. This avoids it being carried over
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 to other buffers.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 To trigger the indenting after typing a word like "endif", add the word to the
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14970
diff changeset
35 'indentkeys' option with "+=".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 You normally set 'indentexpr' to evaluate a function and then define that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 function. That function only needs to be defined once for as long as Vim is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 running. Add a test if the function exists and use ":finish", like this:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 if exists("*GetMyIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 The user may have several options set unlike you, try to write the file such
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 that it works with any option settings. Also be aware of certain features not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 being compiled in.
14970
19b757c6c6a7 patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents: 7
diff changeset
47
19b757c6c6a7 patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents: 7
diff changeset
48 To test the indent file, see testdir/README.txt.