fix: address performance and security findings
- Add PostgreSQL-backed backend and frontend tests to CI - Harden Android API logging and disable app backups - Update the performance report with resolved findings
This commit is contained in:
1 parent
a84a36349b
commit
937f51b4fb
35 files changed
+2566
-332
No files matched your search
+7
-4
@@ -139,6 +139,9 @@ func requireAPIToken(db *DB) func(http.Handler) http.Handler {
|
||||
writeJSONError(w, http.StatusInternalServerError, "Internal server error")
|
||||
return
|
||||
}
|
||||
// getAPITokenUserID answers 0 for an unknown token. 0 is also the
|
||||
// placeholder identity used when login is off, so tokens minted without
|
||||
// a session are refused here as well (see handleTokenRegenerate).
|
||||
if userID == 0 {
|
||||
writeJSONError(w, http.StatusUnauthorized, "Invalid API token")
|
||||
return
|
||||
@@ -173,10 +176,10 @@ func hashToken(token string) string {
|
||||
// view/regenerate the bearer token its own devices use against the sync API.
|
||||
// The caller's identity is resolved via sharedauth.UserFromContext, populated
|
||||
// by the s.auth.Require wrapper server.go mounts these routes behind -- in
|
||||
// auth-disabled mode that middleware always resolves to sharedauth's fixed
|
||||
// placeholder identity (ID 0), so a token minted in that mode is real and
|
||||
// functional, just scoped to that one shared identity rather than a
|
||||
// per-account AuthGuard identity, matching the pre-migration behavior.
|
||||
// auth-disabled mode, or while login is switched off, that middleware always
|
||||
// resolves to sharedauth's fixed placeholder identity (ID 0). A token minted
|
||||
// for it is stored, but requireAPIToken never accepts identity 0, so a caller
|
||||
// without a session cannot turn it into access to the sync API.
|
||||
func (s *Server) handleTokenStatus(w http.ResponseWriter, r *http.Request) {
|
||||
user := sharedauth.UserFromContext(r.Context())
|
||||
if user == nil {
|
||||
|
||||
Reference in new issue
Block a user