Store auth users in database and add admin user management#23
Store auth users in database and add admin user management#23
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 651ebe7854
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (preg_match('/^https?:\\/\\//i', $path)) { | ||
| return '/'; | ||
| } | ||
|
|
||
| if ($path[0] !== '/') { | ||
| $path = '/' . ltrim($path, '/'); | ||
| } | ||
|
|
||
| return $path; |
There was a problem hiding this comment.
Reject protocol-relative redirects
The new auth_safe_redirect only blocks paths that start with http:// or https://, but it allows protocol‑relative URLs like //evil.example to pass through. When auth-login.php redirects after login, Location: //evil.example is treated by browsers as an external redirect, enabling an open‑redirect if an attacker supplies ?redirect=//evil.example. This is a security issue introduced with the new login flow; consider also rejecting // prefixes or normalizing to a known-safe path.
Useful? React with 👍 / 👎.
Motivation
Description
auth-config.phpto hold a default admin ($AUTH_DEFAULT_ADMIN) with a precomputed password hash.auth.php, includingauth_db_connect(),auth_initialize()(auto-creates theauth_userstable and seeds the default admin), role-awareauth_login()and session storage, and a newrequire_admin()helper.admin-users.phpas an admin-only page to create new users (withadmin/userroles) and list existing accounts.require_auth()to data-editing pages and updateREADME.mdto document DB-backed auth andadmin-users.phpusage.Testing
php -S 0.0.0.0:8000 -t /workspace/SoftwareMatrix-GUI, which started successfully.admin-users.php, but the Playwright run timed out (failed).Codex Task