nebius/SWE-bench-extra huggingface dataset:
Repository: walles/px

Issue:
Asked to report last line: mosh
Hi,

thanks for the very useful program. I just got the following message when running `px <PID-OF-MY-SESSION>`:
```
Users logged in when cinnamon-session(2417) started:
WARNING: Please report unmatched last line at https://github.com/walles/px/issues/new: <norbert  pts/3        mosh [29846]     Wed Oct 24 15:33 - 15:34  (00:01)>
WARNING: Please report unmatched last line at https://github.com/walles/px/issues/new: <norbert  pts/1        mosh [14332]     Tue Sep 11 15:28 - 15:29  (00:01)>
  norbert from :0
```

This is on Debian/unstable, `px --version` returns `0.0.0`, and the Debian package version is `1.0.13-2`.

Comments:

Patch:
diff --git a/px/px_loginhistory.py b/px/px_loginhistory.py
index 57c3ff8..e03fa65 100644
--- a/px/px_loginhistory.py
+++ b/px/px_loginhistory.py
@@ -11,24 +11,26 @@ import dateutil.tz
 LAST_USERNAME = "([^ ]+)"
 LAST_DEVICE = "([^ ]+)"
 LAST_ADDRESS = "([^ ]+)?"
+LAST_PID = "( \[[0-9]+\])?"
 LAST_FROM = "(... ... .. ..:..)"
 LAST_DASH = " [- ] "
 LAST_TO = "[^(]*"
 LAST_DURATION = "([0-9+:]+)"
 
 LAST_RE = re.compile(
-  LAST_USERNAME +
-  " +" +
-  LAST_DEVICE +
-  " +" +
-  LAST_ADDRESS +
-  " +" +
-  LAST_FROM +
-  LAST_DASH +
-  LAST_TO +
-  " *(\(" +
-  LAST_DURATION +
-  "\))?"
+    LAST_USERNAME +
+    " +" +
+    LAST_DEVICE +
+    " +" +
+    LAST_ADDRESS +
+    LAST_PID +
+    " +" +
+    LAST_FROM +
+    LAST_DASH +
+    LAST_TO +
+    " *(\(" +
+    LAST_DURATION +
+    "\))?"
 )
 
 TIMEDELTA_RE = re.compile("(([0-9]+)\+)?([0-9][0-9]):([0-9][0-9])")
@@ -89,8 +91,8 @@ def get_users_at(timestamp, last_output=None, now=None):
 
         username = match.group(1)
         address = match.group(3)
-        from_s = match.group(4)
-        duration_s = match.group(6)
+        from_s = match.group(5)
+        duration_s = match.group(7)
 
         if address:
             username += " from " + address


Test patch:
diff --git a/tests/px_loginhistory_test.py b/tests/px_loginhistory_test.py
index 191e602..ffd5019 100644
--- a/tests/px_loginhistory_test.py
+++ b/tests/px_loginhistory_test.py
@@ -289,3 +289,14 @@ def test_to_timedelta(check_output):
     assert px_loginhistory._to_timedelta("01:29") == datetime.timedelta(0, hours=1, minutes=29)
     assert px_loginhistory._to_timedelta("4+01:29") == datetime.timedelta(4, hours=1, minutes=29)
     assert px_loginhistory._to_timedelta("34+01:29") == datetime.timedelta(34, hours=1, minutes=29)
+
+
+def test_realworld_debian(check_output):
+    """
+    Regression test for https://github.com/walles/px/issues/48
+    """
+    now = datetime.datetime(2016, 12, 6, 9, 21, tzinfo=dateutil.tz.tzlocal())
+    testtime = datetime.datetime(2016, 10, 24, 15, 34, tzinfo=dateutil.tz.tzlocal())
+    lastline = "norbert  pts/3        mosh [29846]     Wed Oct 24 15:33 - 15:34  (00:01)"
+
+    assert set(["norbert from mosh"]) == get_users_at(lastline, now, testtime)
Repository: wandera/1password-client

