Skip to content

Commit 51ac76c

Browse files
authored
Rubygems API Key & logging (#823)
* rubygems * warnings in deep scanners * pylint cfg * lazy logging * pylin-fix * error->warning * step-security/harden-runner@fa2e9d6 # v2.16.0 - 2026.03.16 * fix ci warning * Update PyPI publish action to version 1.13.0 * Update dependency-review-action to version 4.9.0 * Update cryptography package version to 46.0.6
1 parent 90c012f commit 51ac76c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+301
-144
lines changed

.github/workflows/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222

2323
- name: Harden Runner
24-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
24+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
2525
with:
2626
egress-policy: audit
2727

.github/workflows/benchmark.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424

2525
- name: Harden Runner
26-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
26+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
2727
with:
2828
egress-policy: audit
2929

@@ -79,7 +79,7 @@ jobs:
7979
steps:
8080

8181
- name: Harden Runner
82-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
82+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
8383
with:
8484
egress-policy: audit
8585

@@ -182,7 +182,7 @@ jobs:
182182
steps:
183183

184184
- name: Harden Runner
185-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
185+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
186186
with:
187187
egress-policy: audit
188188

@@ -370,7 +370,7 @@ jobs:
370370
steps:
371371

372372
- name: Harden Runner
373-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
373+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
374374
with:
375375
egress-policy: audit
376376

@@ -463,10 +463,10 @@ jobs:
463463

464464
run_doc_benchmark:
465465
runs-on: ubuntu-latest
466-
if: ${{ 'push' == github.event_name }} or ${{ 'Samsung/CredSweeper' == github.event.pull_request.head.repo.full_name }}
466+
if: ${{ 'push' == github.event_name || 'Samsung/CredSweeper' == github.event.pull_request.head.repo.full_name }}
467467
steps:
468468
- name: Harden Runner
469-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
469+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
470470
with:
471471
egress-policy: audit
472472

.github/workflows/check.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
# # # MUST be full history to check git workflow
2323

2424
- name: Harden Runner
25-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
25+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
2626
with:
2727
egress-policy: audit
2828

@@ -93,7 +93,7 @@ jobs:
9393
run: |
9494
banner="$(python -m credsweeper --banner | grep CredSweeper | head -1)"
9595
echo "banner = '${banner}'"
96-
if [ "CredSweeper 1.15.1 crc32:58b9cbea" != "${banner}" ]; then
96+
if [ "CredSweeper 1.15.2 crc32:cba20e43" != "${banner}" ]; then
9797
echo "Update the check for '${banner}'"
9898
exit 1
9999
fi
@@ -217,4 +217,4 @@ jobs:
217217

218218
- name: Dependency Review
219219
if: ${{ 'push' != github.event_name }}
220-
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2 - 2025.11.11
220+
uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.9.0 - 2026.03.04

.github/workflows/fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323

2424
- name: Harden Runner
25-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
25+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
2626
with:
2727
egress-policy: audit
2828

.github/workflows/pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Harden Runner
22-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
22+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
2323
with:
2424
egress-policy: audit
2525

@@ -45,7 +45,7 @@ jobs:
4545
4646
- name: Publish
4747
if: ${{ 'release' == github.event_name }}
48-
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3
48+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 - 2025.09.04
4949
with:
5050
user: __token__
5151
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/rottenness.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525

2626
- name: Harden Runner
27-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
27+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
2828
with:
2929
egress-policy: audit
3030

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
steps:
3131

3232
- name: Harden Runner
33-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
33+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
3434
with:
3535
egress-policy: audit
3636

@@ -102,7 +102,7 @@ jobs:
102102
steps:
103103

104104
- name: Harden Runner
105-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 - 2026.02.08
105+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 - 2026.03.16
106106
with:
107107
egress-policy: audit
108108

.pylintrc

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
[FORMAT]
22
max-line-length=120
3-
3+
max-statements=105
44
extension-pkg-allow-list=lxml
55

66
[MESSAGES CONTROL]
7-
disable=R,W0718,W1203,C0415,C0413,C0103,C0114
7+
disable=C0103,C0114,C0413,R0401,R1705,R1714,R1731,R1730,W0718
8+
9+
[DESIGN]
10+
min-public-methods=0
11+
max-public-methods=26
12+
max-returns=8
13+
max-locals=29
14+
max-branches=52
15+
max-positional-arguments=27
16+
max-args=27
17+
max-attributes=25
18+
max-nested-blocks=6
19+
max-bool-expr=9
20+
max-parents=27
21+
22+
[SIMILARITIES]
23+
min-similarity-lines=7
24+
ignore-comments=yes
25+
ignore-imports=yes

credsweeper/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
"__version__"
2525
]
2626

