Skip to content

Commit 0c37fa6

Browse files
committed
Path Manipulation while file delete
1 parent 17f583b commit 0c37fa6

File tree

22 files changed

+1029
-0
lines changed

22 files changed

+1029
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Path Manipulation while File Read or while File Download
2+
3+
This logic is helpful while you are facing the ___Path Manipulation___ issue in the File Download/Read functionality.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Path Manipulation
2+
3+
This maven project is to help to mitigate the path manipulation issues. You can use the logic in the [DownloadController.java](filedelete.pathmanipulation/src/main/java/securecodingexamples/filedelete/pathmanipulation/DeleteController.java) in your local [Maven](https://maven.apache.org/), [Gradle](https://gradle.org/) or other Java Applications.
4+
5+
## Code Structure
6+
7+
[HomeController](filedelete.pathmanipulation/src/main/java/securecodingexamples/filedelete/pathmanipulation/HomeController.java) file serves the [index.html](filedelete.pathmanipulation/src/main/resources/templates/index.html) to serve as the Fronted for the File Upload.
8+
9+
[DownloadController.java](filedelete.pathmanipulation/src/main/java/securecodingexamples/filedelete/pathmanipulation/DeleteController.java) file contains the logic for the file Upload and the Filename validation, Extension Validation during the File Upload.
10+
11+
[resources/templates](filedelete.pathmanipulation/src/main/resources/templates/) Directory contains the index.html.
12+
13+
Please note that this project will try to fetch the files from your ***TEMP/Uploads*** directory. You can either manually create your files in the directory, or you can navigate to [Path Manipulation while File Upload Java Project](../../while%20File%20Upload/java/) and follow the installation steps and Upload the test files.
14+
15+
*TEMP : temporary Folder in your OS*
16+
17+
*%TEMP% Directory in Windows*
18+
19+
*/tmp Directory in Linux/MacOS*
20+
21+
## Installation
22+
1. Clone the repository:
23+
```sh
24+
git clone https://github.com/sahildari/secure-coding-examples
25+
cd 'Path Manipulation/while File Read/java/fileread.pathmanipulation'
26+
```
27+
2. Install the package:
28+
29+
**MacOS/Linux:**
30+
```sh
31+
./mvnw clean spring-boot:run
32+
```
33+
34+
**Windows:**
35+
```sh
36+
./mvnw.cmd clean spring-boot:run
37+
```
38+
3. Open in Browser:
39+
```
40+
http://127.0.0.1:8080
41+
```
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

Path Manipulation/while File Delete/java/filedelete.pathmanipulation/mvnw

Lines changed: 259 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)