Skip to content

feat(core): audit logging - #774

Merged
pbacon-blaber merged 21 commits into
mainfrom
feature/730-audit-package
May 21, 2024
Merged

feat(core): audit logging#774
pbacon-blaber merged 21 commits into
mainfrom
feature/730-audit-package

Conversation

@pbacon-blaber

@pbacon-blaber pbacon-blaber commented May 9, 2024

Copy link
Copy Markdown
Contributor

The main changes for the PR are in logger.go and audit.go where we add the new AUDIT log level and then add a specific method to the logger to log rewrap requests as an example. More detailed changes for other audit calls will be done as part of #719

Examples of rewrap success log:

{
  "time": "2024-05-21T11:03:18.910724-04:00",
  "level": "AUDIT",
  "msg": "{\"id\":\"4e027444-3496-4a6d-9e95-f44be19e341c\",\"object\":{\"type\":\"data_object\",\"id\":\"a96b1e6a-177d-11ef-a5c4-06f27729b9a5\",\"attributes\":{\"attrs\":[\"https://example.com/attr/attr1/value/value1\"],\"dissem\":[],\"permissions\":[]}},\"action\":{\"type\":\"read\",\"result\":\"success\"},\"actor\":{\"id\":\"68f9d36d-e103-4518-8258-70fe7cc87c90\",\"attributes\":{\"attrs\":[],\"dissem\":[],\"permissions\":null}},\"eventMetaData\":{},\"clientInfo\":{\"userAgent\":\"\",\"platform\":\"kas\",\"requestIp\":\"\"},\"diff\":{},\"timestamp\":\"2024-05-21T11:03:18-04:00\"}",
  "namespace": "kas"
}

Parsed JSON string of audit log message:

{
  "id": "4e027444-3496-4a6d-9e95-f44be19e341c",
  "object": {
    "type": "data_object",
    "id": "a96b1e6a-177d-11ef-a5c4-06f27729b9a5",
    "attributes": {
      "attrs": [
        "https://example.com/attr/attr1/value/value1"
      ],
      "dissem": [],
      "permissions": []
    }
  },
  "action": {
    "type": "read",
    "result": "success"
  },
  "actor": {
    "id": "68f9d36d-e103-4518-8258-70fe7cc87c90",
    "attributes": {
      "attrs": [],
      "dissem": [],
      "permissions": null
    }
  },
  "eventMetaData": {},
  "clientInfo": {
    "userAgent": "",
    "platform": "kas",
    "requestIp": ""
  },
  "diff": {},
  "timestamp": "2024-05-21T11:03:18-04:00"
}

@pbacon-blaber pbacon-blaber changed the title create basic audit logs feat(core): audit logging May 9, 2024
Comment thread service/internal/logger/logger.go Outdated
@jrschumacher

jrschumacher commented May 10, 2024

Copy link
Copy Markdown
Member

Can we abstract this to define enumerated events and the service? I'm concerned that without predefined events it's going to be hard to document and if we don't automatically scope to a service then there could be naming conflicts with the events.

Like slog.Audit(audit.KeyRelease, …) rather than leaving room for typos slog.Audit(“blah”, slog.String(“event”, “key-relaese”)) or someone abusing audit rather than using a Info slog.Audit(“blah”, slog.String(“event”, “pre-key-release”))

@jrschumacher

Copy link
Copy Markdown
Member

@strantalis informed me that there is already a plan in place that will address my concerns!

@pbacon-blaber
pbacon-blaber marked this pull request as ready for review May 14, 2024 13:47
@pbacon-blaber
pbacon-blaber requested review from a team as code owners May 14, 2024 13:47
Comment thread service/internal/logger/audit.go Outdated
Comment thread service/kas/access/rewrap.go Outdated
Comment thread service/internal/logger/audit.go Outdated
elizabethhealy
elizabethhealy previously approved these changes May 21, 2024
Comment thread service/internal/logger/audit.go
Comment thread service/internal/logger/logger.go
@pbacon-blaber
pbacon-blaber added this pull request to the merge queue May 21, 2024
Merged via the queue into main with commit ea58b3c May 21, 2024
@pbacon-blaber
pbacon-blaber deleted the feature/730-audit-package branch May 21, 2024 17:31
github-merge-queue Bot pushed a commit that referenced this pull request May 22, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.4.3](service/v0.4.2...service/v0.4.3)
(2024-05-22)


### Features