27-
__version__ = "1.15.1"
27+
__version__ = "1.15.2"

credsweeper/app.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def run(self, content_provider: AbstractProvider) -> int:
223223
_empty_list: Sequence[ContentProvider] = []
224224
file_extractors = content_provider.get_scannable_files(self.config) if content_provider else _empty_list
225225
if not file_extractors:
226-
logger.info(f"No scannable targets for {len(content_provider.paths)} paths")
226+
logger.info("No scannable targets for %s paths", len(content_provider.paths))
227227
return 0
228228
self.scan(file_extractors)
229229
self.post_processing()
@@ -250,7 +250,7 @@ def scan(self, content_providers: Sequence[ContentProvider]) -> None:
250250

251251
def __single_job_scan(self, content_providers: Sequence[ContentProvider]) -> None:
252252
"""Performs scan in main thread"""
253-
logger.info(f"Scan for {len(content_providers)} providers")
253+
logger.info("Scan for %s providers", len(content_providers))
254254
all_cred = self.files_scan(content_providers)
255255
self.credential_manager.set_credentials(all_cred)
256256

@@ -267,7 +267,7 @@ def __multi_jobs_scan(self, content_providers: Sequence[ContentProvider]) -> Non
267267
logging.addLevelName(60, "SILENCE")
268268
log_kwargs["level"] = self.__log_level
269269
pool_count = min(self.pool_count, len(content_providers))
270-
logger.info(f"Scan in {pool_count} processes for {len(content_providers)} providers")
270+
logger.info("Scan in %s processes for %s providers", pool_count, len(content_providers))
271271
with multiprocessing.get_context("spawn").Pool(processes=pool_count,
272272
initializer=CredSweeper.pool_initializer,
273273
initargs=(log_kwargs,)) as pool: # yapf: disable
@@ -293,7 +293,7 @@ def files_scan(self, content_providers: Sequence[ContentProvider]) -> List[Candi
293293
if self.__thrifty:
294294
provider.free()
295295
all_cred.extend(candidates)
296-
logger.info(f"Completed: processed {len(content_providers)} providers with {len(all_cred)} candidates")
296+
logger.info("Completed: processed %s providers with %s candidates", len(content_providers), len(all_cred))
297297
return all_cred
298298

299299
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -335,9 +335,9 @@ def file_scan(self, content_provider: ContentProvider) -> List[Candidate]:
335335
def post_processing(self) -> None:
336336
"""Machine learning validation for received credential candidates."""
337337
if purged := self.credential_manager.purge_duplicates():
338-
logger.info(f"Purged {purged} duplicates")
338+
logger.info("Purged %s duplicates", purged)
339339
if self._use_ml_validation():
340-
logger.info(f"Grouping {len(self.credential_manager.candidates)} candidates")
340+
logger.info("Grouping %s candidates", len(self.credential_manager.candidates))
341341
new_cred_list: List[Candidate] = []
342342
cred_groups = self.credential_manager.group_credentials()
343343
ml_cred_groups: List[Tuple[CandidateKey, List[Candidate]]] = []
@@ -353,7 +353,7 @@ def post_processing(self) -> None:
353353

354354
# prevent extra ml_validator creation if ml_cred_groups is empty
355355
if ml_cred_groups:
356-
logger.info(f"Run ML Validation for {len(ml_cred_groups)} groups")
356+
logger.info("Run ML Validation for %s groups", len(ml_cred_groups))
357357
is_cred, probability = self.ml_validator.validate_groups(ml_cred_groups, self.ml_batch_size)
358358
for i, (_, group_candidates) in enumerate(ml_cred_groups):
359359
for candidate in group_candidates:
@@ -380,7 +380,7 @@ def export_results(self, change_type: Optional[DiffRowType] = None) -> None:
380380

381381
credentials = self.credential_manager.get_credentials()
382382

383-
logger.info(f"Exporting {len(credentials)} credentials")
383+
logger.info("Exporting %s credentials", len(credentials))
384384

385385
if self.sort_output:
386386
credentials.sort(key=lambda x: ( #

0 commit comments

Comments
 (0)