Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
25 changes: 7 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,28 +223,16 @@ Follow these steps to set up the OWASP Nest application:

1. **Create Environment Files**:

- Create a local environment file in the `backend` directory:
- Copy the contents from the template file into your new backend local environment file:

```bash
touch backend/.env
cp backend/.env.example backend/.env
```

- Copy the contents from the template file into your new local environment file:
- Copy the contents from the template file into your new frontend local environment file:

```bash
cat backend/.env.example > backend/.env
```

- Create a local environment file in the `frontend` directory:

```bash
touch frontend/.env
```

- Copy the contents from the template file into your new local environment file:

```bash
cat frontend/.env.example > frontend/.env
cp frontend/.env.example frontend/.env
```

Ensure that all `.env` files are saved in **UTF-8 format without BOM (Byte Order Mark)**. This is crucial to prevent "Unexpected character" errors during application execution or Docker image building.
Expand All @@ -262,15 +250,16 @@ Ensure that all `.env` files are saved in **UTF-8 format without BOM (Byte Order
1. **Set Up Algolia**:

- Go to [Algolia](https://www.algolia.com/) and create a free account.
- After creating an account, create an Algolia app.
- An Algolia app is automatically created for you when you sign up.
- During the sign up process, you may be asked to import data. You can skip this step.
- Update your `backend/.env` file with the following keys from your Algolia app (use **write** API key for backend):

```plaintext
DJANGO_ALGOLIA_APPLICATION_ID=<your-algolia-application-id>
DJANGO_ALGOLIA_WRITE_API_KEY=<your-algolia-write-api-key>
```

- Ensure that your API key has index write permissions. You can ignore any onboarding wizard instructions provided by Algolia.
- Note: The default write API key should have index write permissions (addObject permission). If you do not use the default write API key, ensure that your API key has this permission.
- If you encounter any issues, you can refer directly to Algolia's [documentation](https://www.algolia.com/doc/guides/getting-started/quick-start/)

1. **Run the Application**:
Expand Down
14 changes: 8 additions & 6 deletions backend/apps/api/rest/v0/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from apps.owasp.models.project import Project as ProjectModel
from apps.owasp.models.snapshot import Snapshot as SnapshotModel

ORDERING_FIELD_DESCRIPTION = "Ordering field"

router = RouterPaginated(tags=["Community"])


Expand Down Expand Up @@ -114,7 +116,7 @@ def list_snapshots(
]
| None = Query(
None,
description="Ordering field",
description=ORDERING_FIELD_DESCRIPTION,
),
) -> list[Snapshot]:
"""Get all snapshots."""
Expand Down Expand Up @@ -160,7 +162,7 @@ def list_snapshot_chapters(
snapshot_id: str = Path(example="2025-02"),
ordering: Literal["created_at", "-created_at", "updated_at", "-updated_at"] | None = Query(
None,
description="Ordering field",
description=ORDERING_FIELD_DESCRIPTION,
),
) -> list[Chapter]:
"""Get new chapters in snapshot."""
Expand All @@ -185,7 +187,7 @@ def list_snapshot_issues(
snapshot_id: str = Path(example="2025-02"),
ordering: Literal["created_at", "-created_at", "updated_at", "-updated_at"] | None = Query(
None,
description="Ordering field",
description=ORDERING_FIELD_DESCRIPTION,
),
) -> list[SnapshotIssue]:
"""Get new issues in snapshot."""
Expand All @@ -212,7 +214,7 @@ def list_snapshot_members(
snapshot_id: str = Path(example="2025-02"),
ordering: Literal["created_at", "-created_at", "updated_at", "-updated_at"] | None = Query(
None,
description="Ordering field",
description=ORDERING_FIELD_DESCRIPTION,
),
) -> list[Member]:
"""Get new members in snapshot."""
Expand All @@ -237,7 +239,7 @@ def list_snapshot_projects(
snapshot_id: str = Path(example="2025-02"),
ordering: Literal["created_at", "-created_at", "updated_at", "-updated_at"] | None = Query(
None,
description="Ordering field",
description=ORDERING_FIELD_DESCRIPTION,
),
) -> list[Project]:
"""Get new projects in snapshot."""
Expand All @@ -262,7 +264,7 @@ def list_snapshot_releases(
snapshot_id: str = Path(example="2025-02"),
ordering: Literal["created_at", "-created_at", "published_at", "-published_at"] | None = Query(
None,
description="Ordering field",
description=ORDERING_FIELD_DESCRIPTION,
),
) -> list[SnapshotRelease]:
"""Get new releases in snapshot."""
Expand Down
2 changes: 1 addition & 1 deletion backend/apps/owasp/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def get_metadata(self):
"""Get entity metadata."""
try:
yaml_content = re.search(
r"^---\s*([\s\S]*?)\s*---",
r"^---\s*(.*?)\s*---",
get_repository_file_content(self.index_md_url),
re.DOTALL,
)
Expand Down
Loading
Loading