Skip to content

Commit 86c9cd7

Browse files
committed
WIP: README updates
1 parent 71f8f42 commit 86c9cd7

File tree

9 files changed

+56
-20
lines changed

9 files changed

+56
-20
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.gradle/
22
.idea/
33
build/
4-
db/
4+
db
55
bin/
66
.classpath
77
.project

README.md

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ docker-compose up -d
2323

2424
### Run
2525
```shell script
26-
java -Djava.security.egd=file:/dev/./urandom -jar build/libs/java-spring-vuly-0.1.0.jar
26+
./gradlew --no-daemon bootRun
2727
```
2828

2929
## Using the Application
@@ -49,7 +49,7 @@ You can log in to the application with the following credentials:
4949
| https://localhost:9000/openapi.yaml | The OpenAPI spec in YAML format |
5050
| https://localhost:9000/swagger-ui.html | The Swagger doc for the OpenAPI spec |
5151

52-
## Scanning
52+
### Security Bugs
5353

5454
A [ZAP](https://www.zaproxy.org/) or [StackHawk](https://www.stackhawk.com/login) scan should uncover these bugs:
5555

@@ -58,58 +58,86 @@ A [ZAP](https://www.zaproxy.org/) or [StackHawk](https://www.stackhawk.com/login
5858
| SQL Injection via search box | `a%'; insert into item values (999, 'bad bad description', 'hacker item name'); select * from item where name like '%banan` |
5959
| Cross Site Scripting via search box | `<script>alert('hey guy');</script>` |
6060

61-
### StackHawk Scan
61+
## Scanning
6262

63-
The following examples will run HawkScan against the JavaSpringVulny app running on localhost and port 9000, which is the default setup. The StackHawk configuration files are already present in this repository.
63+
The following examples will run HawkScan against the JavaSpringVulny app running on localhost and port 9000, which is the default setup. The StackHawk configuration files are already present in this repository in the `stackhawk.d` directory.
6464

6565
You should create a new application in the [StackHawk app](https://app.stackhawk.com/applications) to collect data from these scans. The following environment variables are required for these scans to work:
6666

67-
* `API_KEY`: Your StackHawk API key
68-
* `APP_ID`: The application ID from the [StackHawk app](https://app.stackhawk.com/applications).
67+
* `API_KEY`: Your StackHawk [API key](https://app.stackhawk.com/settings/apikeys)
68+
* `APP_ID`: The [application ID](https://app.stackhawk.com/applications)
69+
70+
For example:
71+
72+
```shell
73+
export API_KEY=<your-StackHawk-API-key>
74+
export APP_ID=<your-StackHawk-App-ID>
75+
```
6976

7077
You can optionally include the following variables to customize the scan.
7178

7279
* `APP_HOST`: The host to scan. Default: https://localhost:9000
73-
* `APP_ENV`: The application environment. Default: Development
80+
* `APP_ENV`: The application environment name.
7481

7582
Baseline scan without authentication:
7683
```shell
84+
# With the CLI
85+
hawk scan stackhawk.d/stackhawk.yml
86+
87+
# With Docker
7788
docker run --tty --rm --network host --volume $(pwd):/hawk \
7889
--env API_KEY \
7990
--env APP_ID \
80-
stackhawk/hawkscan
91+
stackhawk/hawkscan stackhawk.d/stackhawk.yml
8192
```
8293

8394
Scan using web form authentication with a session cookie. [See the docs](https://docs.stackhawk.com/hawkscan/configuration/authenticated-scanning.html#example-usernamepassword-authentication--cookie-authorization) for more information.
8495
```shell
96+
# With the CLI
97+
hawk scan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-form-cookie.yml
98+
99+
# With Docker
85100
docker run --tty --rm --network host --volume $(pwd):/hawk \
86101
--env API_KEY \
87102
--env APP_ID \
88-
stackhawk/hawkscan stackhawk.yml stackhawk.d/stackhawk-auth-form-cookie.yml
103+
stackhawk/hawkscan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-form-cookie.yml
89104
```
90105

91106
Scan using an authorization token retrieved by POSTing credentials to an API endpoint. [See the docs](https://docs.stackhawk.com/hawkscan/configuration/authenticated-scanning.html#usernamepassword-authentication--bearer-token-authorization) for more information.
92107
```shell
108+
# With the CLI
109+
hawk scan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-json-token.yml
110+
111+
# With Docker
93112
docker run --tty --rm --network host --volume $(pwd):/hawk \
94113
--env API_KEY \
95114
--env APP_ID \
96-
stackhawk/hawkscan stackhawk.yml stackhawk.d/stackhawk-auth-json-token.yml
115+
stackhawk/hawkscan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-json-token.yml
97116
```
98117

99118
Scan using an authorization token extracted by an external script. This method can be useful for third-party authentication systems. [See the docs](https://docs.stackhawk.com/hawkscan/configuration/authenticated-scanning.html#example-external-token-authentication--custom-token-authorization) for more information.
100119
```shell
120+
# With the CLI
121+
hawk scan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-external-token.yml
122+
123+
# With Docker
101124
docker run --tty --rm --network host --volume $(pwd):/hawk \
102125
--env API_KEY \
103126
--env APP_ID \
104-
stackhawk/hawkscan stackhawk.yml stackhawk.d/stackhawk-auth-external-token.yml
127+
stackhawk/hawkscan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-external-token.yml
105128
```
106129

107130
Scan using basic authentication, using an external script to derive the correct authorization token. This legacy method is an insecure form of bearer token authentication. [See the docs](https://docs.stackhawk.com/hawkscan/configuration/authenticated-scanning.html#example-external-token-authentication--custom-token-authorization) for more information.
108131
```shell
132+
# With the CLI
133+
export AUTH_TOKEN=$(./scripts/basic-auth.sh)
134+
hawk scan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-basic.yml
135+
136+
# With Docker
109137
export AUTH_TOKEN=$(./scripts/basic-auth.sh)
110138
docker run --tty --rm --network host --volume $(pwd):/hawk \
111139
--env API_KEY \
112140
--env APP_ID \
113141
--env AUTH_TOKEN \
114-
stackhawk/hawkscan stackhawk.yml stackhawk.d/stackhawk-auth-basic.yml
142+
stackhawk/hawkscan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-basic.yml
115143
```

db/vulny.mv.db

-4 KB
Binary file not shown.

stackhawk.d/stackhawk-auth-basic.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
app:
2+
env: ${APP_ENV:Basic Web Auth}
23
authentication:
34
external:
45
type: TOKEN

stackhawk.d/stackhawk-auth-external-jwt.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
app:
2-
env: External Token
3-
api: /openapi
2+
env: ${APP_ENV:JWT Bearer Token}
3+
openApiConf:
4+
path: /openapi
45
authentication:
56
external:
67
type: TOKEN

stackhawk.d/stackhawk-auth-external-token.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
app:
2-
env: External Token
3-
api: /openapi
2+
env: ${APP_ENV:External Token}
3+
openApiConf:
4+
path: /openapi
45
authentication:
56
external:
67
type: TOKEN

stackhawk.d/stackhawk-auth-form-cookie.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
app:
2-
env: Form Cookie
2+
env: ${APP_ENV:Form Cookie}
33
excludePaths:
44
- "/logout"
55
antiCsrfParam: "_csrf"

stackhawk.d/stackhawk-auth-json-token.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
app:
2-
env: JSON Token
3-
api: /openapi
2+
env: ${APP_ENV:JSON Token}
3+
openApiConf:
4+
path: /openapi
45
authentication:
56
usernamePassword:
67
type: JSON

stackhawk.d/stackhawk.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
app:
2+
applicationId: ${APP_ID:dacc7d3e-babc-47d2-b040-ab117ab04526}
3+
env: ${APP_ENV:dev}
4+
host: ${APP_HOST:https://localhost:9000}

0 commit comments

Comments
 (0)