Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix user activation bypass in AI hooks - #68

Closed
galiprandi wants to merge 1 commit into
mainfrom
sentinel-ai-security-hardening-14060104763707794969
Closed

πŸ›‘οΈ Sentinel: [HIGH] Fix user activation bypass in AI hooks#68
galiprandi wants to merge 1 commit into
mainfrom
sentinel-ai-security-hardening-14060104763707794969

Conversation

@galiprandi

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
πŸ’‘ Vulnerability: The useAIPrompt and useAISummarize hooks had user activation checks commented out to allow for model "warmup". This allowed AI models to be initialized without explicit user consent, potentially enabling fingerprinting or unauthorized resource consumption. Additionally, these hooks lacked checks to ensure that the retrieved AI API global objects were not generic base constructors.

🎯 Impact: Malicious scripts could trigger expensive model downloads or use AI APIs for fingerprinting without any user interaction. Lack of constructor validation could lead to false positives or errors if global names matched plain objects.

πŸ”§ Fix:

  1. Re-enabled navigator.userActivation.isActive checks in useAIPrompt.ts and useAISummarize.ts.
  2. Added "fail-secure" checks to ensure the LanguageModel and Summarizer globals are not Object, Array, or Function.
  3. Updated useAIPrompt.test.ts and useAISummarize.test.ts to reflect the mandatory activation requirement.

βœ… Verification:

  • Ran pnpm test lib/hooks/useAIPrompt.test.ts (14/14 passed).
  • Ran pnpm test lib/hooks/useAISummarize.test.ts (22/22 passed).
  • Ran pnpm test lib/hooks/useAI.test.ts to ensure no regressions in centralized API detection (16/16 passed).

PR created automatically by Jules for task 14060104763707794969 started by @galiprandi

- Re-enable navigator.userActivation.isActive checks in useAIPrompt and useAISummarize to prevent background resource consumption and fingerprinting.
- Implement base constructor checks (Object, Array, Function) in AI initialization paths to prevent false positives from global object matching.
- Update test suites to stub user activation and verify enforcement.
@google-labs-jules

Copy link
Copy Markdown

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@galiprandi

Copy link
Copy Markdown
Owner Author

Closing as superseded by #72, which includes all these changes plus additional SSR-safe guards and LanguageDetector validation. Already merged into main.

@galiprandi galiprandi closed this May 29, 2026
@google-labs-jules

Copy link
Copy Markdown

Closing as superseded by #72, which includes all these changes plus additional SSR-safe guards and LanguageDetector validation. Already merged into main.

Understood. Acknowledging that this work is now obsolete and stopping work on this task.

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.

1 participant