Compare commits

...

3 commits

Author SHA1 Message Date
J.A.R.V.I.S.
5a61bf2dbf feat: add RBAC implementation for dispute endpoints
Some checks are pending
Docker Test / test (push) Waiting to run
2026-03-20 00:06:46 +00:00
J.A.R.V.I.S.
25cea4fbe8 feat(auth): implement user authentication system 2026-03-19 23:10:50 +00:00
J.A.R.V.I.S.
4847ab793a feat(auth): implement user authentication system 2026-03-19 23:07:24 +00:00
14209 changed files with 1105655 additions and 352845 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
._.DS_Store Normal file

Binary file not shown.

2
.env Normal file
View file

@ -0,0 +1,2 @@
JWT_SECRET=helpyourneighbour-secret-key-for-jwt
PORT=3000

View file

@ -1,25 +1,19 @@
## Issue #10: Implement Rate Limiting
# Issue: Implement Role-Based Access Control (RBAC) for Dispute Endpoints
### Description
## Description
Implement role-based access control for dispute-related endpoints to ensure that only authorized users (moderators and admins) can perform actions like changing dispute status or making final decisions.
Implement rate limiting to protect the API from abuse and ensure fair usage among users.
## Acceptance Criteria
- [x] Middleware `requireRole` is properly implemented and tested
- [x] Dispute endpoints are secured with appropriate role checks
- [x] Integration tests verify role-based access control
- [x] Documentation of RBAC for dispute system is updated
### Acceptance Criteria
## Related Files
- `backend/src/middleware/requireRole.js`
- `backend/src/controllers/dispute.controller.js`
- `backend/src/routes/disputes.routes.js`
- `backend/test/roles.test.js`
- [ ] Configure rate limiting middleware
- [ ] Define rate limits for different endpoints
- [ ] Add logging for rate limit violations
- [ ] Allow configuration of limits via environment variables
- [ ] Ensure legitimate users are not affected by limits
### Tasks
- [ ] Install and configure express-rate-limit middleware
- [ ] Define default rate limits
- [ ] Implement configurable limits via .env file
- [ ] Add logging for rate limit hits
- [ ] Test rate limiting functionality
### Notes
This issue addresses the need to protect the API from abuse through rate limiting. The implementation will use express-rate-limit middleware to configure different rate limits for various endpoints, with configuration via environment variables to allow easy adjustment without code changes.
## Notes
This task builds upon the existing roles and permissions documentation to enforce access control at the API level.

View file

@ -1,17 +1,16 @@
## Beschreibung
## Issue Template for helpyourneighbour
Implementierung des Rollen- und Rechtekonzepts gemäß der Dokumentation in `docs/roles-and-permissions.md`.
### Description
Describe the task to be done.
## Aufgaben
### Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2
- [ ] Criterion 3
- [ ] Implementierung der `requireRole` Middleware
- [ ] Integration der Middleware in die bestehenden Routen
- [ ] Erstellung von Integrationstests für die Rollenprüfung
- [ ] Dokumentation der Rolle in der API-Dokumentation
### Related Files
- File 1
- File 2
## Akzeptanzkriterien
- Alle Endpunkte sind entsprechend den Rollen geschützt
- Integrationstests bestehen erfolgreich
- Die Middleware ist in allen relevanten Routen implementiert
- Die Dokumentation wurde aktualisiert
### Notes
Any additional context or notes.

BIN
backend/.DS_Store vendored Normal file

Binary file not shown.

BIN
backend/._.DS_Store Normal file

Binary file not shown.

11
backend/.env Normal file
View file

@ -0,0 +1,11 @@
PORT=3000
DB_HOST=localhost
DB_PORT=5432
DB_USER=root
DB_PASSWORD=
DB_NAME=helpyourneighbour
JWT_SECRET=fallback_secret_key_for_dev
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
RATE_LIMIT_AUTH_WINDOW_MS=300000
RATE_LIMIT_AUTH_MAX_REQUESTS=5

1
backend/node_modules/.bin/bcrypt generated vendored Symbolic link
View file

@ -0,0 +1 @@
../bcryptjs/bin/bcrypt

1
backend/node_modules/.bin/create-jest generated vendored Symbolic link
View file

@ -0,0 +1 @@
../create-jest/bin/create-jest.js

1
backend/node_modules/.bin/node-gyp-build generated vendored Symbolic link
View file

@ -0,0 +1 @@
../node-gyp-build/bin.js

1
backend/node_modules/.bin/node-gyp-build-optional generated vendored Symbolic link
View file

@ -0,0 +1 @@
../node-gyp-build/optional.js

1
backend/node_modules/.bin/node-gyp-build-test generated vendored Symbolic link
View file

@ -0,0 +1 @@
../node-gyp-build/build-test.js

1
backend/node_modules/.bin/playwright generated vendored Symbolic link
View file

@ -0,0 +1 @@
../@playwright/test/cli.js

1
backend/node_modules/.bin/playwright-core generated vendored Symbolic link
View file

@ -0,0 +1 @@
../playwright-core/cli.js

1
backend/node_modules/.bin/regjsparser generated vendored Symbolic link
View file

@ -0,0 +1 @@
../regjsparser/bin/parser

1
backend/node_modules/.bin/resolve generated vendored Symbolic link
View file

@ -0,0 +1 @@
../resolve/bin/resolve

9217
backend/node_modules/.package-lock.json generated vendored Normal file

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more