Skip to content

Commit

Permalink
Merge pull request #60 from CiscoSecurity/release-2.0.2
Browse files Browse the repository at this point in the history
Release 2.0.2
  • Loading branch information
mstoro authored Aug 25, 2021
2 parents 870f583 + a249837 commit f4560a5
Show file tree
Hide file tree
Showing 9 changed files with 478 additions and 33 deletions.
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
FROM alpine:3.14
LABEL maintainer="Ian Redden <[email protected]>"

ENV PIP_IGNORE_INSTALLED 1

# install packages we need
RUN apk update && apk add --no-cache musl-dev openssl-dev gcc py3-configobj \
supervisor git libffi-dev uwsgi-python3 uwsgi-http jq syslog-ng uwsgi-syslog \
supervisor libffi-dev uwsgi-python3 uwsgi-http jq syslog-ng uwsgi-syslog \
py3-pip python3-dev

# do the Python dependencies
ADD code /app
RUN pip3 install -r /app/requirements.txt
ADD code/Pipfile code/Pipfile.lock /
RUN set -ex && pip install --no-cache-dir --upgrade pipenv && \
pipenv install --system
RUN chown -R uwsgi.uwsgi /etc/uwsgi

# copy over scripts to init
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@ The code is provided here purely for educational purposes.
- We need an application that can be completely self contained within a virtualized container using Docker.

## Testing (Optional)

Open the code folder in your terminal.
```
cd code
```

If you want to test the application you will require Docker and several dependencies from the [requirements.txt](code/requirements.txt) file:
```
pip install --upgrade --requirement code/requirements.txt
pip install --no-cache-dir --upgrade pipenv && pipenv install --dev
```
You can perform two kinds of testing:
- Run static code analysis checking for any semantic discrepancies and [PEP 8](https://www.python.org/dev/peps/pep-0008/) compliance:

`flake8 code`
`flake8 .`

- Run the suite of unit tests and measure the code coverage:
`cd code`
`coverage run --source api/ -m pytest --verbose tests/unit/ && coverage report`

**NOTE.** If you need input data for testing purposes you can use data from the
Expand Down
20 changes: 20 additions & 0 deletions code/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
cryptography = "==3.3.2"
Flask = "==2.0.1"
marshmallow = "==3.12.1"
requests = "==2.25.1"
PyJWT = "==2.1.0"

[dev-packages]
flake8 = "==3.9.2"
coverage = "==5.5"
pytest = "==6.2.4"
freezegun = "==1.1.0"

[requires]
python_version = "3.9"
439 changes: 439 additions & 0 deletions code/Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion code/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
WRONG_KEY = ('Failed to decode JWT with provided key. '
'Make sure domain in custom_jwks_host '
'corresponds to your SecureX instance region.')
JWK_HOST_MISSING = ('jwk_host is missing in JWT payload. Make sure '
JWK_HOST_MISSING = ('jwks_host is missing in JWT payload. Make sure '
'custom_jwks_host field is present in module_type')
WRONG_JWKS_HOST = ('Wrong jwks_host in JWT payload. Make sure domain follows '
'the visibility.<region>.cisco.com structure')
Expand Down
5 changes: 4 additions & 1 deletion code/container_settings.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{"VERSION": "2.0.1","NAME": "Gigamon ThreatINSIGHT"}
{
"VERSION": "2.0.2",
"NAME": "Gigamon ThreatINSIGHT"
}
9 changes: 0 additions & 9 deletions code/requirements.txt

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/usr/bin/env sh
set -e

# Grab the repository
if [ -n "$GITREPO" ]; then
echo "rm -rf /app && git clone $GITREPO /app"
rm -rf /app && git clone $GITREPO /app
fi


if [ -n "$ALPINEPYTHON" ] ; then
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/$ALPINEPYTHON/site-packages:/usr/lib/$ALPINEPYTHON/site-packages
Expand Down

0 comments on commit f4560a5

Please sign in to comment.