Skip to content

Backend prasanna - #12

Merged
Prasannaganesann merged 4 commits into
mainfrom
backend-prasanna
Aug 6, 2026
Merged

Backend prasanna#12
Prasannaganesann merged 4 commits into
mainfrom
backend-prasanna

Conversation

@Prasannaganesann

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI lite review requested due to automatic review settings August 6, 2026 08:10
@Prasannaganesann
Prasannaganesann merged commit 147322b into main Aug 6, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces an initial FastAPI backend foundation for the Malware Classification System, including user authentication (register/login), JWT security utilities, and SQLAlchemy persistence, plus README improvements.

Changes:

  • Expanded README with objectives, team structure, docs index, and current status.
  • Added backend auth stack: User model + Pydantic schemas, auth services, JWT/password security utilities, and auth/profile API routes.
  • Added middleware for extracting the current user from a JWT and configured the FastAPI app (CORS + router registration).

Reviewed changes

Copilot reviewed 19 out of 37 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
README.md Expands project overview, objectives, documentation index, and status.
backend/requirements.txt Adds email validation and httpx dependency for backend needs.
backend/app/main.py Introduces FastAPI app initialization, CORS configuration, and router registration.
backend/app/api/auth.py Adds auth endpoints (register/login) and profile endpoints.
backend/app/api/init.py Exposes API router(s).
backend/app/core/config.py Adds application settings including JWT configuration.
backend/app/core/security.py Adds password hashing + JWT creation/verification utilities.
backend/app/core/init.py Re-exports core settings/security helpers.
backend/app/db/session.py Adds SQLAlchemy engine/session setup and request-scoped DB dependency.
backend/app/db/init.py Re-exports DB helpers.
backend/app/models/user.py Adds SQLAlchemy User model.
backend/app/models/init.py Exposes model(s).
backend/app/schemas/user.py Adds Pydantic schemas for user create/update/response.
backend/app/schemas/auth.py Adds auth/token-related Pydantic schemas.
backend/app/schemas/init.py Exposes schema(s).
backend/app/services/auth_service.py Implements user lookup, registration, authentication, and profile update service logic.
backend/app/services/init.py Re-exports service functions.
backend/app/middleware/auth_middleware.py Adds get_current_user dependency for JWT-protected routes.
backend/app/middleware/init.py Exposes middleware helpers.
Suppressed comments (1)

backend/app/services/auth_service.py:66

  • update_user_profile allows changing user.role via the normal profile update flow, enabling privilege escalation for any authenticated user. Role changes should be disallowed here or restricted to a separate admin-only endpoint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/requirements.txt
typing_extensions==4.16.0
uvicorn==0.52.0
email-validator==2.2.0
httpx>=0.27.0
Comment thread backend/app/main.py
Comment on lines +4 to +9
from app.api.auth import router as auth_router
from app.core.config import settings
from app.db.session import Base, engine

# Automatically initialize database tables on startup
Base.metadata.create_all(bind=engine)
Comment thread backend/app/main.py
Comment on lines +22 to +25
allow_origins=["*"], # Restrict in production environment
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
username=user_in.username,
hashed_password=hashed_pwd,
full_name=user_in.full_name,
role=user_in.role
Comment thread backend/app/api/auth.py
Comment on lines +128 to +132
except ValueError as e:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=str(e)
)
Comment thread backend/app/api/auth.py
Comment on lines +9 to +10
from app.schemas.auth import LoginRequest, Token
from app.schemas.user import UserCreate, UserResponse, UserUpdate
Comment on lines +10 to +16
# JWT Cryptographic Configuration
SECRET_KEY: str = os.getenv("SECRET_KEY", "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7")
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30


settings = Settings()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants