Skip to content

Conversation

@Nachiket-Roy
Copy link
Contributor

@Nachiket-Roy Nachiket-Roy commented Nov 18, 2025

Closes #4874
Summary
This PR completes the migration of the banned apps functionality out of the main BLT repository into a dedicated standalone Django app:
banned-apps GitHub repo (installed via Poetry).
This improves modularity, maintenance, and clarity of ownership.

Key Changes

  1. Removed old in-project implementation
    Deleted website.models.BannedApp
    Removed old imports such as from website.models import BannedApp
    Cleaned up unused views, admin registrations, and any references pointing to the old model

  2. Integrated new standalone package
    Added Poetry dependency:

banned-apps = { git = "https://github.com/Nachiket-Roy/banned-apps.git" }

Ensured the package loads correctly inside Docker
Applied new migrations:

python manage.py migrate banned_apps
  1. Added fixture for initial data
    Used pre-existing BLT seed data.
    Added:
    banned_apps_fixture.json
    (contains 15 banned apps from India, China, Russia, Iran, USA)
    Loaded via:
python manage.py loaddata banned_apps_fixture.json
  1. Updated API usage
    Updated imports:
from banned_apps.models import BannedApp
  1. Verification
python -c "import banned_apps; print(banned_apps.__file__)"
python manage.py showmigrations banned_apps

API Endpoint working:
/banned_apps/search/?country=india

Note : Only country-based search is supported for now.

Screenshot 2025-11-18 182055

Summary by CodeRabbit

  • Refactor

    • Moved banned-apps functionality into an external module and updated routing to use it.
  • Data

    • Added a comprehensive banned-apps dataset with entries for multiple countries and popular apps.
  • Chores

    • Added the banned-apps package as an external dependency.
    • Removed local banned-apps model and admin registration to rely on the external module.

@github-actions
Copy link
Contributor

👋 Hi @Nachiket-Roy!

This pull request needs a peer review before it can be merged. Please request a review from a team member who is not:

  • The PR author
  • DonnieBLT
  • coderabbit
  • copilot

Once a valid peer review is submitted, this check will pass automatically. Thank you!

@github-actions github-actions bot added unresolved-conversations: 0 PR has 0 unresolved conversations files-changed: 10 PR changes 10 files labels Nov 18, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

Walkthrough

Moved banned apps out of the main repository into an external package: removed local BannedApp model, admin and migration; added external git dependency and app to INSTALLED_APPS; updated imports and URLs to use the external package; added a JSON fixture with banned app records.

Changes

Cohort / File(s) Summary
Fixture
banned_apps_fixture.json
Added JSON fixture containing multiple banned_apps.bannedapp records with fields: country_name, country_code, app_name, app_type, ban_reason, ban_date, source_url, is_active, created_at, updated_at.
Package dependency
pyproject.toml
Added git-based dependency for banned-apps referencing https://github.com/Nachiket-Roy/banned-apps.git with tag v1.0.0.
App registration
blt/settings.py
Appended "banned_apps" to INSTALLED_APPS via INSTALLED_APPS += ("banned_apps",).
URL configuration
blt/urls.py
Removed local banned_apps view routes and imports; added path("banned_apps/", include("banned_apps.urls")); consolidated RedirectView, TemplateView import; also added path("/api/banned_apps/", include("banned_apps.urls")) entry.
Model & admin removal
website/models.py, website/admin.py
Deleted local BannedApp model and removed BannedAppAdmin and its registration/imports.
Migrations
website/migrations/0232_bannedapp.py, website/migrations/0233_githubissue_assignee.py
Removed migration 0232_bannedapp.py; updated 0233 migration dependency from 0232_bannedapp to 0231_organization_check_ins_enabled_notification.
Views update
website/views/banned_apps.py
Replaced from website.models import BannedApp with from banned_apps.models import BannedApp (usage unchanged; import source updated).

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant MainApp as "Main Django app"
  participant BannedPkg as "banned_apps (external)"

  Browser->>MainApp: GET /banned_apps/ or /api/banned_apps/
  MainApp->>MainApp: resolve included URLconf
  MainApp->>BannedPkg: forward request to included routes
  BannedPkg->>BannedPkg: view handles request, queries `banned_apps.models.BannedApp`
  BannedPkg-->>Browser: Response (HTML/JSON)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Verify migration chain for other migrations referencing removed 0232_bannedapp.
  • Confirm external package schema (model fields, indexes, defaults) matches expectations and fixture format.
  • Check pyproject.toml git dependency URL and tag correctness and any CI/packaging implications.
  • Review blt/urls.py for potential route conflicts (note added /api/banned_apps/ and banned_apps/ includes).

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and concisely summarizes the main objective of the changeset: moving banned apps functionality from the main repository into a separate Django package.
Linked Issues check ✅ Passed All coding requirements from issue #4874 are met: banned apps removed from main repo (models, views, admin, migrations), new package integrated via Poetry dependency, imports updated to use new package, and fixture data added.
Out of Scope Changes check ✅ Passed All changes are in scope and directly support the objective of migrating banned apps to a separate repository. No unrelated modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 679716d and 578d664.

