-
-
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 'OWASP:main' into fix/redirection-of-links
- Loading branch information
Showing
25 changed files
with
845 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"""OWASP snapshot GraphQL node.""" | ||
|
||
import graphene | ||
|
||
from apps.github.graphql.nodes.issue import IssueNode | ||
from apps.github.graphql.nodes.release import ReleaseNode | ||
from apps.github.graphql.nodes.user import UserNode | ||
from apps.owasp.graphql.nodes.chapter import ChapterNode | ||
from apps.owasp.graphql.nodes.common import GenericEntityNode | ||
from apps.owasp.graphql.nodes.project import ProjectNode | ||
from apps.owasp.models.snapshot import Snapshot | ||
|
||
RECENT_ISSUES_LIMIT = 100 | ||
|
||
|
||
class SnapshotNode(GenericEntityNode): | ||
"""Snapshot node.""" | ||
|
||
key = graphene.String() | ||
new_chapters = graphene.List(ChapterNode) | ||
new_issues = graphene.List(IssueNode) | ||
new_projects = graphene.List(ProjectNode) | ||
new_releases = graphene.List(ReleaseNode) | ||
new_users = graphene.List(UserNode) | ||
|
||
class Meta: | ||
model = Snapshot | ||
fields = ( | ||
"created_at", | ||
"end_at", | ||
"start_at", | ||
"title", | ||
) | ||
|
||
def resolve_key(self, info): | ||
"""Resolve key.""" | ||
return self.key | ||
|
||
def resolve_new_chapters(self, info): | ||
"""Resolve new chapters.""" | ||
return self.new_chapters.all() | ||
|
||
def resolve_new_issues(self, info): | ||
"""Resolve recent new issues.""" | ||
return self.new_issues.order_by("-created_at")[:RECENT_ISSUES_LIMIT] | ||
|
||
def resolve_new_projects(self, info): | ||
"""Resolve recent new projects.""" | ||
return self.new_projects.order_by("-created_at") | ||
|
||
def resolve_new_releases(self, info): | ||
"""Resolve recent new releases.""" | ||
return self.new_releases.order_by("-published_at") | ||
|
||
def resolve_new_users(self, info): | ||
"""Resolve recent new users.""" | ||
return self.new_users.order_by("-created_at") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""OWASP snapshot GraphQL queries.""" | ||
|
||
import graphene | ||
|
||
from apps.common.graphql.queries import BaseQuery | ||
from apps.owasp.graphql.nodes.snapshot import SnapshotNode | ||
from apps.owasp.models.snapshot import Snapshot | ||
|
||
|
||
class SnapshotQuery(BaseQuery): | ||
"""Snapshot queries.""" | ||
|
||
snapshot = graphene.Field( | ||
SnapshotNode, | ||
key=graphene.String(required=True), | ||
) | ||
|
||
recent_snapshots = graphene.List( | ||
SnapshotNode, | ||
limit=graphene.Int(default_value=8), | ||
) | ||
|
||
def resolve_snapshot(root, info, key): | ||
"""Resolve snapshot by key.""" | ||
try: | ||
return Snapshot.objects.get(key=key) | ||
except Snapshot.DoesNotExist: | ||
return None | ||
|
||
def resolve_recent_snapshots(root, info, limit): | ||
"""Resolve recent snapshots.""" | ||
return Snapshot.objects.order_by("-created_at")[:limit] |
27 changes: 27 additions & 0 deletions
27
backend/apps/owasp/migrations/0019_alter_event_category.py
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,27 @@ | ||
# Generated by Django 5.1.6 on 2025-03-03 01:32 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("owasp", "0018_merge_20250302_1945"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="event", | ||
name="category", | ||
field=models.CharField( | ||
choices=[ | ||
("appsec_days", "AppSec Days"), | ||
("global", "Global"), | ||
("other", "Other"), | ||
("partner", "Partner"), | ||
], | ||
default="other", | ||
max_length=11, | ||
verbose_name="Category", | ||
), | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
backend/apps/owasp/migrations/0020_snapshot_key_snapshot_title.py
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 @@ | ||
# Generated by Django 5.1.6 on 2025-03-03 02:18 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("owasp", "0019_alter_event_category"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="snapshot", | ||
name="key", | ||
field=models.CharField(default="", max_length=10, unique=True), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name="snapshot", | ||
name="title", | ||
field=models.CharField(default="", max_length=255), | ||
), | ||
] |
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,17 @@ | ||
# Generated by Django 5.1.6 on 2025-03-03 02:23 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("owasp", "0020_snapshot_key_snapshot_title"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="snapshot", | ||
name="key", | ||
field=models.CharField(blank=True, max_length=10, unique=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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
export const mockSnapshotDetailsData = { | ||
snapshot: { | ||
title: 'New Snapshot', | ||
key: '2024-12', | ||
updatedAt: '2025-03-02T20:33:46.880330+00:00', | ||
createdAt: '2025-03-01T22:00:34.361937+00:00', | ||
startAt: '2024-12-01T00:00:00+00:00', | ||
endAt: '2024-12-31T22:00:30+00:00', | ||
status: 'completed', | ||
errorMessage: '', | ||
newReleases: [ | ||
{ | ||
name: 'v0.9.2', | ||
publishedAt: '2024-12-13T14:43:46+00:00', | ||
tagName: 'v0.9.2', | ||
projectName: 'test-project-1', | ||
}, | ||
{ | ||
name: 'Latest pre-release', | ||
publishedAt: '2024-12-13T13:17:30+00:00', | ||
tagName: 'pre-release', | ||
projectName: 'test-project-2', | ||
}, | ||
], | ||
newProjects: [ | ||
{ | ||
key: 'nest', | ||
name: 'OWASP Nest', | ||
summary: | ||
'OWASP Nest is a code project aimed at improving how OWASP manages its collection of projects...', | ||
starsCount: 14, | ||
forksCount: 19, | ||
contributorsCount: 14, | ||
level: 'INCUBATOR', | ||
isActive: true, | ||
repositoriesCount: 2, | ||
topContributors: [ | ||
{ | ||
avatarUrl: 'https://avatars.githubusercontent.com/u/2201626?v=4', | ||
contributionsCount: 170, | ||
login: 'arkid15r', | ||
name: 'Arkadii Yakovets', | ||
}, | ||
{ | ||
avatarUrl: 'https://avatars.githubusercontent.com/u/97700473?v=4', | ||
contributionsCount: 5, | ||
login: 'test-user', | ||
name: 'test user', | ||
}, | ||
], | ||
}, | ||
], | ||
newChapters: [ | ||
{ | ||
key: 'sivagangai', | ||
name: 'OWASP Sivagangai', | ||
createdAt: '2024-07-30T10:07:33+00:00', | ||
suggestedLocation: 'Sivagangai, Tamil Nadu, India', | ||
region: 'Asia', | ||
summary: | ||
'OWASP Sivagangai is a new local chapter that focuses on AI and application security...', | ||
topContributors: [ | ||
{ | ||
avatarUrl: 'https://avatars.githubusercontent.com/u/95969896?v=4', | ||
contributionsCount: 14, | ||
login: 'acs-web-tech', | ||
name: 'P.ARUN', | ||
}, | ||
{ | ||
avatarUrl: 'https://avatars.githubusercontent.com/u/56408064?v=4', | ||
contributionsCount: 1, | ||
login: 'test-user-1', | ||
name: '', | ||
}, | ||
], | ||
updatedAt: 1727353371.0, | ||
url: 'https://owasp.org/www-chapter-sivagangai', | ||
relatedUrls: [], | ||
geoLocation: { | ||
lat: 9.9650599, | ||
lng: 78.7204283237222, | ||
}, | ||
isActive: true, | ||
}, | ||
], | ||
}, | ||
} |
Oops, something went wrong.