Skip to content

Prefix sighting ids with 'transient:' #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
max-line-length = 120
exclude = */payloads_for_tests.py
per-file-ignores =
code/api/__init__.py:E402,F401
code/api/mapping/__init__.py:E402,F401
code/api/transformations/__init__.py:E402,F401
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
pull-request-branch-name:
separator: "-"
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Pipenv Install and Test

on:
push:
branches-ignore:
- main

jobs:
unittests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Python, pipenv and Pipfile packages
uses: palewire/install-python-pipenv-pipfile@v4
with:
python-version: 3.11

- name: Run tests
run: |
pipenv install --dev
cd code/
pipenv run coverage run --source api/ -m pytest --verbose tests/unit/
pipenv run coverage report --fail-under=80

- name: Run pip-audit
run: pipenv run pip-audit
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:3.14
LABEL maintainer="Ian Redden <iaredden@cisco.com>"
FROM alpine:3.18
LABEL maintainer="Jyoti Verma jyoverma@cisco.com"

ENV PIP_IGNORE_INSTALLED 1
ENV PIP_IGNORE_INSTALLED=1

# install packages we need
RUN apk update && apk add --no-cache musl-dev openssl-dev gcc py3-configobj \
Expand All @@ -10,7 +10,7 @@ py3-pip python3-dev

# do the Python dependencies
ADD code /app
ADD code/Pipfile code/Pipfile.lock /
ADD Pipfile Pipfile.lock /
RUN set -ex && pip install --no-cache-dir --upgrade pipenv && \
pipenv install --system
RUN chown -R uwsgi.uwsgi /etc/uwsgi
Expand Down
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
NAME_SHORT:="tr-05-rsa-netwitness"
NAME:=ciscosecurity/$(NAME_SHORT)
PORT:="9090"
PLATFORM=--platform linux/amd64,linux/arm64
VERSION:=$(shell jq '.VERSION' code/container_settings.json | tr -d '"')

all: env stop build test scout

run: # app locally
cd code; python -m app; cd -

# Docker
build: stop
docker buildx build $(PLATFORM) -t $(NAME):$(VERSION) -t $(NAME):latest .
start: build
docker run -dp $(PORT):$(PORT) --name $(NAME_SHORT) $(NAME):$(VERSION)
stop:
docker stop $(NAME_SHORT); docker rm $(NAME_SHORT); true
release: build
docker login
docker image push --all-tags $(NAME)
@echo "https://hub.docker.com/repository/docker/$(NAME)/tags"

# Tools
env:
pip install --no-cache-dir --upgrade pipenv && pipenv install --dev
black:
black code/ -l 120 -t py311 --exclude=payloads_for_tests.py
lint: black
flake8 code/

# Tests
check: lint
curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --
docker scout cves $(NAME) --only-fixed
pip-audit
test: lint
cd code; coverage run --source api/ -m pytest --verbose tests/unit/ && coverage report --fail-under=80; cd -
test_lf: lint
cd code; coverage run --source api/ -m pytest --verbose -vv --lf tests/unit/ && coverage report -m --fail-under=80; cd -

21 changes: 21 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
cryptography = "==44.0.2"
Flask = "==3.1.0"
marshmallow = "==3.25.1"
requests = "==2.32.3"
PyJWT = "==2.6.0"

[dev-packages]
black = "==25.1.0"
coverage = "==7.6.12"
flake8 = "==7.1.2"
pip-audit = "==2.8.0"
pytest = "==8.3.5"

[requires]
python_version = "3.11"
970 changes: 970 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

19 changes: 0 additions & 19 deletions code/Pipfile

This file was deleted.

Loading