📒 Files selected for processing (1)
  • blt/urls.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • blt/urls.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Tests
  • GitHub Check: docker-test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
blt/urls.py (1)

376-377: Remove duplicate URL patterns or clarify the migration strategy for the external package.

The codebase now has conflicting URL configurations for banned_apps:

  • Lines 376-377: Local URL patterns (banned_apps/ and api/banned_apps/search/) that import views from website.views.banned_apps
  • Line 1129: External package include statement (path("banned_apps/", include("banned_apps.urls")))

Both define the same base path banned_apps/, creating routing ambiguity. Additionally, the local views already import the model from the external package (from banned_apps.models import BannedApp), indicating partial migration to the external package.

Either:

  1. Remove the local URL patterns (lines 376-377) and the local views file to fully migrate to the external package, OR
  2. Remove the external package include (line 1129) if keeping local implementation

Clarify which approach is intended and ensure no duplicate route handlers remain.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 0440557 and 9c890db.

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • banned_apps_fixture.json (1 hunks)
  • blt/settings.py (1 hunks)
  • blt/urls.py (1 hunks)
  • pyproject.toml (1 hunks)
  • website/admin.py (0 hunks)
  • website/migrations/0232_bannedapp.py (0 hunks)
  • website/migrations/0233_githubissue_assignee.py (1 hunks)
  • website/models.py (0 hunks)
  • website/views/banned_apps.py (1 hunks)
💤 Files with no reviewable changes (3)
  • website/models.py
  • website/admin.py
  • website/migrations/0232_bannedapp.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Tests
  • GitHub Check: docker-test
🔇 Additional comments (3)
blt/settings.py (1)

105-105: LGTM!

The banned_apps app is correctly added to INSTALLED_APPS, enabling Django to load the external package's models, migrations, and URL configuration.

website/migrations/0233_githubissue_assignee.py (1)

9-9: Migration dependency correctly updated and verified.

The dependency change in migration 0233 from 0232_bannedapp to 0231_organization_check_ins_enabled_notification is correct. Migration 0231 exists and is directly referenced, the 0232_bannedapp migration has been removed from the codebase, and the migration chain (0230 → 0231 → 0233 → 0234) is intact with no broken dependencies.

website/views/banned_apps.py (1)

1-1: The file website/views/banned_apps.py has not been modified in this PR.

The git diff shows no changes to this file. The import statement from banned_apps.models import BannedApp was already present in HEAD and remains unchanged. The review comment appears to be analyzing existing code rather than actual PR changes. No verification or approval is needed for unmodified code.

Likely an incorrect or invalid review comment.

@github-project-automation github-project-automation bot moved this from Backlog to Ready in 📌 OWASP BLT Project Board Nov 18, 2025
@github-actions github-actions bot added unresolved-conversations: 3 PR has 3 unresolved conversations and removed unresolved-conversations: 0 PR has 0 unresolved conversations labels Nov 18, 2025
@github-actions github-actions bot added unresolved-conversations: 0 PR has 0 unresolved conversations and removed unresolved-conversations: 3 PR has 3 unresolved conversations labels Nov 18, 2025
@Nachiket-Roy Nachiket-Roy marked this pull request as draft November 18, 2025 18:12
@Nachiket-Roy Nachiket-Roy marked this pull request as ready for review November 18, 2025 18:12
@github-actions github-actions bot added the pre-commit: passed Pre-commit checks passed label Nov 18, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9c890db and ab22705.

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • blt/urls.py (2 hunks)
  • pyproject.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Tests
  • GitHub Check: docker-test
🔇 Additional comments (1)
blt/urls.py (1)

15-15: LGTM!

Import consolidation improves readability by grouping related generic views together.

@github-actions github-actions bot added unresolved-conversations: 1 PR has 1 unresolved conversation and removed unresolved-conversations: 0 PR has 0 unresolved conversations labels Nov 18, 2025
@github-actions github-actions bot added unresolved-conversations: 0 PR has 0 unresolved conversations and removed unresolved-conversations: 1 PR has 1 unresolved conversation labels Nov 18, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between ab22705 and 679716d.

📒 Files selected for processing (1)
  • blt/urls.py (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Tests
  • GitHub Check: docker-test
🔇 Additional comments (1)
blt/urls.py (1)

15-15: LGTM: Import consolidation is appropriate.

The addition of RedirectView to this import statement is correct, as the class is already used elsewhere in the file (e.g., line 355 for the favicon redirect).

@github-actions github-actions bot added unresolved-conversations: 1 PR has 1 unresolved conversation and removed unresolved-conversations: 0 PR has 0 unresolved conversations labels Nov 18, 2025
@github-actions github-actions bot added unresolved-conversations: 0 PR has 0 unresolved conversations and removed unresolved-conversations: 1 PR has 1 unresolved conversation labels Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 10 PR changes 10 files pre-commit: passed Pre-commit checks passed unresolved-conversations: 0 PR has 0 unresolved conversations

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

Move banned apps into its own repository

1 participant