Skip to content

Commit d9e43d8

Browse files
authored
Merge pull request #426 from blacklanternsecurity/dev
1.2.1 Release
2 parents e3b5252 + f5b67ea commit d9e43d8

6 files changed

Lines changed: 122 additions & 116 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,8 @@ jobs:
9292
CURRENT_VERSION="${CURRENT_VERSION#v}"
9393
LATEST_VERSION="${LATEST_VERSION#v}"
9494
95-
# Extract major.minor for comparison
96-
CURRENT_MAJOR_MINOR=$(echo "$CURRENT_VERSION" | cut -d '.' -f 1-2)
97-
LATEST_MAJOR_MINOR=$(echo "$LATEST_VERSION" | cut -d '.' -f 1-2)
98-
99-
# Compare versions
100-
if [ "$CURRENT_MAJOR_MINOR" == "$LATEST_MAJOR_MINOR" ]; then
95+
# Compare full versions so patch-level bumps (e.g. 1.2.0 -> 1.2.1) also publish
96+
if [ "$CURRENT_VERSION" == "$LATEST_VERSION" ]; then
10197
echo "VERSION_CHANGE=false" >> $GITHUB_ENV
10298
else
10399
echo "VERSION_CHANGE=true" >> $GITHUB_ENV
@@ -117,7 +113,7 @@ jobs:
117113
with:
118114
password: ${{ secrets.PYPI_API_TOKEN }}
119115

120-
- name: Tag the release if major or minor version changed
116+
- name: Tag the release if version changed
121117
if: github.ref == 'refs/heads/main' && env.VERSION_CHANGE == 'true'
122118
run: |
123119
git config user.name "github-actions[bot]"

badsecrets/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.2.0"
1+
__version__ = "1.2.1"

badsecrets/modules/passive/django_signedcookies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class DjangoSignedCookies(BadsecretsBase):
7-
identify_regex = re.compile(r"^[\.a-zA-Z_\-0-9]+:[\.a-zA-Z_\-0-9:]+$")
7+
identify_regex = re.compile(r"^\.?[a-zA-Z0-9_-]+(?::[a-zA-Z0-9_-]{4,8})?:[a-zA-Z0-9_-]{27,}$")
88
description = {"product": "Django Signed Cookie", "secret": "Django secret_key", "severity": "HIGH"}
99
carve_locations = ("cookies",)
1010

tests/carve_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,9 @@ def test_carve_cookies_identifyonly_laravel():
445445

446446

447447
def test_carve_cookies_identifyonly_django():
448-
# Django session cookie format: encoded:signature1:signature2 — matches
449-
# ^[\.a-zA-z-0-9]+:[\.a-zA-z-0-9:]+$ but uses a key that isn't in the wordlist.
448+
# Django session cookie format: payload:timestamp:signature — matches
449+
# identify_regex (signature is a 27+ char base64url HMAC) but uses a key
450+
# that isn't in the wordlist.
450451
_identify_only_fallback(
451452
Django_SignedCookies,
452453
"sessionid",

tests/django_signedcookies_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@ def test_django_negative():
2424
".eJxVjLsOAiEURP-F2hAuL8HSfr-BAPciq4ZNlt3K-O9KsoU2U8w5My8W4r7VsHdaw4zswoCdfrsU84PaAHiP7bbwvLRtnRMfCj9o59OC9Lwe7t9Bjb2OtbMkAEGQtQjekykmJy9JZIW-6CgUaCGsA6eSyV65s1Qya_xGKZrY-wPVYjdw:1ojOrE:bfOktjgLlUykwCBADSECRETSMM3-UypscEN57ECtXis"
2525
)
2626
assert not found_key
27+
28+
29+
def test_django_identify_false_positives():
30+
x = DjangoSignedCookies()
31+
assert not x.identify("abc:def")
32+
assert not x.identify("a:b")
33+
assert not x.identify("0000Qs-hTQlwlgXAYBlmgEFoQTR:1ffkg4vkm")
34+
assert not x.identify("test:1234")
35+
assert not x.identify("JSESSIONID:abcdef1234")

0 commit comments

Comments
 (0)