Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .bandit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[bandit]
exclude_dirs = __pycache__,migrations,htmlcov,staticfiles,.git,.venv,.mypy_cache,venv,tests
verbose = True
debug = True
format = json
output_file = bandit_debug_report.json

[tool:bandit]
# Configurações específicas do Bandit
severity = all
confidence = all
28 changes: 28 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[run]
source = .
omit =
*/migrations/*
*/__pycache__/*
*/tests/*
*/test_*.py
manage.py
sga/wsgi.py
sga/asgi.py
sga/settings*.py
api/*
venv/*
.venv/*
staticfiles/*
static/*
analyze_bandit_ci.py
run_bandit_separate.py

[report]
exclude_lines =
pragma: no cover
def __repr__
raise AssertionError
raise NotImplementedError
if __name__ == .__main__.:
class .*\bProtocol\):
@(abc\.)?abstractmethod
37 changes: 29 additions & 8 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage
pip install coverage pytest pytest-django

- name: Run Database Migrations
env:
Expand All @@ -55,16 +55,31 @@ jobs:
DJANGO_SETTINGS_MODULE: sga.settings
DATABASE_URL: postgres://testuser:testpass@postgres:5432/testdb
run: |
coverage run --source='.' manage.py test --settings=sga.settings_test
coverage run --source=. --omit="bandit_Rodar.py,bandit_analisar.py,test_fluxocompleto2.py" manage.py test tests --pattern="*test*.py" --settings=sga.tests.settings_test
coverage report
coverage html

- name: Run Integration Test with HTML Report
env:
DJANGO_SETTINGS_MODULE: sga.settings
DATABASE_URL: postgres://testuser:testpass@postgres:5432/testdb
run: |
echo "Running complete integration test with HTML report generation..."
python test_fluxocompleto2.py
echo "Integration test completed successfully"

- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: htmlcov/

- name: Upload Integration Test Report
uses: actions/upload-artifact@v4
with:
name: integration-test-report
path: relatorio_teste_real.html

lint:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -99,17 +114,23 @@ jobs:
pip install -r requirements.txt
pip install safety bandit mypy
- name: Run Safety Scan
uses: pyupio/safety-action@v1
with:
api-key: ${{ secrets.SAFETY_API_KEY }}
run: safety scan .
env:
SAFETY_API_KEY: ${{ secrets.SAFETY_API_KEY }}
- name: Run Bandit Security Linter
run: |
bandit -r . --exclude venv,.git,__pycache__,.mypy_cache,staticfiles,node_modules -f html -o bandit-report.html || true
echo "Running Bandit security analysis using separate script..."
python bandit_Rodar.py
echo "Bandit analysis completed successfully"

- name: Analyze Bandit Results
run: |
python bandit_analisar.py
- name: Run MyPy Type Checking
run: mypy .

- name: Upload Bandit Report
uses: actions/upload-artifact@v4
with:
name: bandit-report
path: bandit-report.html
name: bandit-reports
path: bandit_report.html
187 changes: 185 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,188 @@ cython_debug/
.cursorignore
.cursorindexingignore

# Copilot Instructions
.github/copilot-instructions.md
# Backup files
*.bak
*.backup
*~

# Development and testing artifacts
*.pyc
*.pyo
*.pyd
__pycache__/
*.so
*.dll
*.dylib

# Database and media files
*.sqlite3
*.db
/media/
staticfiles/
staticfiles_build/

# Environment and configuration
.env
.env.*
settings/local.py
settings/production.py
settings/staging.py

# Logs and debugging
*.log
logs/
debug.log
django_debug.log
gunicorn.log
celery.log

# IDE and editors
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
Thumbs.db

# Testing and coverage
.coverage
.coverage.*
coverage.xml
htmlcov/
.pytest_cache/
.tox/
.nox/
.cache/

# Type checking
.mypy_cache/
.dmypy.json
dmypy.json
.pytype/

# Linting and formatting
.ruff_cache/

# Security reports (generated by CI/CD)
bandit_*.json
bandit_report.html
safety-report.json
security_scan_*.json

# Node.js (for frontend assets)
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Docker and containers
.dockerignore
docker-compose.override.yml

# Deployment and build artifacts
build/
dist/
*.egg-info/
.eggs/

# Secrets and certificates
secrets.json
keys/
*.key
*.pem
*.crt
*.p12
*.pfx
*.cer

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
desktop.ini

# Temporary files
*.tmp
*.temp
.tmp/
temp/

# Jupyter notebooks checkpoints
.ipynb_checkpoints/

# VS Code extensions and settings
.vscode/extensions.json
.vscode/settings.json

# Cursor AI editor
.cursorignore
.cursorindexingignore

# GitHub Copilot
.github/copilot-instructions.md

# Additional Django specific
# Uncomment if you want to ignore migrations in development
# */migrations/

# Redis dumps
dump.rdb

# Celery beat schedule
celerybeat-schedule
celerybeat.pid

# Sentry config
.sentryclirc

# AWS credentials
.aws/

# Google Cloud
.gcloud/

# Azure
.azure/

# Terraform
*.tfstate
*.tfvars

# Ansible
*.retry

# Vagrant
.vagrant/

# VirtualBox
*.vbox
*.vbox-prev

# VMware
*.vmx
*.vmxf
*.vmdk
*.nvram

# Serverless frameworks
.serverless/

# Local development overrides
docker-compose.override.yml
docker-compose.local.yml

# Documentation and planning files
ROTEIRO_PI2.md
roteiro_*.md
planning_*.md
notes_*.md
ROTEIRO_TESTES.md

# Generated test reports
relatorio_teste_real.html
11 changes: 11 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"recommendations": [
"ms-python.python",
"ms-python.flake8",
"ms-python.mypy-type-checker",
"batisteo.vscode-django",
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"ms-vscode.vscode-json"
]
}
30 changes: 30 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"files.associations": {
"*.html": "html",
"**/templates/**/*.html": "django-html",
"**/templates/**": "django-html"
},
"emmet.includeLanguages": {
"django-html": "html"
},
"html.validate.scripts": false,
"html.validate.styles": false,
"css.validate": false,
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"files.exclude": {
"**/__pycache__": true,
"**/*.pyc": true,
"**/staticfiles/": true,
"**/htmlcov/": true,
"**/.coverage": true
},
"search.exclude": {
"**/staticfiles/": true,
"**/htmlcov/": true,
"**/__pycache__": true,
"**/*.pyc": true
}
}
Loading