Issue:
Login fails: "Data must be aligned to block boundary in ECB mode"
Hi, logging into my 1password account fails with the ValueError message above:

`from onepassword import OnePassword
op = OnePassword()
1Password master password: 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/lib/python3.9/site-packages/onepassword/client.py", line 60, in __init__
    self.encrypted_master_password, self.session_key = self.signin_wrapper(master_password=password)
  File "/opt/homebrew/lib/python3.9/site-packages/onepassword/client.py", line 179, in signin_wrapper
    encrypted_str = encrypt.encode(password)
  File "/opt/homebrew/lib/python3.9/site-packages/onepassword/utils.py", line 173, in encode
    return base64.b64encode(self.cipher.encrypt(input_str.rjust(32)))
  File "/opt/homebrew/lib/python3.9/site-packages/Crypto/Cipher/_mode_ecb.py", line 141, in encrypt
    raise ValueError("Data must be aligned to block boundary in ECB mode")
ValueError: Data must be aligned to block boundary in ECB mode`

Python 3.9.2, op 1.8.0, 1password-client 0.3.0

Best regards, Jan

Comments:

Patch:
diff --git a/onepassword/utils.py b/onepassword/utils.py
index f37313d..733612b 100644
--- a/onepassword/utils.py
+++ b/onepassword/utils.py
@@ -1,6 +1,10 @@
 import os
 import base64
 from Crypto.Cipher import AES
+from Crypto.Util.Padding import pad
+
+
+BLOCK_SIZE = 32 # Bytes
 
 
 def read_bash_return(cmd, single=True):
@@ -128,14 +132,14 @@ class BashProfile:
 
 class Encryption:
     def __init__(self, secret_key):
-        self.secret_key = secret_key[0:32]
+        self.secret_key = secret_key[0:BLOCK_SIZE]
         self.cipher = AES.new(self.secret_key, AES.MODE_ECB)
 
     def decode(self, encoded):
-        return self.cipher.decrypt(base64.b64decode(encoded)).decode('UTF-8').replace(" ", "")
+        return self.cipher.decrypt(base64.b64decode(encoded)).decode('UTF-8').replace("\x1f", "")
 
     def encode(self, input_str):
-        return base64.b64encode(self.cipher.encrypt(input_str.rjust(32)))
+        return base64.b64encode(self.cipher.encrypt(pad(input_str, BLOCK_SIZE)))
 
 
 def bump_version():


Test patch:
diff --git a/test/test_client.py b/test/test_client.py
index f27454d..281d14f 100644
--- a/test/test_client.py
+++ b/test/test_client.py
@@ -12,7 +12,7 @@ def set_up_one_password():
     domain = "test"
     email = "user@test.com"
     secret = "test_secret"
-    password = "test_password"
+    password = "a234567890b234567890c234567890d234567890e23"
     account = "test"
     with open('.bash_profile', 'w') as f:
         f.write("OP_SESSION_test=fakelettersforsessionkey")
Repository: warpnet/salt-lint

Issue:
Some MAC addresses trigger rule 210
First of all, thank you for this tool!

**Describe the bug**

Some MAC addresses trigger rule 210.
This is the case then the two last characters are integers.

**To Reproduce**
```sls
valid: 00:e5:e5:aa:60:69
valid2: 09:41:a2:48:d1:6f
valid3: 4c:f2:d3:1b:2e:0d
invalid: 4c:f2:d3:1b:2e:05
```

**Expected behavior**
All of the above are valid (or all MAC addresses should be encapsulated).

```sh
pip3 show salt-lint
Name: salt-lint
Version: 0.4.2
```

Comments:

Patch:
diff --git a/saltlint/rules/YamlHasOctalValueRule.py b/saltlint/rules/YamlHasOctalValueRule.py
index 7633f9f..d39477c 100644
--- a/saltlint/rules/YamlHasOctalValueRule.py
+++ b/saltlint/rules/YamlHasOctalValueRule.py
@@ -15,7 +15,7 @@ class YamlHasOctalValueRule(Rule):
     tags = ['formatting']
     version_added = 'v0.0.6'
 
