-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/OWASP/Nest into feature
- Loading branch information
Showing
71 changed files
with
5,270 additions
and
1,196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.github/workflows/sync.yaml → .github/workflows/sync-nest-data.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Sync data | ||
name: Sync Nest data | ||
|
||
on: | ||
schedule: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: Test OWASP Schema | ||
|
||
on: | ||
merge_group: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- schema/** | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- schema/** | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
cancel-in-progress: true | ||
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }} | ||
|
||
env: | ||
DOCKERHUB_USERNAME: arkid15r | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
pre-commit: | ||
name: Run pre-commit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Poetry | ||
run: pipx install poetry | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
cache: poetry | ||
cache-dependency-path: schema/poetry.lock | ||
python-version: '3.13' | ||
|
||
- name: Run pre-commit | ||
uses: pre-commit/[email protected] | ||
|
||
- name: Check for uncommitted changes | ||
run: | | ||
git diff --exit-code || (echo 'Unstaged changes detected. \ | ||
Run `make check` and use `git add` to address it.' && exit 1) | ||
code-ql: | ||
name: CodeQL | ||
permissions: | ||
security-events: write | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
language: | ||
- python | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
|
||
- name: Perform CodeQL analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: '/language:${{ matrix.language }}' | ||
|
||
spellcheck: | ||
name: Run spell check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run cspell | ||
run: | | ||
make spellcheck | ||
run-schema-tests: | ||
name: Run schema tests | ||
needs: | ||
- pre-commit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build schema test image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
cache-from: type=registry,ref=${{ env.DOCKERHUB_USERNAME }}/owasp-nest-test-schema:cache | ||
context: schema | ||
file: schema/Dockerfile.test | ||
load: true | ||
platforms: linux/amd64 | ||
tags: ${{ env.DOCKERHUB_USERNAME }}/owasp-nest-test-schema:latest | ||
|
||
- name: Run schema tests | ||
run: | | ||
docker run ${{ env.DOCKERHUB_USERNAME }}/owasp-nest-test-schema:latest poetry run pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"""Common GraphQL nodes.""" | ||
|
||
from graphene_django import DjangoObjectType | ||
|
||
|
||
class BaseNode(DjangoObjectType): | ||
"""Base node.""" | ||
|
||
class Meta: | ||
abstract = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Common GraphQL queries.""" | ||
|
||
import graphene | ||
|
||
|
||
class BaseQuery(graphene.ObjectType): | ||
"""Base query.""" |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""GitHub issue GraphQL node.""" | ||
|
||
from apps.common.graphql.nodes import BaseNode | ||
from apps.github.models.issue import Issue | ||
|
||
|
||
class IssueNode(BaseNode): | ||
"""GitHub issue node.""" | ||
|
||
class Meta: | ||
model = Issue | ||
fields = ( | ||
"author", | ||
"comments_count", | ||
"created_at", | ||
"number", | ||
"state", | ||
"title", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""GitHub release GraphQL node.""" | ||
|
||
from graphene import Field | ||
|
||
from apps.common.graphql.nodes import BaseNode | ||
from apps.github.graphql.nodes.user import UserNode | ||
from apps.github.models.release import Release | ||
|
||
|
||
class ReleaseNode(BaseNode): | ||
"""GitHub release node.""" | ||
|
||
author = Field(UserNode) | ||
|
||
class Meta: | ||
model = Release | ||
fields = ( | ||
"author", | ||
"is_pre_release", | ||
"name", | ||
"published_at", | ||
"tag_name", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""GitHub user GraphQL node.""" | ||
|
||
from apps.common.graphql.nodes import BaseNode | ||
from apps.github.models.user import User | ||
|
||
|
||
class UserNode(BaseNode): | ||
"""GitHub user node.""" | ||
|
||
class Meta: | ||
model = User | ||
fields = ( | ||
"avatar_url", | ||
"email", | ||
"id", | ||
"login", | ||
"name", | ||
) |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""OWASP project GraphQL node.""" | ||
|
||
import graphene | ||
|
||
from apps.common.graphql.nodes import BaseNode | ||
from apps.github.graphql.nodes.issue import IssueNode | ||
from apps.github.graphql.nodes.release import ReleaseNode | ||
from apps.owasp.models.project import Project | ||
|
||
RECENT_ISSUES_LIMIT = 10 | ||
RECENT_RELEASES_LIMIT = 10 | ||
|
||
|
||
class ProjectNode(BaseNode): | ||
"""Project node.""" | ||
|
||
recent_issues = graphene.List(IssueNode) | ||
recent_releases = graphene.List(ReleaseNode) | ||
|
||
class Meta: | ||
model = Project | ||
|
||
def resolve_recent_issues(self, info): | ||
"""Resolve project recent issues.""" | ||
return self.issues.select_related("author").order_by("-created_at")[:RECENT_ISSUES_LIMIT] | ||
|
||
def resolve_recent_releases(self, info): | ||
"""Resolve project recent releases.""" | ||
return self.published_releases.order_by("-published_at")[:RECENT_RELEASES_LIMIT] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""OWASP GraphQL queries.""" | ||
|
||
from apps.owasp.graphql.queries.project import ProjectQuery | ||
|
||
|
||
class OwaspQuery(ProjectQuery): | ||
"""OWASP queries.""" |
Oops, something went wrong.