Skip to content

Feature/asvs masvs controls#39

Merged
drneox merged 6 commits intomainfrom
feature/asvs-masvs-controls
Sep 8, 2025
Merged

Feature/asvs masvs controls#39
drneox merged 6 commits intomainfrom
feature/asvs-masvs-controls

Conversation

@drneox
Copy link
Copy Markdown
Owner

@drneox drneox commented Sep 8, 2025

No description provided.

✨ STRIDE Category Validation:
- Add stride_validator.py with normalize_stride_category function
- Implement STRIDE validation in API endpoints (manual + AI threats)
- Add validation in CRUD operations for threat updates
- Ensure data consistency across all threat creation/update paths

🐛 API Cleanup:
- Remove duplicate imports in api.py
- Fix indentation issues
- Remove obsolete commented code
- Organize imports by category (stdlib, third-party, local)

🗂️ File Management Improvements:
- Implement UUID-based filenames for uploaded diagrams
- Add file extension validation for security
- Return both base64 and saved filename from save_image()
- Prevent filename collisions and security issues

🐳 Docker Persistence:
- Add diagrams_data volume for persistent diagram storage
- Configure nginx to serve diagrams directly from volume
- Fix diagram loss on container restart/rebuild
- Remove obsolete docker-compose version attribute

🎨 Frontend Enhancements:
- Implement compact STRIDE dropdown (shows first letter only)
- Add ResidualRiskSelector pattern for better UX
- Maintain consistent STRIDE categories between frontend/backend

🛡️ Security & Consistency:
- All STRIDE categories normalized to standard format
- Case-insensitive validation with fallback to 'Spoofing'
- File type validation prevents malicious uploads
- Centralized validation logic in stride_validator module
…to.py

- Updated MASVS controls from 8 to 35 total controls
- Changed MASVS format from MSTG-AUTH-1 to AUTH-1
- Updated STRIDE examples to use new MASVS format
- Updated total controls count from 308 to 335
- Fixed test expectations for coverage calculations
- Updated tag normalization and validation tests
- Removed unused __init___auto.py file
- 104 tests now passing (improved from 89)
- Fixed API endpoint parameter conflicts in crud.get_all_threats()
- Updated schemas.py with proper InformationSystem models
- Enhanced control tags system with better search functionality
- Added comprehensive Reports and ReportsFilters components
- Implemented RiskFilter component for threat filtering
- Improved localization support for reports interface
- Cleaned up test files and enhanced test coverage
- Fixed STRIDE categorization and control tag suggestions
- Updated service layer for better API integration
- Resolved Docker build and CORS configuration issues
- Extract standard name from search result format 'A.9.4.1 (ISO27001)'
- Use extracted standard_part instead of non-existent field in ALL_CONTROLS
- Now detailed_results properly includes tag, title, description, category, and standard fields
- Resolves empty detailed_results issue for control tags tooltips in frontend
- Update control_tags.py with improved search functionality
- Enhance ASVS standard definitions and controls structure
- Improve AI integration in tzu_ai.py for better threat analysis
- Add supporting scripts for field extraction fixes
- System status updates and maintenance improvements
- Fixed Chakra UI version compatibility issues by reverting to stable versions
- Added TextEncoder/TextDecoder polyfill for jsPDF compatibility in tests
- Fixed App.test.js to search for correct text ('TZU Login' instead of 'TZU Security')
- Added setupTests.js with proper polyfills for Node.js environment
- Created diagrams/.gitkeep to ensure directory exists
- Updated frontend dependencies and resolved npm package conflicts
- All frontend tests now passing (8 test suites, 79 tests)
Comment thread api/api.py
Comment on lines +559 to +562
return {
"message": f"Error during processing: {str(e)}",
"success": False
}

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.

Copilot Autofix

AI 8 months ago

To address the issue and avoid information exposure via error messages, the generic error message "An error occurred during processing." should be returned to the API user, while the real exception message and its traceback should be logged internally. This preserves user privacy and prevents attackers from gaining insights into the system’s internals. The fix is to update the except block:

  • Replace the dynamic error message with a static, user-safe message.
  • Log the exception (and, if possible, its traceback) on the server side for later analysis by developers.
  • To implement logging, import the standard logging module.
    All required changes can be made directly within api/api.py, inside the except block of the evaluate_system_diagram endpoint. We'll also add a relevant import if not present.

Suggested changeset 1
api/api.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/api/api.py b/api/api.py
--- a/api/api.py
+++ b/api/api.py
@@ -11,11 +11,17 @@
 - Report Generation
 """
 
+# Setup logging if not already configured elsewhere.
+import logging
+logging.basicConfig(level=logging.INFO)
+
 import os
 import json
 from uuid import UUID
 from datetime import datetime, timedelta
 from typing import List, Optional, Dict, Any
+import logging
+import traceback
 
 # Third-party imports
 from fastapi import FastAPI, HTTPException, Depends, UploadFile, Body, status, Path, Query
@@ -556,8 +557,9 @@
         }
     
     except Exception as e:
+        logging.error("Error during system diagram evaluation: %s\n%s", str(e), traceback.format_exc())
         return {
-            "message": f"Error during processing: {str(e)}", 
+            "message": "An error occurred during processing.", 
             "success": False
         }
 
EOF
@@ -11,11 +11,17 @@
- Report Generation
"""

# Setup logging if not already configured elsewhere.
import logging
logging.basicConfig(level=logging.INFO)

import os
import json
from uuid import UUID
from datetime import datetime, timedelta
from typing import List, Optional, Dict, Any
import logging
import traceback

# Third-party imports
from fastapi import FastAPI, HTTPException, Depends, UploadFile, Body, status, Path, Query
@@ -556,8 +557,9 @@
}

except Exception as e:
logging.error("Error during system diagram evaluation: %s\n%s", str(e), traceback.format_exc())
return {
"message": f"Error during processing: {str(e)}",
"message": "An error occurred during processing.",
"success": False
}

Copilot is powered by AI and may make mistakes. Always verify output.
@drneox drneox merged commit 3157afb into main Sep 8, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants