Skip to content

Commit

Permalink
Return Google Maps API key + canarydrop from new history endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mclmax authored and thinkst-az committed May 16, 2024
1 parent 7ed0d04 commit f0e5d40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions canarytokens/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2544,3 +2544,9 @@ class ManageResponse(BaseModel):
wg_qr_code: Optional[str]
qr_code: Optional[str]
force_https: Optional[bool]


class HistoryResponse(BaseModel):
canarydrop: Dict
history: AnyTokenHistory
google_api_key: Optional[str]
11 changes: 8 additions & 3 deletions frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
from canarytokens.models import (
AnyDownloadRequest,
AnySettingsRequest,
AnyTokenHistory,
AnyTokenRequest,
AnyTokenResponse,
AWSKeyTokenRequest,
Expand Down Expand Up @@ -98,6 +97,7 @@
DownloadZipResponse,
FastRedirectTokenRequest,
FastRedirectTokenResponse,
HistoryResponse,
KubeconfigTokenRequest,
KubeconfigTokenResponse,
Log4ShellTokenRequest,
Expand Down Expand Up @@ -780,11 +780,16 @@ async def api_manage_canarytoken(token: str, auth: str) -> ManageResponse:
@api.get(
"/history",
tags=["Canarytokens History"],
response_model=AnyTokenHistory,
response_model=HistoryResponse,
)
async def api_history(token: str, auth: str) -> JSONResponse:
canarydrop = get_canarydrop_and_authenticate(token=token, auth=auth)
return canarydrop.triggered_details
response = {
"canarydrop": canarydrop,
"history": canarydrop.triggered_details,
"google_api_key": queries.get_canary_google_api_key(),
}
return HistoryResponse(**response)


@api.post(
Expand Down

0 comments on commit f0e5d40

Please sign in to comment.