bcgov / bcgov/SIMS

BUG: Student restriction JWT failure is logged as an unhandled exception

Open
#6,583 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
29
Forks
15
PR merge metrics
No merged PRs in 30d

Description

**Describe the Bug**

A `GET /api/students/restriction` request fails JWT authentication with a 401 response and is emitted by `AppAllExceptionsFilter` as an unhandled error.

**Expected Behaviour**

Authentication failures are handled as expected client responses and do not generate misleading unhandled-exception error logs.

**Actual Behaviour**

The API returns 401 and records `UnauthorizedException: Unauthorized` as an unhandled exception.

**Log**

```text
[Nest] 18 - 09/04/2026, 6:31:33 AM LOG [AccessLoggerMiddleware] Request - GET /api/students/restriction From [redacted] | User GUID: [redacted] | User Agent: Safari on macOS
[Nest] 18 - 09/04/2026, 6:31:33 AM ERROR [AppAllExceptionsFilter] Unhandled exception, request path: /api/students/restriction
{
"stack": "UnauthorizedException: Unauthorized\n at JwtAuthGuard.handleRequest (/app/node_modules/@nestjs/passport/dist/auth.guard.js:60:30)",
"response": { "message": "Unauthorized" },
"status": 401,
"message": "Unauthorized",
"name": "UnauthorizedException"
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the GET /api/students/restriction request through JwtAuthGuard and AppAllExceptionsFilter, using the logged UnauthorizedException as the reproduction case. Determine why this expected 401 is classified as unhandled, then verify that authentication failures still return 401 without misleading unhandled-exception error logs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, authentication, backend, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.