Skip to content

fix(gc): redact redis_url_reg from GC extra attrs#23134

Merged
chlins merged 1 commit into
goharbor:mainfrom
chlins:fix/remove-redis-url-in-gc-history
Apr 17, 2026
Merged

fix(gc): redact redis_url_reg from GC extra attrs#23134
chlins merged 1 commit into
goharbor:mainfrom
chlins:fix/remove-redis-url-in-gc-history

Conversation

@chlins

@chlins chlins commented Apr 16, 2026

Copy link
Copy Markdown
Member

Thank you for contributing to Harbor!

Comprehensive Summary of your change

This pull request introduces a security improvement to how extra attributes are handled in the GC (Garbage Collection) API. The main change is the addition of a CleanExtraAttrs function, which removes sensitive information (specifically, the redis_url_reg field) from extra attributes before they are returned to the client. This ensures that sensitive data is not exposed through API responses.

Security and Data Sanitization Improvements:

  • Added a new function CleanExtraAttrs in model/gc.go to filter out sensitive fields (like redis_url_reg) from extra attributes before returning them to the client.
  • Updated all locations where extra attributes are marshaled for API responses (GetGCHistory, GetGC, and ToSwagger) to use CleanExtraAttrs, ensuring sensitive data is consistently removed. [1] [2] [3]

Issue being fixed

Fixes #(issue)

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

@codecov

codecov Bot commented Apr 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.02%. Comparing base (b8ddde3) to head (db14013).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/server/v2.0/handler/model/gc.go 0.00% 8 Missing ⚠️
src/server/v2.0/handler/gc.go 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #23134   +/-   ##
=======================================
  Coverage   66.01%   66.02%           
=======================================
  Files        1074     1074           
  Lines      116690   116697    +7     
  Branches     2941     2941           
=======================================
+ Hits        77037    77049   +12     
+ Misses      35383    35378    -5     
  Partials     4270     4270           
Flag Coverage Δ
unittests 66.02% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/server/v2.0/handler/gc.go 2.33% <0.00%> (ø)
src/server/v2.0/handler/model/gc.go 0.00% <0.00%> (ø)

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chlins
chlins force-pushed the fix/remove-redis-url-in-gc-history branch from bf77adc to db14013 Compare April 16, 2026 08:18

@wy65701436 wy65701436 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@chlins
chlins merged commit 62564cc into goharbor:main Apr 17, 2026
11 of 12 checks passed
chlins added a commit to chlins/harbor that referenced this pull request Apr 17, 2026
chlins added a commit that referenced this pull request Apr 20, 2026
…) (#23141)

fix(gc): redact redis_url_reg from GC extra attrs (#23134)

Signed-off-by: chlins <[email protected]>
bupd pushed a commit to container-registry/harbor-next that referenced this pull request May 19, 2026
bupd pushed a commit to container-registry/harbor-next that referenced this pull request May 19, 2026
bupd pushed a commit to container-registry/harbor-next that referenced this pull request May 19, 2026
bupd pushed a commit to container-registry/harbor-next that referenced this pull request Jun 9, 2026
Upstream-PR: goharbor/harbor#23134

Upstream-Author: @chlins
Signed-off-by: Prasanth Baskar <[email protected]>
(cherry picked from commit 2bb39fc)
Signed-off-by: Prasanth Baskar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

5 participants