Skip to content

PoC for lightweight analysis for OpenAI#4802

Draft
bradlarsen wants to merge 11 commits intomainfrom
lightweight-analyze-poc
Draft

PoC for lightweight analysis for OpenAI#4802
bradlarsen wants to merge 11 commits intomainfrom
lightweight-analyze-poc

Conversation

@bradlarsen
Copy link
Contributor

@bradlarsen bradlarsen commented Mar 9, 2026

This draft PR is a PoC for what "lightweight analysis" could look like.


Note

Medium Risk
Changes token verification flows to always capture and store raw HTTP response bodies and additional metadata, which can affect detector behavior and may introduce sensitive-data/PII retention concerns.

Overview
Adds a new lightweight_analyze helper (CopyAndCloseResponseBody, AugmentExtraData) to persist verification HTTP responses into Result.ExtraData (under lwa.response) and to standardize optional lwa.* metadata fields.

Updates the openai, digitaloceanv2, and elevenlabs (v1/v2) detectors to use a logger-aware pkg/context context, unconditionally copy/close response bodies, and enrich ExtraData with parsed identity fields (id/name/email) when available; ElevenLabs now treats missing_permissions errors as verified but without user metadata.

Written by Cursor Bugbot for commit ba782dc. This will update automatically on new commits. Configure here.

@CLAassistant
Copy link

CLAassistant commented Mar 11, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ bradlarsen
✅ joeleonjr
❌ lukem-ts
You have signed the CLA already but the status is still pending? Let us recheck it.

- Make response data types non-exported types
- Use pointers in response data types to check if fields are missing
- Ensure that raw responses are stored to extraData
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

"created_at": time.Unix(int64(resData.Created), 0).Format(time.RFC3339),
}
// lightweight analyze: annotate "standard" fields
lwa.AugmentExtraData(extraData, lwa.Fields {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bradlarsen A few other fields that would be helpful during remediation:

orgs.data[].description (e.g. Personal org for user@domain)
orgs.data[].name (e.g. company-name-slug)
orgs.data[].title (e.g. CompanyName)

// lightweight analyze: annotate "standard" fields
lwa.AugmentExtraData(extraData, lwa.Fields {
ID: &resData.ID,
Name: &resData.Name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bradlarsen something to consider:

name here means FullName and is stored as lwa.name

Then there is first_name in the 11labs detector, which we are also storing as lwa.name.

If we find first_name and last_name do we just concatenate?

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.

4 participants