Skip to content

Commit

Permalink
fix(audit): fix field name 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaraTersi committed Dec 6, 2024
1 parent 3d8d8cd commit eb8f647
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/audit/api/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const docTemplate = `{
"expectedHash": {
"type": "string"
},
"wasTempered": {
"isTampered": {
"type": "boolean"
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/audit/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"expectedHash": {
"type": "string"
},
"wasTempered": {
"isTampered": {
"type": "boolean"
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/audit/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ definitions:
type: string
expectedHash:
type: string
wasTempered:
isTampered:
type: boolean
type: object
Leaf:
Expand Down
6 changes: 3 additions & 3 deletions components/audit/internal/adapters/http/in/trillian.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (th *TrillianHandler) AuditLogs(c *fiber.Ctx) error {
validations := make([]HashValidationResponse, 0)

for key, value := range auditInfo.Leaves {
expectedHash, calculatedHash, wasTempered, err := th.UseCase.ValidatedLogHash(ctx, auditInfo.TreeID, value)
expectedHash, calculatedHash, isTampered, err := th.UseCase.ValidatedLogHash(ctx, auditInfo.TreeID, value)
if err != nil {
mopentelemetry.HandleSpanError(&span, "Failed to retrieve log validation", err)

Expand All @@ -60,15 +60,15 @@ func (th *TrillianHandler) AuditLogs(c *fiber.Ctx) error {
return http.WithError(c, err)
}

if wasTempered {
if isTampered {
logger.Warnf("Log for %v has been tampered! Expected: %x, Found: %x\n", key, expectedHash, calculatedHash)
}

response := &HashValidationResponse{
AuditID: key,
ExpectedHash: expectedHash,
CalculatedHash: calculatedHash,
WasTempered: wasTempered,
IsTampered: isTampered,
}

validations = append(validations, *response)
Expand Down

0 comments on commit eb8f647

Please sign in to comment.