Skip to content

Commit 6a731eb

Browse files
committed
Fix reported security issues and improve logging
1 parent 0fcd0b3 commit 6a731eb

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

.github/workflows/security-scan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ jobs:
6767
if: always()
6868
uses: github/codeql-action/upload-sarif@v3
6969
with:
70-
sarif_file: 'results'
70+
sarif_file: "results"
7171
wait-for-processing: true
72-
category: 'CodeQL'
72+
category: "CodeQL"

kcn_proxy/web/api.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,9 @@ async def get_vardiff_state():
477477
return JSONResponse({"enabled": True, **manager.export_state()})
478478
except Exception as e:
479479
logger.error("Error exporting vardiff state: %s", e, exc_info=True)
480-
return JSONResponse({"enabled": True, "error": "Failed to retrieve state"}, status_code=500)
480+
return JSONResponse(
481+
{"enabled": True, "error": "Failed to retrieve state"}, status_code=500
482+
)
481483

482484

483485
@app.get("/favicon.ico")
@@ -536,7 +538,9 @@ async def clear_best_shares():
536538
)
537539
except Exception as e:
538540
logger.error("Error clearing best shares: %s", e)
539-
return JSONResponse({"status": "error", "message": "Failed to clear shares"}, status_code=500)
541+
return JSONResponse(
542+
{"status": "error", "message": "Failed to clear shares"}, status_code=500
543+
)
540544

541545

542546
@app.get("/api/lcn_hash_fix_status")
@@ -578,7 +582,9 @@ async def lcn_hash_fix_status():
578582
)
579583
except Exception as e:
580584
logger.error("Error checking LCN hash fix status: %s", e, exc_info=True)
581-
return JSONResponse({"error": "Internal error", "show_button": False}, status_code=500)
585+
return JSONResponse(
586+
{"error": "Internal error", "show_button": False}, status_code=500
587+
)
582588

583589

584590
@app.post("/api/fix_lcn_aux_hashes")
@@ -735,7 +741,9 @@ async def get_share_stats(worker: str = None, minutes: int = 10):
735741
return JSONResponse({"error": "Database not enabled"}, status_code=503)
736742
except Exception as e:
737743
logger.error("Error retrieving share stats: %s", e)
738-
return JSONResponse({"error": "Failed to retrieve share statistics"}, status_code=500)
744+
return JSONResponse(
745+
{"error": "Failed to retrieve share statistics"}, status_code=500
746+
)
739747

740748

741749
@app.post("/api/cleanup")
@@ -1019,7 +1027,9 @@ async def clear_miner_record(worker_name: str):
10191027
return JSONResponse({"status": "success", "worker_name": worker_name})
10201028
except Exception as e:
10211029
logger.error("Error deleting miner record %s: %s", worker_name, e)
1022-
return JSONResponse({"status": "error", "message": "Failed to delete record"}, status_code=500)
1030+
return JSONResponse(
1031+
{"status": "error", "message": "Failed to delete record"}, status_code=500
1032+
)
10231033

10241034

10251035
@app.get("/api/earnings")

0 commit comments

Comments
 (0)