-    bracket_regex = re.compile(r"(?<=:)\s{0,}0[0-9]{1,}\s{0,}((?={#)|(?=#)|(?=$))")
+    bracket_regex = re.compile(r"^[^:]+:\s{0,}0[0-9]{1,}\s{0,}((?={#)|(?=#)|(?=$))")
 
     def match(self, file, line):
         return self.bracket_regex.search(line)


Test patch:
diff --git a/tests/unit/TestYamlHasOctalValueRule.py b/tests/unit/TestYamlHasOctalValueRule.py
index b756031..e03fc44 100644
--- a/tests/unit/TestYamlHasOctalValueRule.py
+++ b/tests/unit/TestYamlHasOctalValueRule.py
@@ -28,6 +28,12 @@ testdirectory02:
 apache_disable_default_site:
   apache_site.disabled:
     - name: 000-default
+
+# MAC addresses shouldn't be matched, for more information see:
+# https://github.com/warpnet/salt-lint/issues/202
+infoblox_remove_record:
+  infoblox_host_record.absent:
+    - mac: 4c:f2:d3:1b:2e:05
 '''
 
 BAD_NUMBER_STATE = '''
Repository: warpnet/salt-lint

Issue:
--exclude does not seem to work since 0.5.0
In my CI I have :
``` bash
find . -name "*.jinja" -o -name "*sls" | xargs --no-run-if-empty salt-lint -x 204,205 --exclude ./common_syslog-ng.sls
```
So I was not notified on lint errors for `common_syslog-ng.sls` file, but since 0.5.0 version I get errors from this file.
If I set image tag to `0.4.2`, normal behaviour is back.



Comments:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ff9c18..ba0a0f3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
 All notable changes in **salt-lint** are documented below.
 
 ## [Unreleased]
+### Fixed
+- Ensure all excluded paths from both the CLI and configuration are passed to the runner ([#231](https://github.com/warpnet/salt-lint/pull/231)).
+
 ## [0.5.0] (2021-01-17)
 ### Added
 - Rule 213 to recommend using cmd.run together with onchanges ([#207](https://github.com/warpnet/salt-lint/pull/207)).
diff --git a/saltlint/linter/runner.py b/saltlint/linter/runner.py
index 752d0e6..5f62e4a 100644
--- a/saltlint/linter/runner.py
+++ b/saltlint/linter/runner.py
@@ -38,7 +38,8 @@ class Runner(object):
             # These will be (potentially) relative paths
             paths = [path.strip() for path in exclude_paths]
             self.exclude_paths = paths + [os.path.abspath(path) for path in paths]
-        self.exclude_paths = []
+        else:
+            self.exclude_paths = []
 
     def is_excluded(self, file_path):
         # Any will short-circuit as soon as something returns True, but will


Test patch:
diff --git a/tests/unit/TestRunner.py b/tests/unit/TestRunner.py
index b1e8e02..0d0ceb2 100644
--- a/tests/unit/TestRunner.py
+++ b/tests/unit/TestRunner.py
@@ -4,6 +4,9 @@
 import unittest
 
 from saltlint.cli import run
+from saltlint.config import Configuration
+from saltlint.linter.runner import Runner
+
 
 class TestRunner(unittest.TestCase):
 
@@ -18,3 +21,16 @@ class TestRunner(unittest.TestCase):
         # expected.
         args = ['tests/test-extension-success.sls']
         self.assertEqual(run(args), 0)
+
+    def test_runner_exclude_paths(self):
+        """
+        Check if all the excluded paths from the configuration are passed to
+        the runner.
+        """
+        exclude_paths = ['first.sls', 'second.sls']
+        config = Configuration(dict(exclude_paths=exclude_paths))
+        runner = Runner([], 'init.sls', config)
+
+        self.assertTrue(
+            any(path in runner.exclude_paths for path in exclude_paths)
+        )