Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
4efe3cf5
Commit
4efe3cf5
authored
Feb 26, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More reasons why prefixing is good
Inspired by
http://www.dwheeler.com/essays/filenames-in-shell.html
parent
f980827b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
doc/development/shell_commands.md
doc/development/shell_commands.md
+5
-0
No files found.
doc/development/shell_commands.md
View file @
4efe3cf5
...
...
@@ -139,6 +139,11 @@ path = File.join(repo_path, user_input)
File.read(path)
```
If you have to use user input a relative path, prefix
`./`
to the path.
Prefixing user-supplied paths also offers extra protection against paths
starting with
`-`
(see the discussion about using
`--`
above).
## Guard against path traversal
Path traversal is a security where the program (GitLab) tries to restrict user
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment