fix: Improve auth debugging and temp directory handling
continuous-integration/drone/push Build is passing

- Add detailed logging for password verification to diagnose auth issues
- Validate bcrypt hash format before attempting comparison
- Use /tmp/minio-webui-temp as default temp directory (Docker-prepared)
- Add comment about escaping $ in bcrypt hashes for docker-compose
This commit is contained in:
Paul Nothaft
2026-01-05 09:32:12 +01:00
parent fc9898c59b
commit 6beb4ae03c
73 changed files with 111 additions and 6012 deletions
+25 -13
View File
@@ -27,26 +27,38 @@ class AuthService {
async verifyPassword(password) {
try {
const hash = config.auth.adminPasswordHash;
// Debug logging in development
if (config.app.env === 'development') {
logger.debug(`Password verification debug:`, {
hashExists: !!hash,
hashLength: hash ? hash.length : 0,
hashPrefix: hash ? hash.substring(0, 7) : 'none',
passwordLength: password.length
});
}
// Debug logging for troubleshooting
logger.debug('Password verification attempt', {
hashExists: !!hash,
hashLength: hash ? hash.length : 0,
hashPrefix: hash ? hash.substring(0, 7) : 'none',
hashValid: hash ? hash.startsWith('$2') : false,
passwordLength: password ? password.length : 0
});
if (!hash) {
logger.error('No admin password hash configured');
return false;
}
// Validate hash format (bcrypt hashes start with $2a$, $2b$, or $2y$)
if (!hash.match(/^\$2[aby]\$\d{2}\$/)) {
logger.error('Invalid bcrypt hash format - hash may be corrupted by environment variable interpolation', {
hashPrefix: hash.substring(0, 20),
expectedFormat: '$2b$12$...'
});
return false;
}
const isValid = await bcrypt.compare(password, hash);
return isValid;
} catch (error) {
logger.error('Password verification error:', error);
logger.error('Password verification error', {
message: error.message,
code: error.code,
stack: error.stack
});
return false;
}
}
+2 -2
View File
@@ -14,8 +14,8 @@ const execAsync = util.promisify(exec);
class MinIOService {
constructor(alias = config.minio.defaultAlias) {
this.alias = alias;
// Use local temp directory by default, fallback to system temp if needed
this.tempDir = path.join(__dirname, '../../temp');
// Use Docker-prepared temp directory first, then fallback options
this.tempDir = process.env.TEMP_DIR || '/tmp/minio-webui-temp';
this.ensureTempDir();
}