<commit_before># appsensor-reverse-proxy
Reverse proxy to front-end appsensor (https://github.com/jtmelton/appsensor) and implement various detection points (found at https://www.owasp.org/index.php/AppSensor_DetectionPoints)

### Compiling for Docker
```
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o $GOPATH/appsensor-reverse-proxy
```

## Usage
This application gets built as a standalone binary (named appsensor-reverse-proxy). 

When running the reverse proxy, there are a number of parameters you can use to enable different features. 

Here's an example execution with several of the features enabled: 

`appsensor-reverse-proxy -logtostderr=true -enable-blocking=true -enable-tls=true -enable-trend-tracking -blocking-blocks-refresh-url=http://localhost:8090/api/v1.0/blocks -enable-invalid-verb-checking=true -enable-unexpected-verb-checking=true -resource-verbs-mapping-file=testdata/sample-resource-verbs-mapping.yml -enable-unexpected-resource-checking=true -resources-file=testdata/sample-resources.yml`

Below is an example of running in docker, you can load in your own configuarion files with `-e resource-verbs-mapping-file=/your/verbmappings.yml` this example defaults to the samples in the testdata folder. 

To run in a container you'll need to build the proxy with this command
```
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o $GOPATH/appsensor-reverse-proxy
```

Once it is built run the image like this
```
docker run -d -p 80:8080 appsensor/reverse-proxy -logtostderr=true -enable-blocking=true -enable-tls=false -enable-trend-tracking -blocking-blocks-refresh-url=http://localhost:8090/api/v1.0/blocks -enable-invalid-verb-checking=true -enable-unexpected-verb-checking=true -enable-unexpected-resource-checking=true
```

Below is an explanation of each of the flags you can send. 

1. `--help`
   
  You can always run `--help` to get an accurate list of the flags available to you no matter what version you're running. 

2. `-url string`
   
  As this is a reverse proxy, we need a url to "forward" requests to. This is represented by the specified url which includes the protocol,host and the port (default `http://127.0.0.1:8080`)

3. `-port string`
   <commit_msg>style changes<commit_after># appsensor-reverse-proxy
Reverse proxy to front-end appsensor (https://github.com/jtmelton/appsensor) and implement various detection points (found at https://www.owasp.org/index.php/AppSensor_DetectionPoints)

## Examples and Usage
This application gets built as a standalone binary (named appsensor-reverse-proxy). 

When running the reverse proxy, there are a number of parameters you can use to enable different features. 

*Here's an example execution with several of the features enabled:* 

`appsensor-reverse-proxy -logtostderr=true -enable-blocking=true -enable-tls=true -enable-trend-tracking -blocking-blocks-refresh-url=http://localhost:8090/api/v1.0/blocks -enable-invalid-verb-checking=true -enable-unexpected-verb-checking=true -resource-verbs-mapping-file=testdata/sample-resource-verbs-mapping.yml -enable-unexpected-resource-checking=true -resources-file=testdata/sample-resources.yml`

*Below is an example of running in docker*

`docker run -d -p 80:8080 appsensor/reverse-proxy -logtostderr=true -enable-blocking=true -enable-tls=false -enable-trend-tracking -blocking-blocks-refresh-url=http://localhost:8090/api/v1.0/blocks -enable-invalid-verb-checking=true -enable-unexpected-verb-checking=true -enable-unexpected-resource-checking=true`

You can load in your own configuarion files with -e in the docker command. The example defaults to the samples in the testdata folder.
```
-e resource-verbs-mapping-file=/your/verbmappings.yml -e resources-file=/your/resourcemappings.yml
```      

To run in a container you'll need to build the proxy with this command
```
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o $GOPATH/appsensor-reverse-proxy
```

Then build the container
```
docker build -t appsensor/reverse-proxy .
```

*Below is an explanation the flags you can send*

1. `--help`
   
  You can always run `--help` to get an accurate list of the flags available to you no matter what version you're running. 

2. `-url string`
   
  As this is a reverse proxy, we need a url to "forward" requests to. This is represented by the specified url which includes the protocol,host and the port (default `http://127.0.0.1:8080`)

3. `-port string`
   
{'fraction_non_alphanumeric': 0.10326944757609921, 'fraction_numerical': 0.014656144306651634, 'mean_word_length': 4.49009900990099, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2575164', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1296, 'n_words': 444}