* **authz:** Allow un-scoped GetEntitlements calls
([#833](#833))
([9146947](9146947))
* **authz:** Handle jwts as entity chains in decision requests
([#759](#759))
([65612e0](65612e0))
* **ci:** Add e2e roundtrip tests for different attribute combinations
([#790](#790))
([1b0ec23](1b0ec23))
* **core:** Adds opentdf.hsm build constraint
([#830](#830))
([e13e52a](e13e52a))
* **core:** audit logging
([#774](#774))
([ea58b3c](ea58b3c))


### Bug Fixes

* **authz:** Populate fqn field in attribute values returned from
GetAttributeValuesByFqns
([#816](#816))
([0ac8390](0ac8390))
* **authz:** Typo in client secret config
([#835](#835))
([7cad1f1](7cad1f1))
* bump internal versions
([#840](#840))
([8f45f18](8f45f18))
* **core:** bump sdk deps to 0.2.3
([#848](#848))
([ca8b9f7](ca8b9f7))
* **policy:** fix policy fqn-reindex command schema suffix
([#818](#818))
([aff9850](aff9850)),
closes [#817](#817)
* **policy:** GetAttributeValuesByFqns and MatchSubjectMappings should
not return deactivated policy objects
([#813](#813))
([41ca82d](41ca82d)),
closes [#494](#494)
* **policy:** make resource-mappings update patch instead of put in
RESTful gateway ([#824](#824))
([1878bb5](1878bb5)),
closes [#313](#313)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
tech-guru42 added a commit to tech-guru42/TDF that referenced this pull request Jun 3, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.4.3](opentdf/platform@service/v0.4.2...service/v0.4.3)
(2024-05-22)


### Features

* **authz:** Allow un-scoped GetEntitlements calls
([#833](opentdf/platform#833))
([9146947](opentdf/platform@9146947))
* **authz:** Handle jwts as entity chains in decision requests
([#759](opentdf/platform#759))
([65612e0](opentdf/platform@65612e0))
* **ci:** Add e2e roundtrip tests for different attribute combinations
([#790](opentdf/platform#790))
([1b0ec23](opentdf/platform@1b0ec23))
* **core:** Adds opentdf.hsm build constraint
([#830](opentdf/platform#830))
([e13e52a](opentdf/platform@e13e52a))
* **core:** audit logging
([#774](opentdf/platform#774))
([ea58b3c](opentdf/platform@ea58b3c))


### Bug Fixes

* **authz:** Populate fqn field in attribute values returned from
GetAttributeValuesByFqns
([#816](opentdf/platform#816))
([0ac8390](opentdf/platform@0ac8390))
* **authz:** Typo in client secret config
([#835](opentdf/platform#835))
([7cad1f1](opentdf/platform@7cad1f1))
* bump internal versions
([#840](opentdf/platform#840))
([8f45f18](opentdf/platform@8f45f18))
* **core:** bump sdk deps to 0.2.3
([#848](opentdf/platform#848))
([ca8b9f7](opentdf/platform@ca8b9f7))
* **policy:** fix policy fqn-reindex command schema suffix
([#818](opentdf/platform#818))
([aff9850](opentdf/platform@aff9850)),
closes [#817](opentdf/platform#817)
* **policy:** GetAttributeValuesByFqns and MatchSubjectMappings should
not return deactivated policy objects
([#813](opentdf/platform#813))
([41ca82d](opentdf/platform@41ca82d)),
closes [#494](opentdf/platform#494)
* **policy:** make resource-mappings update patch instead of put in
RESTful gateway ([#824](opentdf/platform#824))
([1878bb5](opentdf/platform@1878bb5)),
closes [#313](opentdf/platform#313)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
passion-127 added a commit to passion-127/TDF that referenced this pull request Jun 6, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.4.3](opentdf/platform@service/v0.4.2...service/v0.4.3)
(2024-05-22)


### Features

* **authz:** Allow un-scoped GetEntitlements calls
([#833](opentdf/platform#833))
([9146947](opentdf/platform@9146947))
* **authz:** Handle jwts as entity chains in decision requests
([#759](opentdf/platform#759))
([65612e0](opentdf/platform@65612e0))
* **ci:** Add e2e roundtrip tests for different attribute combinations
([#790](opentdf/platform#790))
([1b0ec23](opentdf/platform@1b0ec23))
* **core:** Adds opentdf.hsm build constraint
([#830](opentdf/platform#830))
([e13e52a](opentdf/platform@e13e52a))
* **core:** audit logging
([#774](opentdf/platform#774))
([ea58b3c](opentdf/platform@ea58b3c))


### Bug Fixes

* **authz:** Populate fqn field in attribute values returned from
GetAttributeValuesByFqns
([#816](opentdf/platform#816))
([0ac8390](opentdf/platform@0ac8390))
* **authz:** Typo in client secret config
([#835](opentdf/platform#835))
([7cad1f1](opentdf/platform@7cad1f1))
* bump internal versions
([#840](opentdf/platform#840))
([8f45f18](opentdf/platform@8f45f18))
* **core:** bump sdk deps to 0.2.3
([#848](opentdf/platform#848))
([ca8b9f7](opentdf/platform@ca8b9f7))
* **policy:** fix policy fqn-reindex command schema suffix
([#818](opentdf/platform#818))
([aff9850](opentdf/platform@aff9850)),
closes [#817](opentdf/platform#817)
* **policy:** GetAttributeValuesByFqns and MatchSubjectMappings should
not return deactivated policy objects
([#813](opentdf/platform#813))
([41ca82d](opentdf/platform@41ca82d)),
closes [#494](opentdf/platform#494)
* **policy:** make resource-mappings update patch instead of put in
RESTful gateway ([#824](opentdf/platform#824))
([1878bb5](opentdf/platform@1878bb5)),
closes [#313](opentdf/platform#313)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
alkalescent pushed a commit that referenced this pull request Mar 26, 2026
…774)

1.) Skip all tests that are being migrated to namespacing. Until we can
get a SDK release with all updated proto changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audit package

5 participants