PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: getmoto/moto (python)

Issue:
Feature idea: assert Eventbridge/events Detail field is a dict
This one trips me up the entire time

Eventbridge/events Detail field is required by AWS to be a JSON object (Python dict)

I accidentally send it JSON lists all the time

Production Eventbridge just silently ignores them, leading to mucho head scratching and frustration

Moto events seems to silently allow list sending also

It would be great if moto events could raise a warning/exception on encountering a Detail in list form!

Just a thought

Pull request:
Events: put_events() now throws a warning when Detail field is not a dict
Fixes #6874 

Patch:
diff --git a/moto/events/models.py b/moto/events/models.py
index 5ec5a318c..d8d0cc229 100644
--- a/moto/events/models.py
+++ b/moto/events/models.py
@@ -1327,7 +1327,11 @@ class EventsBackend(BaseBackend):
                 )
             else:
                 try:
-                    json.loads(event["Detail"])
+                    detail = json.loads(event["Detail"])
+                    if not isinstance(detail, dict):
+                        warnings.warn(
+                            f"EventDetail should be of type dict - types such as {type(detail)} are ignored by AWS"
+                        )
                 except ValueError:  # json.JSONDecodeError exists since Python 3.5
                     entries.append(
                         {


Test patch:
diff --git a/tests/test_events/test_events.py b/tests/test_events/test_events.py
index baf35da3a..0c8f6c667 100644
--- a/tests/test_events/test_events.py
+++ b/tests/test_events/test_events.py
@@ -1,13 +1,14 @@
 import json
 import random
 import unittest
+import warnings
 from datetime import datetime, timezone
 
 import boto3
 import pytest
 from botocore.exceptions import ClientError
 
-from moto import mock_logs
+from moto import mock_logs, settings
 from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
 from moto.core.utils import iso_8601_datetime_without_milliseconds
 from moto.events import mock_events
@@ -682,6 +683,12 @@ def test_put_events():
     assert response["FailedEntryCount"] == 0
     assert len(response["Entries"]) == 1
 
+    if settings.TEST_DECORATOR_MODE:
+        event["Detail"] = json.dumps([{"Key": "k", "Value": "v"}])
+        with warnings.catch_warnings(record=True) as w:
+            client.put_events(Entries=[event])
+        assert "EventDetail should be of type dict" in str(w[0].message)
+
 
 @mock_events
 def test_put_events_error_too_many_entries():
Repository: manusa/electronim (js)

Issue:
Tweetdeck opens the web page on pressing Login button
When trying to add the Tweetdeck, the multi-account Twitter client service[1], when you press the "Login" button, the web page opens in a new tab in your default browser and the tab in Electronim stays in the same page.

Tested both with Sandbox and without.

[1] https://tweetdeck.twitter.com/

Pull request:
🐞: Fix login to Tweet Deck is now possible
Fixes #49 

Patch:
diff --git a/src/tab-manager/redirect.js b/src/tab-manager/redirect.js
index 46e045c..0ae5a0e 100644
--- a/src/tab-manager/redirect.js
+++ b/src/tab-manager/redirect.js
@@ -30,7 +30,8 @@ const isOAuth = matchUrls([
   /^https:\/\/login\.microsoftonline\.com\/.*/, // NOSONAR
   /^https:\/\/.+\.skype\.com\/login\/.*/, // NOSONAR
   /^https:\/\/.+\.skype\.com\/Auth\/.*/, // NOSONAR
-  /^https:\/\/idbroker\.webex\.com\/idb\/oauth2\/.*/ // NOSONAR
+  /^https:\/\/idbroker\.webex\.com\/idb\/oauth2\/.*/, // NOSONAR
+  /^https:\/\/.+\.twitter\.com\/login.*/ // NOSONAR
 ]);
 
 const isSameOrigin = (browserViewUrl, url) => url.origin === browserViewUrl.origin;


Test patch:
diff --git a/src/tab-manager/__tests__/redirect.test.js b/src/tab-manager/__tests__/redirect.test.js
index d5d7de5..983a264 100644
--- a/src/tab-manager/__tests__/redirect.test.js
+++ b/src/tab-manager/__tests__/redirect.test.js
@@ -122,5 +122,23 @@ describe('Tab Manager Redirect module test suite', () => {
         expect(result).toBe(false);
       });
     });
+    describe('Twitter login', () => {
+      test('From Tweet Deck to Twitter, should return false', () => {
+        // Given
+        mockBrowserViewUrl = 'https://tweetdeck.twitter.com';
+        // When
+        const result = redirect.shouldOpenInExternalBrowser(mockBrowserView, new URL('https://mobile.twitter.com/login?hide_message=true&redirect_after_login=https%3A%2F%2Ftweetdeck.twitter.com%2F%3Fvia_twitter_login%3Dtrue'));
+        // Then
+        expect(result).toBe(false);
+      });
+      test('From Twitter to Tweet Deck , should return false', () => {
+        // Given
+        mockBrowserViewUrl = 'https://mobile.twitter.com/login';
+        // When
+        const result = redirect.shouldOpenInExternalBrowser(mockBrowserView, new URL('https://tweetdeck.twitter.com?via_twitter_login=true'));
+        // Then
+        expect(result).toBe(false);
+      });
+    });
   });
 });