Skip to content

🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!

API Security Improvements

sassanix3f6a0cbb3ee2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1bd37cc..e68392b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,16 @@
# Changelog
-## [0.9.7.8] - 2025-03-21
+## [0.9.7.9] - 2025-03-21
+
+ - **API Security Improvements**
+ - Fixed "Authentication attempt without token" warnings in logs
+ - Updated Dockerfile health check to use root URL instead of protected API endpoint
+ - Modified test-api.js to include authentication tokens with requests
+ - Updated API test documentation to show proper authentication examples
+ - Added troubleshooting information in memory bank for authentication issues
+
+## [0.9.7.8] - 2025-03-20
+
- **Security Enhancements**
- **Secure File Access System**
- Implemented comprehensive security controls for uploaded files (invoices, manuals)
diff --git a/Dockerfile b/Dockerfile
index eb6fed8..fb0312c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -102,7 +102,7 @@ EXPOSE 80
# Define health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
- CMD curl -f http://localhost/api/warranties || exit 1
+ CMD curl -f http://localhost/ || exit 1
# Set environment variables
ENV PYTHONUNBUFFERED=1
diff --git a/frontend/api-test.html b/frontend/api-test.html
index f32c83f..32e3cbc 100644
--- a/frontend/api-test.html
+++ b/frontend/api-test.html
@@ -68,7 +68,7 @@
<div class="debug-info">
<h4>Manual API Test</h4>
<p>You can also test the API manually with tools like curl:</p>
- <pre>curl -X GET http://localhost:8005/api/warranties</pre>
+ <pre>curl -X GET -H "Authorization: Bearer YOUR_AUTH_TOKEN" http://localhost:8005/api/warranties</pre>
</div>
<div class="actions">
diff --git a/frontend/test-api.js b/frontend/test-api.js
index 92a065b..eac91c7 100644
--- a/frontend/test-api.js
+++ b/frontend/test-api.js
@@ -6,8 +6,22 @@ document.addEventListener('DOMContentLoaded', function() {
if (resultElement) {
resultElement.innerHTML = '<p>Checking API connection...</p>';
+ // Check for authentication token
+ const token = localStorage.getItem('auth_token');
+ const options = {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ };
+
+ // Add auth token if available
+ if (token) {
+ options.headers['Authorization'] = `Bearer ${token}`;
+ }
+
// Test API connection
- fetch('/api/warranties')
+ fetch('/api/warranties', options)
.then(response => {
if (!response.ok) {
throw new Error('API responded with status: ' + response.status);
@@ -34,6 +48,7 @@ document.addEventListener('DOMContentLoaded', function() {
<ul>
<li>Browser URL: ${window.location.href}</li>
<li>Target API: /api/warranties</li>
+ <li>Authentication: ${token ? 'Token provided' : 'No token available'}</li>
<li>Make sure the backend is running and accessible</li>
<li>Check that nginx is properly configured to proxy API requests</li>
</ul>