SUBTASK #86: Sign in and account rules (2.1)
@PavlockBlaine03 ci sta già lavorando.
Dal 2/11/2026.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- authentication, cli
Direzione di ricerca
Start with the AccessControlService plan in backend/services/access_control/access_control_service.py and the UserStore interface it depends on, then read the test file tests/services/access_control/test_access_control_service.py for the expected cases. The password hashing (BB-5) and #87 are prerequisites, so check whether they exist before writing code. Done means the listed unit tests pass with a fake store and fake clock, and .\dev admin works on an empty database in dev.py.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What to do
The sign-in check (AccessControlService.authenticate): given a username and password, return the user or the reason they can't sign in. Also the password rule, creating an account and changing a password, plus a command to create the first admin account on a fresh database.
Background
- Spec SEC-01, SEC-02, CP-02, IN-11; OOD
AccessControlService.authenticateUser() UserStore(#17):find_by_username,store(user, changed_by)(audited, and records{"password_changed": true}instead of the hash),create_first_user(refused once any user exists)- Password hashing is BB-5 (subtask 1). The password rule and failed sign-in limits are decisions on #PARENT.
Steps
-
backend/services/access_control/access_control_service.py:-
AccessControlService(users, clock=time.monotonic):usersis anything withfind_by_usernameandstore(a Protocol, so tests pass a fake);clocklets tests move time forward -
LoginResult(user: User | None, reason: str | None), frozen -
authenticate(username, password) -> LoginResult:- Unknown username or wrong password: "Username or password is incorrect."
- Unknown username still runs
verify_passwordagainst a fixed dummy hash, so the answer takes the same time either way (otherwise the timing reveals which usernames exist) - Right password but a disabled account: "This account is disabled. Ask an admin to turn it back on."
- 5 failures for one username within 15 minutes: "Too many attempts. Try again in N minutes.", without checking the password. A successful sign-in clears the count.
-
check_password_rule(username, password) -> str | None: the reason it's not allowed, orNone -
create_user(username, password, role, created_by) -> result with reasons: username 1 to 100 characters (letters, digits,._-), the password rule, and not already taken; thenUserStore.store(..., changed_by=created_by) -
change_password(user, current_password, new_password) -> result with reasons: checks the current password first
-
-
backend/services/access_control/create_admin.py, run as.\dev admin:- Asks for a username, and the password twice with
getpass(never as a command-line argument, which would end up in the shell history) - Creates an admin with
create_first_user; if users already exist, says so and changes nothing - Add
admintodev.pyand the README
- Asks for a username, and the password twice with
- Unit tests (a fake user store and a fake clock):
- Right password signs in
- Wrong password and unknown username give the same message
- An unknown username still calls
verify_password - A disabled account is refused after the right password
- The 6th attempt is refused even with the right password; after 15 minutes it works; a success resets the count
- Password rule edges: 11 and 129 characters refused; 12 and 128 allowed; the username as the password refused
- A taken username is refused
- A created user is stored with a hash (never the password) and audited with the creator
-
change_passwordwith a wrong current password is refused
Where
backend/services/access_control/access_control_service.pybackend/services/access_control/create_admin.pytests/services/access_control/test_access_control_service.pydev.py,README.md
Done when
- All the tests above pass without a database
-
.\dev admincreates the first admin on an empty test database, and refuses on one that has users
Depends on
- Password hashing (BB-5), #87
- Accounts and settings data access (#17): done
- Lingua principale
- Python
- Stelle
- 1
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Bearkat-Professionals/Software-Engineering-Project
-
bug frontend help wanted High Priority
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
SUBTASK #86: Password hashing (BB-5)Forse già presa @Edgeless6 l’ha presa 6 giorni fa. Apertabackend Medium Priority subtask
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Bearkat-Professionals/Software-Engineering-Project#87 · 1 assegnatario ·
-
Enhancement: Regression tests for Validate Input crash fixes (SH-1)Forse già presa @yoshi301 l’ha presa 5 giorni fa. Apertabackend Low Priority
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
Bearkat-Professionals/Software-Engineering-Project#59 · 1 assegnatario ·
-
backend bug help wanted High Priority
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
-
SUBTASK #86: Manage user accounts (admin)Forse già presa @Edgeless6 l’ha presa 6 giorni fa. Apertabackend Medium Priority subtask
Difficoltà 4/5 Più di una settimana Idoneità per principianti 20/100
Bearkat-Professionals/Software-Engineering-Project#92 · 1 assegnatario ·
Tutte le issue di Bearkat-Professionals/Software-Engineering-Project
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
-
needs-triage tooling
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
neilsh/stunt-reel#317 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
TandoorRecipes/recipes#4926 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
PyTomography/PyTomography#431 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
igormcsouza/tether#278 ·
I maintainer di solito rispondono entro 1 giorno