nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: auth0/nextjs-auth0
Pull request #862 (2022-10-14 16:58:22)

Shouldn't serve routes for object builtins
### 📋 Changes

Noticed while testing that we're serving routes for js builtins (like `__proto__`)

`/api/auth/__proto__` should return 404 (currently returning 500)



Patch:
diff --git a/src/handlers/auth.ts b/src/handlers/auth.ts
index ec69d204..61c0d3c6 100644
--- a/src/handlers/auth.ts
+++ b/src/handlers/auth.ts
@@ -153,7 +153,7 @@ export default function handlerFactory({
       route = Array.isArray(route) ? route[0] : /* c8 ignore next */ route;
 
       try {
-        const handler = route && customHandlers[route];
+        const handler = route && customHandlers.hasOwnProperty(route) && customHandlers[route];
         if (handler) {
           await handler(req, res);
         } else {


Test patch:
diff --git a/tests/handlers/auth.test.ts b/tests/handlers/auth.test.ts
index c08bc81f..4b56d218 100644
--- a/tests/handlers/auth.test.ts
+++ b/tests/handlers/auth.test.ts
@@ -38,6 +38,12 @@ describe('auth handler', () => {
     global.handleAuth = initAuth0(withoutApi).handleAuth;
     await expect(get(baseUrl, '/api/auth/foo')).rejects.toThrow('Not Found');
   });
+
+  test('return 404 for unknown routes including builtin props', async () => {
+    const baseUrl = await setup(withoutApi);
+    global.handleAuth = initAuth0(withoutApi).handleAuth;
+    await expect(get(baseUrl, '/api/auth/__proto__')).rejects.toThrow('Not Found');
+  });
 });
 
 describe('custom error handler', () => {
Repository: auth0/nextjs-auth0
Pull request #1113 (2023-03-16 09:31:09)

Add AUTH0_LOGOUT env var
### 📋 Changes

Add the `AUTH0_LOGOUT` environment variable so you can configure `auth0Logout` for the named exports as well as own instance configuration of the SDK.

### 📎 References

See https://github.com/auth0/nextjs-auth0/pull/1104#issuecomment-1470496486



Patch:
diff --git a/src/config.ts b/src/config.ts
index 8e97584b..3c0bf790 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -25,7 +25,9 @@ export interface BaseConfig {
 
   /**
    * Boolean value to enable Auth0's proprietary logout feature.
-   * Since this SDK is for Auth0, it's set to `true`by default.
+   * Since this SDK is for Auth0, it's set to `true` by default.
+   * Set it to `false` if you don't want to use https://auth0.com/docs/api/authentication#logout.
+   * You can also use the `AUTH0_LOGOUT` environment variable.
    */
   auth0Logout?: boolean;
 
@@ -480,6 +482,7 @@ export const getConfig = (params: ConfigParameters = {}): { baseConfig: BaseConf
   const AUTH0_HTTP_TIMEOUT = process.env.AUTH0_HTTP_TIMEOUT;
   const AUTH0_ENABLE_TELEMETRY = process.env.AUTH0_ENABLE_TELEMETRY;
   const AUTH0_IDP_LOGOUT = process.env.AUTH0_IDP_LOGOUT;
+  const AUTH0_LOGOUT = process.env.AUTH0_LOGOUT;
   const AUTH0_ID_TOKEN_SIGNING_ALG = process.env.AUTH0_ID_TOKEN_SIGNING_ALG;
   const AUTH0_LEGACY_SAME_SITE_COOKIE = process.env.AUTH0_LEGACY_SAME_SITE_COOKIE;
   const AUTH0_IDENTITY_CLAIM_FILTER = process.env.AUTH0_IDENTITY_CLAIM_FILTER;
@@ -517,7 +520,7 @@ export const getConfig = (params: ConfigParameters = {}): { baseConfig: BaseConf
     httpTimeout: num(AUTH0_HTTP_TIMEOUT),
     enableTelemetry: bool(AUTH0_ENABLE_TELEMETRY),
     idpLogout: bool(AUTH0_IDP_LOGOUT, true),
-    auth0Logout: bool(AUTH0_IDP_LOGOUT, true),
+    auth0Logout: bool(AUTH0_LOGOUT, true),
     idTokenSigningAlg: AUTH0_ID_TOKEN_SIGNING_ALG,
     legacySameSiteCookie: bool(AUTH0_LEGACY_SAME_SITE_COOKIE),
     identityClaimFilter: array(AUTH0_IDENTITY_CLAIM_FILTER),


Test patch:
diff --git a/tests/config.test.ts b/tests/config.test.ts
index 55781df5..bab1c4a4 100644
--- a/tests/config.test.ts
+++ b/tests/config.test.ts
@@ -110,6 +110,7 @@ describe('config params', () => {
         AUTH0_ENABLE_TELEMETRY: 'off',
         AUTH0_LEGACY_SAME_SITE_COOKIE: '0',
         AUTH0_IDP_LOGOUT: 'no',
+        AUTH0_LOGOUT: 'false',
         AUTH0_COOKIE_TRANSIENT: true,
         AUTH0_COOKIE_HTTP_ONLY: 'on',
         AUTH0_COOKIE_SAME_SITE: 'lax',
Repository: jshint/jshint
Pull request #1784 (2014-07-27 11:15:34)

[[Fix]] Allow W117 and undef to be toggled per line.
This patch allows JSHint to apply `-W117` and `undef:false` to a local part within the file.

Use-case: I have code where some variables are only defined if some conditional is true. I don't want to put `/* globals name_of_variable */` in the file, because it could result in unknowingly using the variable when it does not exist. Therefore I need an option to toggle the error for a specific section.

(edit: `unused` -> `undef`)


Patch:
diff --git a/src/jshint.js b/src/jshint.js
index 471fa142..dec6cb77 100644
--- a/src/jshint.js
+++ b/src/jshint.js
@@ -494,7 +494,9 @@ var JSHINT = (function () {
   }
 
   function isundef(scope, code, token, a) {
-    return JSHINT.undefs.push([scope, code, token, a]);
+    if (!state.ignored[code] && state.option.undef !== false) {
+      JSHINT.undefs.push([scope, code, token, a]);
+    }
   }
 
   function removeIgnoredMessages() {


Test patch:
diff --git a/tests/unit/fixtures/ignore-w117.js b/tests/unit/fixtures/ignore-w117.js
new file mode 100644
index 00000000..ce6c0b8d
--- /dev/null
+++ b/tests/unit/fixtures/ignore-w117.js
@@ -0,0 +1,16 @@
+function testUndeclaredGlobalSuppressWarningUsingW117() {
+  //jshint -W117
+  c();
+  //jshint +W117
+  c();
+}
+function testUndeclaredGlobalSuppressWarningUsingUndef() {
+  //jshint undef:false
+  c();
+  //jshint undef:true
+  c();
+}
+
+function testUndeclaredGlobal() {
+  c();
+}
diff --git a/tests/unit/options.js b/tests/unit/options.js
index bec3692e..392492be 100644
--- a/tests/unit/options.js
+++ b/tests/unit/options.js
@@ -1596,6 +1596,21 @@ exports.unignored = function (test) {
   test.done();
 };
 
+/*
+ * Tests that the W117 and undef can be toggled per line.
+ */
+exports['per-line undef / -W117'] = function (test) {
+  var src = fs.readFileSync(__dirname + "/fixtures/ignore-w117.js", "utf-8");
+
+  TestRun(test)
+    .addError(5, "'c' is not defined.")
+    .addError(11, "'c' is not defined.")
+    .addError(15, "'c' is not defined.")
+    .test(src, { undef:true });
+
+  test.done();
+};
+
 /*
 * Tests the `freeze` option -- Warn if native object prototype is assigned to.
 */
Repository: auth0/node-auth0
Pull request #160 (2017-02-08 13:31:56)

Add connection options to passwordless (#159)
Made it optional to pass in a connection string to passwordless ('sms' or 'email'). #159 


Patch:
diff --git a/src/auth/PasswordlessAuthenticator.js b/src/auth/PasswordlessAuthenticator.js
index 260867176..5759b7685 100644
--- a/src/auth/PasswordlessAuthenticator.js
+++ b/src/auth/PasswordlessAuthenticator.js
@@ -74,6 +74,7 @@ var PasswordlessAuthenticator = function (options, oauth) {
  * @param   {Object}    userData              User credentials object.
  * @param   {String}    userData.username     Username.
  * @param   {String}    userData.password     Password.
+ * @param   {String}    [userData.connection=sms]  Connection string: "sms" or "email".
  * @param   {String}    [userData.client_id]  Client ID.
  * @param   {Function}  [cb]                  Method callback.
  *
@@ -86,7 +87,7 @@ PasswordlessAuthenticator.prototype.signIn = function (userData, cb) {
   var data = extend(defaultFields, userData);
 
   // Don't let the user override the connection nor the grant type.
-  data.connection = 'sms';
+  if (!data.connection || (data.connection !== 'email' && data.connection !== 'sms')) { data.connection = 'sms'; }
   data.grant_type = 'password';
 
   if (!userData || typeof userData !== 'object') {


Test patch:
diff --git a/test/auth/passwordless.tests.js b/test/auth/passwordless.tests.js
index 4b69b0574..a8aeb3c2e 100644
--- a/test/auth/passwordless.tests.js
+++ b/test/auth/passwordless.tests.js
@@ -200,13 +200,35 @@ describe('PasswordlessAuthenticator', function () {
     });
 
 
-    it('shouldn\'t allow the user to specify the connection', function (done) {
+    it('should use email connection', function (done) {
+      nock.cleanAll();
+      var data = extend({ connection: 'email' }, userData);
+      var request = nock(API_URL)
+        .post(path, function (body) {
+          return body.connection === 'email';
+        })
+        .reply(200);
+
+      this
+        .authenticator
+        .signIn(data)
+        .then(function () {
+          expect(request.isDone())
+            .to.be.true;
+
+          done();
+        })
+        .catch(done);
+    });
+
+
+    it('should allow the user to specify the connection as sms or email', function (done) {
       nock.cleanAll();
 
       var data = extend({ connection: 'TEST_CONNECTION' }, userData);
       var request = nock(API_URL)
         .post(path, function (body) {
-          return body.connection === 'sms';
+          return body.connection === 'sms' || body.connection === 'email';
         })
         .reply(200);