[MDEV-23875] select into outfile not respect UMASK and UMASK_DIR Created: 2020-10-02 Updated: 2021-04-19 Resolved: 2020-12-31 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.1, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.2.37, 10.3.28, 10.4.18, 10.5.9 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Richard Stracke | Assignee: | Rucha Deodhar |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
select into outfile creates files everytime with 666 permission, regardsless if umask environment variables and umask settings on OS level. It seems hardcoded.
It should use my_umask instead to respect UMASK and UMASK_DIR environment variables. |
| Comments |
| Comment by Assen Totin (Inactive) [ 2020-10-06 ] |
|
I disagree about UMASK and UMASK_DIR environment variables. First, these are not masks, but file creation modes, which is quite confusing and bad. Second, using a MariaDB configuration variable will be much better, because:
|
| Comment by Sergei Golubchik [ 2020-10-16 ] |
|
MySQL simply changed the hardcoded 0666 to hardcoded 0640 |
| Comment by Sergei Golubchik [ 2020-10-16 ] |
|
Supposedly the server always used 0666 (at least since MySQL 3.20.13, March 1997) because mysqld is normally running under mysql:mysql, so unless files are 0666 they won't be of much use. Which is very different from UMASK, that sets the mode for table and frm files — files that should not be readable outside of mysql:mysql |
| Comment by Assen Totin (Inactive) [ 2020-10-16 ] |
|
The main issue with the 666 mode is the last digit. Security auditors are quite unhappy with world-writable files. If making this configurable is not an option right now, at least change the mode to 644 - it will still let anybody consume the file while not letting it change it. |
| Comment by Sergei Golubchik [ 2020-10-16 ] |
|
So, changing to 0640 makes absolutely no sense to me. Using UMASK makes no sense either. New umask server variable does, but it really seems an overkill here. One can simply create a new directory and let the server write there. The small change that I think we, probably, should do still is to change 0666 to 0664 |
| Comment by Sergei Golubchik [ 2020-10-16 ] |
|
or 644 indeed |
| Comment by Rucha Deodhar [ 2020-12-29 ] |
|
patch: https://github.com/MariaDB/server/commit/dbb2938a73b86f6df080786da0f2c9b104470352 |
| Comment by Sergei Golubchik [ 2020-12-30 ] |
|
ok to push |