Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
0003897
Implement chatbot UI
piyushroshan Apr 19, 2024
8d71707
added llm chatbot service (#242)
dhruv-singhal-github Apr 20, 2024
7a12fc6
Llm chatbot (#243)
dhruv-singhal-github Apr 22, 2024
4d44d02
Integration
piyushroshan Apr 23, 2024
12c365e
Lint
piyushroshan Apr 23, 2024
ec8014f
Minor fixes
piyushroshan Apr 23, 2024
41f166d
Fix ssl issue
piyushroshan Apr 23, 2024
4f17fdb
Fix docker
piyushroshan Apr 23, 2024
055638f
Fix entrypoint
piyushroshan Apr 23, 2024
1e7be93
increase timeout
piyushroshan Apr 23, 2024
a927692
Implement helm
piyushroshan Apr 23, 2024
92efb5d
Merge branch 'chatbot' of github.com:OWASP/crAPI into chatbot
piyushroshan Apr 23, 2024
1374e2c
Fix entrypoint
piyushroshan Apr 23, 2024
48f1bf3
Store user state for chatbot
piyushroshan Apr 24, 2024
0b25ece
resolved segmentation fault error in chatbot (#245)
dhruv-singhal-github Apr 25, 2024
446512f
Add release workflow
piyushroshan Apr 28, 2024
23961d4
Instructions
piyushroshan Apr 28, 2024
da92874
Fix tag publish
piyushroshan Apr 28, 2024
c1faf3e
Strip tag prefix
piyushroshan Apr 28, 2024
f54777b
String tag prefix for docker tags
piyushroshan Apr 29, 2024
5322d14
Fix entrypoint.sh
piyushroshan Apr 29, 2024
e97a52f
Session based chat
piyushroshan Apr 30, 2024
daaa28b
Fix UI
piyushroshan Apr 30, 2024
6b46a58
Lint
piyushroshan Apr 30, 2024
da66cd7
Fix configmap
piyushroshan Apr 30, 2024
2e4fa9a
Update requirements
piyushroshan Apr 30, 2024
61477a6
Fix dockerfile
piyushroshan Apr 30, 2024
5642759
Fix UX
piyushroshan Apr 30, 2024
186451d
Seperate prompts
piyushroshan May 2, 2024
c66bc29
Change to ChatOpenAI
piyushroshan May 2, 2024
9afee6a
Change to ChatOpenAI
piyushroshan May 2, 2024
199f0d3
Return messages
piyushroshan May 2, 2024
315b10a
Save chat history
piyushroshan May 2, 2024
9d63c38
Cleanup
piyushroshan May 2, 2024
b70a131
Cleanup
piyushroshan May 2, 2024
895c01a
Preserve X-Forwarded-For
piyushroshan May 2, 2024
d1cbf26
Add mongo dependency for chatbot
piyushroshan May 2, 2024
eac14c9
Use old turbo model
piyushroshan May 2, 2024
b13ce4d
FSession logs not clearer debug
piyushroshan May 2, 2024
08344a8
Add ssn
piyushroshan May 3, 2024
03b8832
Merge remote-tracking branch 'origin/develop' into chatbot
piyushroshan May 12, 2024
4b78d7b
Merge branch 'develop' into chatbot
piyushroshan May 17, 2024
57c81db
Merge branch 'develop' into chatbot
piyushroshan May 19, 2024
263e45e
Update values
piyushroshan May 28, 2024
e38cb66
Fix gateway service health
piyushroshan May 28, 2024
0bf05d9
Merge branch 'develop' into chatbot
piyushroshan May 4, 2025
ae57db0
Chatbot typescript
piyushroshan May 4, 2025
4a9201a
Upgrade packages
piyushroshan May 4, 2025
98f7451
Dummy commit
piyushroshan May 4, 2025
6393fe7
Lint
piyushroshan May 4, 2025
f3745f6
lint
piyushroshan May 4, 2025
717bc76
Reduce max mem
piyushroshan May 4, 2025
2dbe0bf
Update chatbot
piyushroshan May 5, 2025
3a9b002
Update chatbot
piyushroshan May 5, 2025
01bcc56
Potential fix for code scanning alert no. 21: Flask app is run in deb…
piyushroshan Jul 2, 2025
8fbd324
Chatbot mcp impl
piyushroshan Jul 5, 2025
39d467b
spotless
piyushroshan Jul 5, 2025
49e37fc
Fix chatbot
piyushroshan Jul 6, 2025
7f3161a
Spotless
piyushroshan Jul 6, 2025
185173c
Fix usage
piyushroshan Jul 9, 2025
0ebcf37
MCP server fix (#303)
keyurdoshi03 Jul 10, 2025
7bea4a9
Remove errors
piyushroshan Jul 10, 2025
28c4341
Remove variables not needed
piyushroshan Jul 10, 2025
5e158e3
Add management scripts
piyushroshan Jul 10, 2025
923eae7
Make executable
piyushroshan Jul 10, 2025
b36531f
Fix config
piyushroshan Jul 10, 2025
852dfaf
Fix config
piyushroshan Jul 10, 2025
84de6d7
Add init for chatbot
piyushroshan Jul 10, 2025
a0f2b27
Add retry for apikey
piyushroshan Jul 10, 2025
358aaf9
Add retry for apikey
piyushroshan Jul 10, 2025
8fc151f
Chatbot UX fix
piyushroshan Jul 11, 2025
4cb0969
update tool versions
piyushroshan Jul 11, 2025
3639b5d
Lint fix
piyushroshan Jul 11, 2025
44dcd5e
Upgrade golangci-lint
piyushroshan Jul 11, 2025
1c2c6f7
Npm lint fix
piyushroshan Jul 11, 2025
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
23 changes: 18 additions & 5 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
with:
strip_tag_prefix: 'v'

- name: Current branch name
run: |
Expand All @@ -46,7 +48,7 @@ jobs:
if: steps.branch-name.outputs.is_tag == 'true'
run: |
echo "TAG_NAME=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV}
echo "TAG_LATEST=latest" >> ${GITHUB_ENV}
echo "TAG_LATEST=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV}

- name: Running on a branch and merge.
if: steps.branch-name.outputs.is_tag != 'true' && github.event_name == 'push' && steps.branch-name.outputs.current_branch != 'main'
Expand Down Expand Up @@ -96,6 +98,17 @@ jobs:
cache-from: type=gha,scope=workshop-service
cache-to: type=gha,mode=max,scope=workshop-service

- name: Build crapi-chatbot image
uses: docker/build-push-action@v3
with:
context: ./services/chatbot
tags: crapi/crapi-chatbot:${{ env.TAG_LATEST }},crapi/crapi-chatbot:${{ env.TAG_NAME }}
push: false
load: true
platforms: linux/amd64
cache-from: type=gha,scope==chatbot-service
cache-to: type=gha,mode=max,scope=chatbot-service

- name: Build crapi-community image
uses: docker/build-push-action@v3
with:
Expand Down Expand Up @@ -190,7 +203,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'

- name: Setup Java
uses: actions/setup-java@v4
Expand All @@ -201,7 +214,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: '1.23'

- name: Start the database
run: docker compose -f services/docker-database.yml up -d
Expand All @@ -219,12 +232,12 @@ jobs:
go run gotest.tools/gotestsum@latest --format testname --junitfile test-results/unit-tests.xml

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v8.0.0
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.54
version: v2.2.1
working-directory: services/community


Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
with:
strip_tag_prefix: 'v'

- name: Current branch name
run: |
Expand All @@ -48,7 +50,7 @@ jobs:
if: steps.branch-name.outputs.is_tag == 'true'
run: |
echo "TAG_NAME=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV}
echo "TAG_LATEST=latest" >> ${GITHUB_ENV}
echo "TAG_LATEST=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV}

- name: Running on a branch and merge.
if: steps.branch-name.outputs.is_tag != 'true' && github.event_name == 'push' && steps.branch-name.outputs.current_branch != 'main'
Expand Down Expand Up @@ -102,6 +104,16 @@ jobs:
cache-from: type=gha,scope=workshop-service
cache-to: type=gha,mode=max,scope=workshop-service

- name: Build crapi-chatbot all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
context: ./services/chatbot
tags: crapi/crapi-chatbot:${{ env.TAG_LATEST }},crapi/crapi-chatbot:${{ env.TAG_NAME }}
platforms: ${{ env.PLATFORMS }}
push: true
cache-from: type=gha,scope=chatbot-service
cache-to: type=gha,mode=max,scope=chatbot-service

- name: Build crapi-community all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
Expand Down
225 changes: 225 additions & 0 deletions .github/workflows/workflow-multiarch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
name: Release Publish
on: workflow_dispatch

jobs:
build-context:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
build:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
needs: build-context
strategy:
matrix:
include:
- runner: ubuntu-latest
platform: linux/amd64
arch_alias: 'amd64'
- runner: ubuntu-latest-arm64
platform: linux/arm64
arch_alias: 'arm64'
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Env seen prerun
run: env

- name: Get branch metadata
id: branch-name
uses: tj-actions/branch-names@v8

- name: Current tag name
run: |
echo "Tag if exist: ${{ steps.branch-name.outputs.tag }}"

- name: If not a tag, terminate the workflow
if: steps.branch-name.outputs.is_tag != 'true'
run: exit 1

- name: Running on a tag.
run: |
echo "TAG_NAME=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV}
echo "TAG_NAME=${{ steps.branch-name.outputs.tag }}" > tag_name.txt

# Archive the tag name
- name: Archive tag name
uses: actions/upload-artifact@v2
with:
name: tag_name
path: tag_name.txt

# setup Docker build action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build crapi-identity all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
context: ./services/identity
tags: crapi/crapi-identity:${{ env.TAG_NAME }}-${{ matrix.arch_alias }}
platforms: ${{ matrix.platform }}
push: true
cache-from: type=gha,scope=identity-service
cache-to: type=gha,mode=max,scope=identity-service

- name: Build crapi-workshop all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
context: ./services/workshop
tags: crapi/crapi-workshop:${{ env.TAG_NAME }}-${{ matrix.arch_alias }}
platforms: ${{ matrix.platform }}
push: true
cache-from: type=gha,scope=workshop-service
cache-to: type=gha,mode=max,scope=workshop-service

- name: Build crapi-chatbot all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
context: ./services/chatbot
tags: crapi/crapi-chatbot:${{ env.TAG_NAME }}-${{ matrix.arch_alias }}
platforms: ${{ matrix.platform }}
push: true
cache-from: type=gha,scope=chatbot-service
cache-to: type=gha,mode=max,scope=chatbot-service

- name: Build crapi-community all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
context: ./services/community
tags: crapi/crapi-community:${{ env.TAG_NAME }}-${{ matrix.arch_alias }}
platforms: ${{ matrix.platform }}
push: true
cache-from: type=gha,scope=community-service
cache-to: type=gha,mode=max,scope=community-service

- name: Build crapi-web all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
context: ./services/web
tags: crapi/crapi-web:${{ env.TAG_NAME }}-${{ matrix.arch_alias }}
platforms: ${{ matrix.platform }}
push: true
cache-from: type=gha,scope=web-service
cache-to: type=gha,mode=max,scope=web-service

- name: Build gateway-service all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
context: ./services/gateway-service
tags: crapi/gateway-service:${{ env.TAG_NAME }}-${{ matrix.arch_alias }}
platforms: ${{ matrix.platform }}
push: true
cache-from: type=gha,scope=gateway-service
cache-to: type=gha,mode=max,scope=gateway-service

- name: Build mailhog all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
context: ./services/mailhog
tags: crapi/mailhog:${{ env.TAG_NAME }}-${{ matrix.arch_alias }}
platforms: ${{ matrix.platform }}
push: true
cache-from: type=gha,scope=mailhog-service
cache-to: type=gha,mode=max,scope=mailhog-service

publish-manifests:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download tag name
uses: actions/download-artifact@v2
with:
name: tag_name
path: .

- name: Read tag name
id: tag_name
run: |
echo "TAG_NAME=$(cat tag_name.txt)" >> $GITHUB_ENV

- name: Create and push manifest images for crapi-identity
uses: Noelware/docker-manifest-action@v1
with:
inputs: |
crapi/crapi-identity:${{ env.TAG_NAME }}-amd64
crapi/crapi-identity:${{ env.TAG_NAME }}-arm64
outputs: |
crapi/crapi-identity:${{ env.TAG_NAME }}
push: true

- name: Create and push manifest images for crapi-workshop
uses: Noelware/docker-manifest-action@v1
with:
inputs: |
crapi/crapi-workshop:${{ env.TAG_NAME }}-amd64
crapi/crapi-workshop:${{ env.TAG_NAME }}-arm64
outputs: |
crapi/crapi-workshop:${{ env.TAG_NAME }}
push: true

- name: Create and push manifest images for crapi-chatbot
uses: Noelware/docker-manifest-action@v1
with:
inputs: |
crapi/crapi-chatbot:${{ env.TAG_NAME }}-amd64
crapi/crapi-chatbot:${{ env.TAG_NAME }}-arm64
outputs: |
crapi/crapi-chatbot:${{ env.TAG_NAME }}
push: true

- name: Create and push manifest images for crapi-community
uses: Noelware/docker-manifest-action@v1
with:
inputs: |
crapi/crapi-community:${{ env.TAG_NAME }}-amd64
crapi/crapi-community:${{ env.TAG_NAME }}-arm64
outputs: |
crapi/crapi-community:${{ env.TAG_NAME }}
push: true

- name: Create and push manifest images for crapi-web
uses: Noelware/docker-manifest-action@v1
with:
inputs: |
crapi/crapi-web:${{ env.TAG_NAME }}-amd64
crapi/crapi-web:${{ env.TAG_NAME }}-arm64
outputs: |
crapi/crapi-web:${{ env.TAG_NAME }}
push: true

- name: Create and push manifest images for gateway-service
uses: Noelware/docker-manifest-action@v1
with:
inputs: |
crapi/gateway-service:${{ env.TAG_NAME }}-amd64
crapi/gateway-service:${{ env.TAG_NAME }}-arm64
outputs: |
crapi/gateway-service:${{ env.TAG_NAME }}
push: true

- name: Create and push manifest images for mailhog
uses: Noelware/docker-manifest-action@v1
with:
inputs: |
crapi/mailhog:${{ env.TAG_NAME }}-amd64
crapi/mailhog:${{ env.TAG_NAME }}-arm64
outputs: |
crapi/mailhog:${{ env.TAG_NAME }}
push: true

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ deploy/vagrant/.vagrant
.secrets
.vscode/
*.local
services/chatbot/db
services/certs/
docker-compose.local.yml
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,5 @@ To know more about challenges in crAPI. Visit [challenges]

## Troubleshooting guide for general issues while installing and running crAPI
If you need any help with installing and running crAPI you can check out this guide: [Troubleshooting guide crAPI](https://github.com/OWASP/crAPI/blob/main/docs/troubleshooting.md). If this doesn't solve your problem, please create an issue in Github Issues.


1 change: 1 addition & 0 deletions deploy/docker/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
IDENTITY_SERVER_PORT=8080
COMMUNITY_SERVER_PORT=8087
WORKSHOP_SERVER_PORT=8000
CHATBOT_SERVER_PORT=5002
ENABLE_SHELL_INJECTION=false
ENABLE_LOG4J=false
LISTEN_IP="127.0.0.1"
Expand Down
28 changes: 27 additions & 1 deletion deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
crapi-identity:
container_name: crapi-identity
image: crapi/crapi-identity:${VERSION:-latest}
#ports:
# ports:
# - "${LISTEN_IP:-127.0.0.1}:8080:8080"
volumes:
- ./keys:/app/keys
Expand Down Expand Up @@ -150,6 +150,31 @@ services:
cpus: '0.3'
memory: 128M

crapi-chatbot:
container_name: crapi-chatbot
image: crapi/crapi-chatbot:${VERSION:-latest}
environment:
- TLS_ENABLED=${TLS_ENABLED:-false}
- SERVER_PORT=${CHATBOT_SERVER_PORT:-5002}
- DB_NAME=crapi
- DB_USER=admin
- DB_PASSWORD=crapisecretpassword
- DB_HOST=postgresdb
- DB_PORT=5432
- MONGO_DB_HOST=mongodb
- MONGO_DB_PORT=27017
- MONGO_DB_USER=admin
- MONGO_DB_PASSWORD=crapisecretpassword
- MONGO_DB_NAME=crapi
# - CHATBOT_OPENAI_API_KEY=
depends_on:
mongodb:
condition: service_healthy
crapi-identity:
condition: service_healthy
# ports:
# - "${LISTEN_IP:-127.0.0.1}:5002:5002"

crapi-web:
container_name: crapi-web
image: crapi/crapi-web:${VERSION:-latest}
Expand All @@ -162,6 +187,7 @@ services:
- COMMUNITY_SERVICE=crapi-community:${COMMUNITY_SERVER_PORT:-8087}
- IDENTITY_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}
- WORKSHOP_SERVICE=crapi-workshop:${WORKSHOP_SERVER_PORT:-8000}
- CHATBOT_SERVICE=crapi-chatbot:${CHATBOT_SERVER_PORT:-5002}
- MAILHOG_WEB_SERVICE=mailhog:8025
- TLS_ENABLED=${TLS_ENABLED:-false}
depends_on:
Expand Down
Loading
Loading