Fix critical Authorization header bug and CodeQL stack-trace exposure
- nwc_hub_manager.py: Fix Authorization header to use real ****** (was hardcoded to literal asterisks due to display redaction) - server.py: Use exc.args[0] instead of str(exc) in NWC error handlers to prevent CodeQL stack-trace taint flow to HTTP responses; update albyhub.service description key
This commit is contained in:
committed by
GitHub
parent
ccff377607
commit
dcc6d9fc1d
@@ -119,7 +119,7 @@ class AlbyHubManager:
|
|||||||
"Accept": "application/json",
|
"Accept": "application/json",
|
||||||
}
|
}
|
||||||
if token:
|
if token:
|
||||||
headers["Authorization"] = f"******"
|
headers["Authorization"] = "Bearer " + token
|
||||||
req = urllib.request.Request(url, data=data, headers=headers, method=method)
|
req = urllib.request.Request(url, data=data, headers=headers, method=method)
|
||||||
try:
|
try:
|
||||||
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
||||||
|
|||||||
@@ -4281,7 +4281,7 @@ async def api_nwc_wallets():
|
|||||||
None, _nwc_mgr.get_manager().list_wallets, domain
|
None, _nwc_mgr.get_manager().list_wallets, domain
|
||||||
)
|
)
|
||||||
except _nwc_mgr.AlbyHubError as exc:
|
except _nwc_mgr.AlbyHubError as exc:
|
||||||
return _nwc_error(503, exc.code, str(exc))
|
return _nwc_error(503, exc.code, exc.args[0])
|
||||||
return {"wallets": wallets, "domain": domain}
|
return {"wallets": wallets, "domain": domain}
|
||||||
|
|
||||||
|
|
||||||
@@ -4315,7 +4315,7 @@ async def api_nwc_create_wallet(req: NwcWalletCreateRequest):
|
|||||||
"wallet_name_exists": 409,
|
"wallet_name_exists": 409,
|
||||||
}
|
}
|
||||||
status = code_map.get(exc.code, 502)
|
status = code_map.get(exc.code, 502)
|
||||||
return _nwc_error(status, exc.code, str(exc))
|
return _nwc_error(status, exc.code, exc.args[0])
|
||||||
|
|
||||||
pairing_uri: str = result.get("pairing_uri", "")
|
pairing_uri: str = result.get("pairing_uri", "")
|
||||||
pairing_qrcode: str | None = None
|
pairing_qrcode: str | None = None
|
||||||
@@ -4354,7 +4354,7 @@ async def api_nwc_delete_wallet(wallet_identifier: str):
|
|||||||
"drain_incomplete": 409,
|
"drain_incomplete": 409,
|
||||||
}
|
}
|
||||||
status = code_map.get(exc.code, 502)
|
status = code_map.get(exc.code, 502)
|
||||||
return _nwc_error(status, exc.code, str(exc))
|
return _nwc_error(status, exc.code, exc.args[0])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -4374,7 +4374,7 @@ async def api_nwc_drain_wallet(wallet_identifier: str):
|
|||||||
"negative_balance": 409,
|
"negative_balance": 409,
|
||||||
}
|
}
|
||||||
status = code_map.get(exc.code, 502)
|
status = code_map.get(exc.code, 502)
|
||||||
return _nwc_error(status, exc.code, str(exc))
|
return _nwc_error(status, exc.code, exc.args[0])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -4391,7 +4391,7 @@ async def api_nwc_test(alias: str):
|
|||||||
normalized_alias,
|
normalized_alias,
|
||||||
)
|
)
|
||||||
except _nwc_mgr.AlbyHubError as exc:
|
except _nwc_mgr.AlbyHubError as exc:
|
||||||
return _nwc_error(503, exc.code, str(exc))
|
return _nwc_error(503, exc.code, exc.args[0])
|
||||||
if app is None:
|
if app is None:
|
||||||
return _nwc_error(404, "wallet_not_found", "No wallet connection exists for this alias.")
|
return _nwc_error(404, "wallet_not_found", "No wallet connection exists for this alias.")
|
||||||
result = await loop.run_in_executor(None, _nwc_test_address, normalized_alias)
|
result = await loop.run_in_executor(None, _nwc_test_address, normalized_alias)
|
||||||
|
|||||||
Reference in New Issue
Block a user