-
Notifications
You must be signed in to change notification settings - Fork 2
[Guardrails] Banlist API #36
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
ecd6f39
Added banlist management code
rkritika1508 9e364f7
Added tests
rkritika1508 bb7ccd8
resolved comments
rkritika1508 dd15382
resolved comment
rkritika1508 c081981
Added seed database and updated tests
rkritika1508 7e7523e
resolved comment
rkritika1508 0df63bd
resolved comments
rkritika1508 3013e48
resolved comment
rkritika1508 6052c70
apply formatting
rkritika1508 e509b04
fixed tests
rkritika1508 2f81a43
Fixed critical issues - auth, docker setup, db indexing, error handli…
rkritika1508 0dd25cc
Added banlist management code
rkritika1508 6c0613c
fixed tests
rkritika1508 85b9a94
Merge branch 'main' into feat/banlist-management
rkritika1508 bca7127
resolved comments
rkritika1508 51135f9
resolved comments
rkritika1508 8a4e096
resolved comments
rkritika1508 162fada
Merge branch 'main' into feat/banlist-management
rkritika1508 42fa6b2
resolved comments
rkritika1508 9a1509d
resolved comments
rkritika1508 2dd842f
added ban list preprocessing
rkritika1508 ba75e02
precommit fix
rkritika1508 49313c9
precommit
rkritika1508 2de9dd3
revert
rkritika1508 4c6cb29
resolved comments
rkritika1508 a1b9c70
resolved comment
rkritika1508 278bfba
Merge branch 'main' into feat/banlist-management
rkritika1508 ecf8bd1
updated banlist api
rkritika1508 6b87071
resolved comment
rkritika1508 93f14b8
updated verify api and tests
rkritika1508 8d12092
resolved comments
rkritika1508 b3c1acc
resolved comments
rkritika1508 edf3fc9
fix formatting
AkhileshNegi 9a946dd
update version
AkhileshNegi 0612a8a
formatting files
AkhileshNegi 99a315a
fixed test
rkritika1508 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| Create Date: 2026-02-05 09:42:54.128852 | ||
|
|
||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| from alembic import op | ||
|
|
||
This file contains hidden or 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 hidden or 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,62 @@ | ||
| """Added ban_list table | ||
|
|
||
| Revision ID: 005 | ||
| Revises: 004 | ||
| Create Date: 2026-02-05 09:42:54.128852 | ||
|
|
||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| from alembic import op | ||
| from sqlalchemy.dialects import postgresql | ||
| import sqlalchemy as sa | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "005" | ||
| down_revision = "004" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| op.create_table( | ||
| "ban_list", | ||
| sa.Column("id", sa.Uuid(), nullable=False), | ||
| sa.Column("name", sa.String(), nullable=False), | ||
| sa.Column("description", sa.String(), nullable=False), | ||
| sa.Column("organization_id", sa.Integer(), nullable=False), | ||
| sa.Column("project_id", sa.Integer(), nullable=False), | ||
| sa.Column("domain", sa.String(), nullable=False), | ||
| sa.Column("is_public", sa.Boolean(), nullable=False, server_default=sa.false()), | ||
| sa.Column( | ||
| "banned_words", | ||
| postgresql.ARRAY(sa.String(length=100)), | ||
| nullable=False, | ||
| server_default="{}", | ||
| ), | ||
| sa.Column("created_at", sa.DateTime(), nullable=False), | ||
| sa.Column("updated_at", sa.DateTime(), nullable=False), | ||
| sa.PrimaryKeyConstraint("id"), | ||
| sa.UniqueConstraint( | ||
| "name", "organization_id", "project_id", name="uq_ban_list_name_org_project" | ||
| ), | ||
| sa.CheckConstraint( | ||
| "coalesce(array_length(banned_words, 1), 0) <= 1000", | ||
| name="ck_ban_list_banned_words_max_items", | ||
| ), | ||
| ) | ||
|
|
||
| op.create_index("idx_ban_list_organization", "ban_list", ["organization_id"]) | ||
| op.create_index("idx_ban_list_project", "ban_list", ["project_id"]) | ||
| op.create_index("idx_ban_list_domain", "ban_list", ["domain"]) | ||
| op.create_index( | ||
| "idx_ban_list_is_public_true", | ||
| "ban_list", | ||
| ["is_public"], | ||
| postgresql_where=sa.text("is_public = true"), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| op.drop_table("ban_list") |
This file contains hidden or 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 hidden or 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,11 +1,12 @@ | ||
| from fastapi import APIRouter | ||
|
|
||
| from app.api.routes import utils, guardrails, validator_configs | ||
| from app.api.routes import ban_lists, guardrails, validator_configs, utils | ||
|
|
||
| api_router = APIRouter() | ||
| api_router.include_router(utils.router) | ||
| api_router.include_router(ban_lists.router) | ||
| api_router.include_router(guardrails.router) | ||
| api_router.include_router(validator_configs.router) | ||
| api_router.include_router(utils.router) | ||
|
|
||
| # if settings.ENVIRONMENT == "local": | ||
| # api_router.include_router(private.router) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.