Fix panic/error raised by deleted passwords. (#71) base
authorShane Jaroch <chown_tee@proton.me>
Thu, 20 Mar 2025 18:58:40 +0000 (14:58 -0400)
committerGitHub <noreply@github.com>
Thu, 20 Mar 2025 18:58:40 +0000 (19:58 +0100)
* Fix panic/error raised by deleted passwords.

consider the following row entry,

```json
{"id": 513, "guid": "{6a83e72d-8255-4bc0-ad1a-c292613fb55b}", "timePasswordChanged": 1740354999123, "syncCounter": 0, "everSynced": true, "deleted": true}
```

which leads to:

```text
Traceback (most recent call last):
  File "ffpass", line 8, in <module>
    sys.exit(main())
  File "ffpass/__init__.py", line 419, in main
    args.func(args)
  File "ffpass/__init__.py", line 322, in main_export
    logins = exportLogins(key, jsonLogins)
  File "ffpass/__init__.py", line 212, in exportLogins
    encUsername = row["encryptedUsername"]
KeyError: 'encryptedUsername'
```

NOTE: line numbers from a `pip install ffpass`, version: `ffpass-0.5.0`

* update workflow to use `upload-artifact@v4`

also:

- actions/checkout@v4
- actions/setup-python@v5

* update EnricoMi/publish-unit-test-result-action@v2

---------

Co-authored-by: Louis Abraham <louisabraham@users.noreply.github.com>
.github/workflows/testing.yaml
ffpass/__init__.py

index acf5e5fde9cf5ea9212fd00b97a0ceea1655c376..24ddd974ffd828f6dfc07ecc43cb5b338ffde1ad 100644 (file)
@@ -7,36 +7,37 @@ jobs:
     name: Test
     runs-on: ubuntu-latest
     steps:
-      - name: Checkout
-        uses: actions/checkout@v4
+    - name: Checkout
+      uses: actions/checkout@v4
+
+    - name: Set up Python
+      uses: actions/setup-python@v5
+      with:
+        python-version: '3.x'
+
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install .
+
+    - name: Test with pytest
+      run: |
+        pip install pytest
+        pip install pytest-cov
+        python -m pytest tests --junit-xml pytest.xml
+
+    - name: Lint with flake8
+      run: |
+        pip install flake8
+        flake8 --ignore=E741,E501 .
+
+    - name: Upload Unit Test Results
+      if: always()
+      uses: actions/upload-artifact@v4
+      with:
+        name: Unit Test Results
+        path: pytest.xml
 
-      - name: Set up Python
-        uses: actions/setup-python@v5
-        with:
-          python-version: "3.x"
-
-      - name: Install dependencies
-        run: |
-          python -m pip install --upgrade pip
-          pip install .
-
-      - name: Test with pytest
-        run: |
-          pip install pytest
-          pip install pytest-cov
-          python -m pytest tests --junit-xml pytest.xml
-
-      - name: Lint with flake8
-        run: |
-          pip install flake8
-          flake8 --ignore=E741,E501 .
-
-      - name: Upload Unit Test Results
-        if: always()
-        uses: actions/upload-artifact@v4
-        with:
-          name: Unit Test Results
-          path: pytest.xml
 
   publish-test-results:
     name: "Publish Unit Tests Results"
index 49a3d62ae33c88ce038de3e0bb24311e2448b13f..56262cbe8b268fcbfd9e4b767ed7c85671f91f75 100644 (file)
@@ -214,6 +214,8 @@ def exportLogins(key, jsonLogins):
         return []
     logins = []
     for row in jsonLogins["logins"]:
+        if row.get("deleted"):
+            continue
         encUsername = row["encryptedUsername"]
         encPassword = row["encryptedPassword"]
         logins.append(