Follow-up to spikersoft-issues#689 / #415. GeneratorBrandsController intentionally keeps its GET endpoints public (reference/lookup data — brand dropdown). But its write endpoints — POST (create), PUT (update), DELETE — are gated only by a bare [Authorize] (any authenticated user). #415 stopped anonymous writes but did not restrict to staff.
So any platform account (e.g. a student/consumer sharing the API's Keycloak realm) can create, edit, or delete generator-brand catalog entries — reference-data pollution / integrity loss for the generator-service CRM. The sibling CRM controllers are already staff-gated (#689); GeneratorBrands is the same CRM data, just with public reads, so only its writes need tightening (class-level gating would have broken the public reads — hence method-level here).
Fix (this PR)
Gate the three write endpoints with [Authorize(Roles = "Admin,admin,Staff,staff")]; leave the GETs public. Added a test asserting the writes require the staff role while the reads stay public.
Follow-up to spikersoft-issues#689 / #415. `GeneratorBrandsController` intentionally keeps its `GET` endpoints public (reference/lookup data — brand dropdown). But its **write** endpoints — `POST` (create), `PUT` (update), `DELETE` — are gated only by a bare `[Authorize]` (any authenticated user). #415 stopped *anonymous* writes but did not restrict to staff.
So any platform account (e.g. a student/consumer sharing the API's Keycloak realm) can create, edit, or delete generator-brand catalog entries — reference-data pollution / integrity loss for the generator-service CRM. The sibling CRM controllers are already staff-gated (#689); GeneratorBrands is the same CRM data, just with public reads, so only its writes need tightening (class-level gating would have broken the public reads — hence method-level here).
## Fix (this PR)
Gate the three write endpoints with `[Authorize(Roles = "Admin,admin,Staff,staff")]`; leave the `GET`s public. Added a test asserting the writes require the staff role while the reads stay public.
Resolved in spikersoft-backend PR #389 (merged to master). Gated GeneratorBrands POST/PUT/DELETE to [Authorize(Roles = "Admin,admin,Staff,staff")] (method-level; public GET reads preserved). 5 authorization tests pass. This completes the CRM access-control hardening (#688/#689/#694). Closing.
Resolved in spikersoft-backend PR #389 (merged to `master`). Gated GeneratorBrands POST/PUT/DELETE to `[Authorize(Roles = "Admin,admin,Staff,staff")]` (method-level; public GET reads preserved). 5 authorization tests pass. This completes the CRM access-control hardening (#688/#689/#694). Closing.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Follow-up to spikersoft-issues#689 / #415.
GeneratorBrandsControllerintentionally keeps itsGETendpoints public (reference/lookup data — brand dropdown). But its write endpoints —POST(create),PUT(update),DELETE— are gated only by a bare[Authorize](any authenticated user). #415 stopped anonymous writes but did not restrict to staff.So any platform account (e.g. a student/consumer sharing the API's Keycloak realm) can create, edit, or delete generator-brand catalog entries — reference-data pollution / integrity loss for the generator-service CRM. The sibling CRM controllers are already staff-gated (#689); GeneratorBrands is the same CRM data, just with public reads, so only its writes need tightening (class-level gating would have broken the public reads — hence method-level here).
Fix (this PR)
Gate the three write endpoints with
[Authorize(Roles = "Admin,admin,Staff,staff")]; leave theGETs public. Added a test asserting the writes require the staff role while the reads stay public.Resolved in spikersoft-backend PR #389 (merged to
master). Gated GeneratorBrands POST/PUT/DELETE to[Authorize(Roles = "Admin,admin,Staff,staff")](method-level; public GET reads preserved). 5 authorization tests pass. This completes the CRM access-control hardening (#688/#689/#694). Closing.