Skip to content
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

Fix passing args to vulnapi binary #35

Merged
merged 2 commits into from
Oct 4, 2024
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
45 changes: 39 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,50 @@ jobs:
name: GitHub Actions Test
runs-on: ubuntu-latest

permissions:
contents: read
packages: read

env:
DOCKER_IMAGE: ghcr.io/cerberauth/api-vulns-challenges/jwt-strong-eddsa-key:latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Test Local Action
id: test-action
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run Server
run: |
docker run -d -p 8080:8080 ${{ env.DOCKER_IMAGE }}
sleep 5

- name: Get JWT
id: get-jwt
run: |
echo "jwt=$(docker run --rm ${{ env.DOCKER_IMAGE }} jwt)" >> $GITHUB_OUTPUT

- name: Test CURL Local Action
uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
curl:
'curl https://api.github.com/repos/${{ github.repository
}}/actions/runs/${{ github.run_id }}/jobs'
curl: |
curl http://localhost:8080 -H "Authorization: Bearer ${{ steps.get-jwt.outputs.jwt }}" --scans "jwt.*"

# - name: Test OpenAPI Local Action
# uses: ./
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# openapi: ./__tests__/openapi.yaml

- name: Stop Server
if: ${{ always() }}
run:
docker stop $(docker ps -q --filter ancestor=${{ env.DOCKER_IMAGE }})
27 changes: 27 additions & 0 deletions __tests__/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
openapi: 3.1.0

info:
title: Fake API
description: A fake API for testing purposes
version: 1.0.0
servers:
- url: http://localhost:8080
paths:
/example:
get:
summary: Retrieve an example resource
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
security:
- bearerAuth: []
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading