feat: assessment logging, synced with the server-side entitlement gate - #7
Draft
alistairsmith-tech wants to merge 3 commits into
Draft
feat: assessment logging, synced with the server-side entitlement gate#7alistairsmith-tech wants to merge 3 commits into
alistairsmith-tech wants to merge 3 commits into
Conversation
Logs the raw Monocle assessment for each verify as one JSON line via console.log (picked up by CloudWatch), for customers to forward wherever they want. Lives on the Lambda@Edge verify path only (the CloudFront Function has no body access and no header room). Gated on a baked logAssessment: true config flag (default off) and wrapped in try/catch so it can never affect the fail-open verify. The CloudFront Function artifact is unchanged (still 9738 bytes). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
monocle-services now omits PolicyResponse.assessment for orgs whose plan lacks the assessment-logging entitlement, so the decision arrives without one. logging a record that announces itself as an assessment and carries none is noise, so the helper returns early instead. no behaviour change for an entitled org: the assessment is present and the line is written exactly as before. the verify decision is untouched either way, since the gate only removes data from the response. test fixtures updated to carry an assessment, which is what a policy response has always looked like until now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Syncs the assessment-logging branch with the server-side gate landing in monocle-services#153.
what changed
monocle-servicesnow omitsPolicyResponse.assessmentfor orgs whose plan lacks the assessment-logging entitlement. Nothing here broke: the SDK does a bareresponse.json()with no validation, so the field is simplyundefined, and no plugin dereferences it.But each plugin would have written a line announcing itself as an assessment log while carrying no assessment. An unentitled org would fill their logs with empty records and reasonably ask why. So the helper now returns early when the assessment is absent.
No change for an entitled org: the assessment is present and the line is written exactly as before. The verify decision is untouched either way, since the gate only removes data from the response.
also in here
Merged
main(the branch was a few commits behind) and corrected the test fixtures, which mocked decisions with noassessmentfield at all. That was never a shape the policy API returned.the gate does NOT cover this plugin end to end
Worth being explicit, because it is easy to assume otherwise.
USE_POLICY_APIselects the mode:The decrypt path with no
PRIVATE_KEYcalls/api/v1/assessment, which is not entitlement-gated, and logs the full assessment. So an unentitled org can still log assessments by flipping one worker variable. The server-side gate covers policy mode only, by design, since on/api/v1/assessmentthe assessment is the payload rather than something incidental we can withhold.test evidence
Full suite green.