feat(ignore): adding event logger for ignored comments#178
Open
feat(ignore): adding event logger for ignored comments#178
Conversation
|
🚀 Preview package published! Install with: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==2.2.81.dev1Docker image: |
0e20dd0 to
09e3172
Compare
Author
|
bugbot run |
bmeck
approved these changes
Apr 7, 2026
bmeck
left a comment
There was a problem hiding this comment.
seems ok, would slightly pref v1 events but this is fine since v1 would be a slightly bigger change
bmeck
reviewed
Apr 7, 2026
socketsecurity/socketcli.py
Outdated
| now = datetime.now(timezone.utc).isoformat() | ||
| shared_fields = { | ||
| "event_kind": "user-action", | ||
| "client_action": "ignore_alerts", |
There was a problem hiding this comment.
action fields should match ResolvedIssueAction, and this is missing the current action from policy (alert_action)
enum ResolvedIssueActionEnum {
error = 'error',
warn = 'warn',
monitor = 'monitor',
ignore = 'ignore',
}
6dff16c to
aebda0d
Compare
aebda0d to
29e2c61
Compare
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.
POST /v0/orgs/{slug}/telemetrywhen users suppress alerts via@SocketSecurity ignorePR/MR commentseyesemoji reaction as a dedup marker — only unprocessed comments (withouteyes) trigger events; after sending, theeyesreaction is addedsender_name/sender_id-1reaction.reactions.eyesfrom API response) and GitLab (lazyhas_eyes_reaction()API call per comment, best-effortpost_eyes_reaction()via Award Emoji API)artifact_input(raw user text) since the ignore command is user input and may not be a valid PURLartifact_purlfrom actual alert objects withalert_actionderived from the alert's resolved policy actionget_ignore_options—@socketSecurity ignore(lowercase s) now worksChanges
socketsecurity/core/cli_client.pypost_telemetry_events()— sends events individually toPOST /v0/orgs/{slug}/telemetrysocketsecurity/core/scm/github.pyis_commenter_authorized()— checks collaborator permission level (admin/write)post_eyes_reaction()— postseyesreaction to mark comments as processedpost_negative_reaction()— posts-1reaction for unauthorized usershandle_ignore_reactions()— only adds+1for authorized users,-1for unauthorizedsocketsecurity/core/scm/gitlab.pyis_commenter_authorized()— checks project member access level (Developer+)has_eyes_reaction()— best-effort check foreyesaward emoji on MR notespost_eyes_reaction()— best-effort addeyesaward emoji withContent-Type: application/jsonsocketsecurity/core/scm_comments.pyget_ignore_options()case-insensitive (fixes@socketSecurityvs@SocketSecurity)socketsecurity/socketcli.py_is_commenter_authorized()— checks user permissions with caching per user_is_unprocessed()— checks inlinereactions.eyes, falls back toscm.has_eyes_reaction(), then checks authorization_filter_authorized_ignore_comments()— filters ignore comments to authorized users only, applied before suppression and telemetry in both flowsalert_actionfrom alert's resolved policy flagsTests
tests/unit/test_client.py— 2 tests: individual event sending, continues on failuretests/unit/test_ignore_telemetry_filtering.py— 17 tests: eyes filtering, SCM fallback, commenter authorization (RBAC), authorized comment filtering, event payload shapeEvent attributes
{ "event_kind": "user-action", "client_action": "ignore", "alert_action": "error", "event_id": "<uuid>", "event_sender_created_at": "<iso8601>", "vcs_provider": "github|gitlab", "owner": "<repo_owner>", "repo": "<owner/repo>", "pr_number": 123, "ignore_all": true|false, "sender_name": "<comment_author_login>", "sender_id": "<comment_author_id>", "artifact_input": "<raw_user_text>" (comment flow), "artifact_purl": "<valid_purl>" (push flow) }Public Changelog
N/A