Skip to content

refactor(dpop): eliminate variable shadowing in Parse() HTU/HTM claim validation#4117

Merged
reinkrul merged 2 commits intofix/dpop-url-parse-nil-dereffrom
copilot/sub-pr-4112
Mar 25, 2026
Merged

refactor(dpop): eliminate variable shadowing in Parse() HTU/HTM claim validation#4117
reinkrul merged 2 commits intofix/dpop-url-parse-nil-dereffrom
copilot/sub-pr-4112

Conversation

Copy link
Contributor

Copilot AI commented Mar 25, 2026

In Parse(), the inner s variables used for HTU/HTM claim type assertions shadowed the function parameter s (raw token string), making the control flow harder to follow and risking accidental misuse.

Changes

  • crypto/dpop/dpop.go: Renamed shadowing locals shtu and htm in the HTU/HTM claim validation blocks; removed unused strings import

Before:

} else if s, ok := v.(string); !ok {   // shadows func param `s`
    ...
} else if s == "" {
    ...
} else if _, err := url.Parse(s); err != nil {

After:

} else if htu, ok := v.(string); !ok {
    ...
} else if htu == "" {
    ...
} else if _, err := url.Parse(htu); err != nil {

The return &DPoP{raw: s, ...} at the end of Parse() now unambiguously refers to the original token string parameter.


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI changed the title [WIP] [WIP] Address feedback on nil pointer dereference fix for invalid DPoP htu URL refactor(dpop): eliminate variable shadowing in Parse() HTU/HTM claim validation Mar 25, 2026
Copilot AI requested a review from reinkrul March 25, 2026 13:52
@reinkrul reinkrul marked this pull request as ready for review March 25, 2026 13:53
@reinkrul reinkrul merged commit 897a262 into fix/dpop-url-parse-nil-deref Mar 25, 2026
2 checks passed
@reinkrul reinkrul deleted the copilot/sub-pr-4112 branch March 25, 2026 13:53
@qltysh
Copy link

qltysh bot commented Mar 25, 2026

Qlty

Coverage Impact

Unable to calculate total coverage change because base branch coverage was not found.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
New file Coverage rating: B
crypto/dpop/dpop.go100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants