• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

source-academy / backend / 177a80efd5197c4a294167f5793cee5f8c145700
87%

Build:
DEFAULT BRANCH: master
Ran 30 Jul 2026 04:31PM UTC
Jobs 1
Files 169
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Jul 2026 04:26PM UTC coverage: 87.568% (+0.02%) from 87.546%
177a80efd5197c4a294167f5793cee5f8c145700

push

github

web-flow
Add hardened mode restricting course creation to super admins (#1370)

* Add hardened mode restricting course creation to super admins

Under hardened mode (config :cadet, hardened_mode: true, default off),
POST /v2/config/create is limited to users with super_admin. Non-super
admins receive an opaque 401 "Unauthorised" -- identical to the auth
error handler -- so the restriction is not disclosed; the real reason
is logged server-side only. No frontend changes required.

- config/config.exs: declare hardened_mode flag (default false)
- lib/cadet/env.ex: add Cadet.Env.hardened_mode?/0 helper
- lib/cadet_web/controllers/courses_controller.ex: enforce in create/2
- config/cadet.exs.example: document the prod runtime option
- test: cover super-admin success and non-super-admin opaque 401

* Rename hardened_mode flag to restrict_course_creation

The flag only gates course creation for now, so name it for its purpose.
Renames Cadet.Env.hardened_mode?/0 to restrict_course_creation?/0 and
updates the config default, prod example, and tests accordingly.

* Return 403 instead of 401 when course creation is restricted

401 would incorrectly trigger the frontend token-refresh flow, and 403
matches the sibling too-many-courses branch and the router's authz
rejections. Uses the generic opaque "Forbidden" body.

* Remove unnecessary fallback

16 of 16 new or added lines in 2 files covered. (100.0%)

4015 of 4585 relevant lines covered (87.57%)

6986.19 hits per line

Jobs
ID Job ID Ran Files Coverage
1 177a80efd5197c4a294167f5793cee5f8c145700.1 30 Jul 2026 04:31PM UTC 169
87.57
GitHub Action Run
Source Files on build 177a80efd5197c4a294167f5793cee5f8c145700
  • Tree
  • List 169
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 177a80ef on github
  • Prev Build on master (#A452D4A4...)
  • Next Build on master (#D8E2884D...)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc