8000 Upgrade dependencies by Danielius1922 · Pull Request #606 · plgd-dev/go-coap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Upgrade dependencies #606

New issue

Have a question about this project? Sign up for a free GitHub account to open an iss 8000 ue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Danielius1922
Copy link
Member
@Danielius1922 Danielius1922 commented May 8, 2025

Direct:
github.com/pion/dtls/v3 v3.0.6
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e golang.org/x/net v0.35.0
golang.org/x/sync v0.11.0

Indirect:

github.com/pion/logging v0.2.3
golang.org/x/crypto v0.33.0
golang.org/x/sys v0.30.0

Summary by CodeRabbit

  • Chores
    • Updated linting workflow and configuration to use newer tools and modernized settings.
    • Upgraded several dependencies to newer versions for improved compatibility and stability.
  • Refactor
    • Cleaned up code by removing unused variables, simplifying struct definitions, and improving variable naming consistency in example files.
    • Adjusted function signatures and parameter usage for clarity and to avoid unused variables.
    • Improved import organization and code formatting in various example files.

Copy link
coderabbitai bot commented May 8, 2025

Walkthrough

This update modernizes the project’s linting and dependency management. The GitHub Actions workflow for golangci-lint is upgraded to v8, and the .golangci.yml configuration is restructured to version 2 format. Several Go module dependencies are updated, and minor code cleanups are applied across example files for clarity and consistency.

Changes

File(s) Change Summary
.github/workflows/golangci-lint.yml Upgraded golangci-lint GitHub Action from v6 to v8.
.golangci.yml Restructured configuration to version 2, reorganized keys, updated exclusions, enabled formatters, and modernized settings.
go.mod Updated multiple dependencies to newer versions; added replace directives for Go 1.20 compatibility.
examples/dtls/cid/server/main.go Removed atomic import and closed field from struct; ignored unused parameter in callback.
examples/dtls/pki/cert_util.go Removed redundant nil assignment before returning error in certificate pool loading.
examples/mcast/client/main.go Replaced unused variables with _ in callbacks; minor comment formatting adjustments.
examples/mcast/server/main.go Changed error variable assignment to avoid redeclaration inside loop.
examples/options/server/main.go Consolidated import, renamed clientId to clientID for consistency.
examples/simple/server/main.go Updated function signature to ignore unused request parameter.
pkg/cache/cache.go Replaced direct embedded field method calls with receiver method calls.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub Actions
    participant golangci-lint
    Developer ->> GitHub Actions: Push code / PR
    GitHub Actions ->> golangci-lint (v8): Run lint checks with new config
    golangci-lint -->> GitHub Actions: Report results
    GitHub Actions -->> Developer: Display lint results
Loading

Possibly related PRs

  • plgd-dev/go-coap#559: Updates golangci-lint workflow and configuration, similar to this PR’s linting modernization.
  • plgd-dev/go-coap#562: Upgrades Go module dependencies, overlapping with this PR’s dependency updates.
  • plgd-dev/go-coap#580: Updates golang.org/x/exp and golang.org/x/net dependencies, directly related to this PR’s module changes.

Poem

A rabbit hops through fields of code,
Tidying imports, lightening the load.
Linters refreshed, dependencies new,
Old warnings vanish, the sky turns blue.
With every hop, the project’s bright—
Clean and modern, running right!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov-commenter
Copy link
codecov-commenter commented May 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.26%. Comparing base (71407da) to head (58e5579).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #606      +/-   ##
==========================================
- Coverage   73.31%   73.26%   -0.06%     
==========================================
  Files          73       73              
  Lines        6986     6986              
==========================================
- Hits         5122     5118       -4     
- Misses       1482     1485       +3     
- Partials      382      383       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Danielius1922 Danielius1922 force-pushed the adam/feature/update-deps branch from 547f256 to 7a3dfa0 Compare May 8, 2025 18:08
Direct:
github.com/pion/dtls/v3 v3.0.6
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e
golang.org/x/net v0.35.0
golang.org/x/sync v0.11.0

Indirect:

github.com/pion/logging v0.2.3
golang.org/x/crypto v0.33.0
golang.org/x/sys v0.30.0
@Danielius1922 Danielius1922 force-pushed the adam/feature/update-deps branch from 7a3dfa0 to 58e5579 Compare May 17, 2025 19:26
Copy link

@Danielius1922 Danielius1922 marked this pull request as ready for review May 30, 2025 17:23
@Danielius1922 Danielius1922 requested a review from jkralik May 30, 2025 17:23
Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (5)
examples/mcast/client/main.go (1)

103-107: Consider improving comment formatting.

While the logic is unchanged, placing the closing comment */ and the if err != nil check on the same line reduces readability. Consider keeping them on separate lines for better code clarity.

-		err = req.SetupGet("/oic/res", token) /* msg.Option{
-			ID:    msg.URIQuery,
-			Value: []byte("rt=oic.wk.d"),
-		}*/if err != nil {
+		err = req.SetupGet("/oic/res", token) /* msg.Option{
+			ID:    msg.URIQuery,
+			Value: []byte("rt=oic.wk.d"),
+		}*/
+		if err != nil {
.golangci.yml (4)

4-5: Remove obsolete issues section
The commented-out issues block applies to v1 configs. Since you’re fully on v2, you can delete these lines to keep the file clean.


22-22: Clean up unused commented linter
The commented exportloopref line should be removed if it's not needed. If you intend to disable that linter, list it explicitly under disable: for clarity.


31-32: Review commented-out linters
Both goerr113 and gomoddirectives are currently commented out. Move them to the disable: section if you want them off, or remove them entirely to avoid confusion.


151-158: Optimize formatter configuration
You’ve enabled gci, gofmt, gofumpt, and goimports. Note that gofumpt encompasses gofmt rules. Consider removing the direct gofmt entry to streamline the pipeline.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71407da and 58e5579.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (10)
  • .github/workflows/golangci-lint.yml (1 hunks)
  • .golangci.yml (3 hunks)
  • examples/dtls/cid/server/main.go (2 hunks)
  • examples/dtls/pki/cert_util.go (0 hunks)
  • examples/mcast/client/main.go (2 hunks)
  • examples/mcast/server/main.go (1 hunks)
  • examples/options/server/main.go (2 hunks)
  • examples/simple/server/main.go (1 hunks)
  • go.mod (1 hunks)
  • pkg/cache/cache.go (2 hunks)
💤 Files with no reviewable changes (1)
  • examples/dtls/pki/cert_util.go
🧰 Additional context used
🧬 Code Graph Analysis (2)
examples/simple/server/main.go (2)
mux/router.go (1)
  • ResponseWriter (15-20)
mux/message.go (1)
  • Message (13-16)
examples/dtls/cid/server/main.go (2)
dtls/server/server.go (2)
  • Listener (21-24)
  • New (40-86)
udp/client/conn.go (2)
  • WithInactivityMonitor (261-265)
  • Conn (184-218)
🔇 Additional comments (14)
examples/mcast/server/main.go (1)

52-52: Good variable scoping improvement.

Changing from := to = eliminates variable shadowing by using the existing err variable instead of creating a new local one. This improves code clarity and follows Go best practices.

examples/options/server/main.go (2)

12-12: Good import consolidation.

Consolidating the import statement removes duplication and improves code organization.


52-56: Excellent naming convention improvement.

Renaming clientId to clientID follows Go naming conventions where acronyms like "ID" should be fully capitalized. This improves code consistency and readability.

pkg/cache/cache.go (1)

53-53: Excellent use of method promotion.

Changing from direct field access (c.Map.ReplaceWithFunc, c.Map.Delete) to promoted method calls (c.ReplaceWithFunc, c.Delete) is more idiomatic Go code. This properly leverages Go's method promotion feature and provides better encapsulation while maintaining the same functionality.

Also applies to: 80-80

examples/dtls/cid/server/main.go (2)

46-48: LGTM: Struct simplification improves clarity.

Good cleanup removing the unused closed field from the wrappedListener struct. This simplifies the code while maintaining the same functionality.


88-88: LGTM: Proper use of unnamed parameter.

Using _ for the unused connection parameter in the inactivity monitor callback clearly indicates the parameter is intentionally ignored, improving code readability.

examples/simple/server/main.go (1)

20-20: LGTM: Proper handling of unused parameter.

Good improvement using _ to explicitly indicate the request message parameter is intentionally unused in this handler. This follows Go conventions and improves code clarity.

examples/mcast/client/main.go (2)

113-113: LGTM: Proper use of unnamed parameter.

Using _ for the unused response message parameter in the DiscoveryRequest callback clearly indicates it's intentionally ignored.


127-127: LGTM: Proper use of unnamed parameter.

Using _ for the unused value parameter in the Range function follows Go conventions and improves code clarity.

go.mod (2)

7-12: LGTM: Dependency updates improve security and functionality.

The direct dependency updates look good:

  • github.com/pion/dtls/v3 updated to v3.0.6 (from v3.0.2 mentioned in PR objectives)
  • golang.org/x/* packages updated to recent versions

These updates should provide bug fixes and security improvements.


17-22: LGTM: Indirect dependency updates.

The indirect dependency updates align with the direct dependency updates and should provide improved stability and security.

.golangci.yml (3)

1-3: Upgrade configuration to v2 and set Go version
The keys version: "2" and run.go: "1.20" correctly bump to the new config schema and pin the linter to your Go version. Verify your CI workflow uses golangci-lint v2 to avoid compatibility issues.


101-109: Configure settings and exclusions per v2 schema
The new settings block for gocyclo and govet, along with the exclusions section, aligns with the v2 format. Run golangci-lint run --config .golangci.yml to ensure these rules load correctly and exclusions behave as expected.


150-150: Exclude the examples directory
Adding examples to exclusions.paths silences lint reports for example code. Confirm that any intentional warnings in examples are now properly hidden.

@@ -25,7 +25,7 @@ jobs:
- run: go version

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v8
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the action version and approve the upgrade.

The upgrade from golangci-lint-action@v6 to v8 is a good practice to stay current with the latest features and security updates.


🌐 Web query:

What is the latest stable version of golangci/golangci-lint-action on GitHub?

💡 Result:

The latest stable version of the golangci/golangci-lint-action GitHub Action is v6.2.0, released on May 28, 2025. (newreleases.io)

This release introduces support for Linux ARM64 in public preview and updates the build tag syntax.

For detailed information on this release, you can refer to the release notes. (newreleases.io)

To use this version in your GitHub Actions workflow, specify it as follows:

- name: Golangci-lint
  uses: golangci/golangci-lint-action@v6.2.0
  with:
    version: v1.60

Ensure that the version input matches the desired version of golangci-lint you intend to use.

Citations:


Invalid golangci-lint Action version
The workflow is currently using golangci/golangci-lint-action@v8, but no v8 release exists. The latest stable release is v6.2.0 (released May 28, 2025).

Please update the workflow:

• File: .github/workflows/golangci-lint.yml
Line: 28

Suggested change:

- uses: golangci/golangci-lint-action@v8
+ uses: golangci/golangci-lint-action@v6.2.0
  with:
    version: v1.60
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: golangci/golangci-lint-action@v8
uses: golangci/golangci-lint-action@v6.2.0
with:
version: v1.60
🤖 Prompt for AI Agents
In .github/workflows/golangci-lint.yml at line 28, the golangci-lint GitHub
Action version is incorrectly set to v8, which does not exist. Update the action
version to the latest stable release v6.2.0 by changing the uses line to
golangci/golangci-lint-action@v6.2.0. Also, ensure the 'version' input parameter
matches the golangci-lint tool version you want to use.

@@ -4,20 +4,29 @@ go 1.20

require (
github.com/dsnet/golib/memfile v1.0.0
github.com/pion/dtls/v3 v3.0.2
github.com/pion/dtls/v3 v3.0.6
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify security vulnerabilities in updated dependencies.

Please verify that the updated dependency versions don't contain known security vulnerabilities.

Also applies to: 10-12, 17-17, 20-21


🌐 Web query:

Are there any known security vulnerabilities in github.com/pion/dtls/v3 v3.0.6, golang.org/x/net v0.35.0, golang.org/x/crypto v0.33.0, or golang.org/x/sys v0.30.0?

💡 Result:

Security Vulnerabilities in Specific Go Packages and Versions

1. github.com/pion/dtls/v3 v3.0.6

  • There are no publicly documented vulnerabilities specific to v3.0.6 as of now in the GitHub security advisories or recent release notes[1][2][3].
  • Previous research uncovered vulnerabilities in older versions, including a padding oracle vulnerability and potential issues with processing unencrypted data post-handshake[5][10]. However, these are not confirmed in the v3.0.6 or v3.x series, and the most prominent CVE (CVE-2022-29189) was fixed in v2.1.4[4].
  • The Pion team aspires to a formal security review but does not list any current open vulnerabilities for v3.0.6[1][3].

Summary: No known, unpatched vulnerabilities in v3.0.6.


2. golang.org/x/net v0.35.0

  • Multiple vulnerabilities have been found in versions below 0.38.0:
    • CVE-2024-45338: Denial of Service due to non-linear parsing in the html package, impacting v0.35.0[7].
    • CVE-2025-22872: Cross-site scripting (XSS) vulnerability due to the tokenizer incorrectly treating tags as self-closing in certain contexts, also affecting v0.35.0[9].

Summary: v0.35.0 is affected by at least two publicly disclosed vulnerabilities. Upgrade is recommended.


3. golang.org/x/crypto v0.33.0

  • CVE-2025-22869: SSH servers using the package are vulnerable to a Denial of Service (DoS) attack via slow or incomplete key exchange. This impacts all versions prior to v0.35.0, including v0.33.0[6].

Summary: v0.33.0 is vulnerable to DoS attacks and should be upgraded.


4. golang.org/x/sys v0.30.0

  • No reported or documented vulnerabilities specific to v0.30.0 or close releases were found in search results[8].

Summary: No known vulnerabilities in v0.30.0 as of now.


Summary Table

Package Version Vulnerabilities Present? Details / References
github.com/pion/dtls/v3 v3.0.6 No known current vulnerabilities [1][2][3]
golang.org/x/net v0.35.0 Yes CVE-2024-45338[7], CVE-2025-22872[9]
golang.org/x/crypto v0.33.0 Yes CVE-2025-22869[6]
golang.org/x/sys v0.30.0 No [8]

Recommendations

  • Upgrade both golang.org/x/net and golang.org/x/crypto to the latest versions available to address well-documented security flaws.
  • Monitor Pion DTLS for future advisories, but v3.0.6 has no open, critical CVEs at this time.
  • No immediate action needed for golang.org/x/sys v0.30.0, but keep it updated as part of normal maintenance.

If your project is security sensitive, consider a full security review and always track dependency advisories for updates.

Citations:


Address security vulnerabilities in Go dependencies

The following versions in go.mod are affected by known CVEs and should be upgraded:

  • go.mod (lines 10–12): golang.org/x/net v0.35.0
    CVE-2024-45338 (DoS via non-linear HTML parsing)
    CVE-2025-22872 (XSS in HTML tokenizer)
    → Upgrade to ≥ v0.38.0

  • go.mod (line 17): golang.org/x/crypto v0.33.0
    CVE-2025-22869 (SSH DoS via slow/incomplete key exchange)
    → Upgrade to ≥ v0.35.0

No action needed for:

  • github.com/pion/dtls/v3 v3.0.6 (no known vulnerabilities)
  • golang.org/x/sys v0.30.0 (no known vulnerabilities)

Please bump these two dependencies in go.mod and verify there are no downstream breaking changes.

🤖 Prompt for AI Agents
In go.mod around lines 10 to 12 and line 17, the dependencies golang.org/x/net
v0.35.0 and golang.org/x/crypto v0.33.0 have known security vulnerabilities.
Upgrade golang.org/x/net to version 0.38.0 or higher and golang.org/x/crypto to
version 0.35.0 or higher to address these CVEs. Confirm that these upgrades do
not introduce breaking changes in downstream code.

Comment on lines +25 to +32
// pin versions to keep go1.20 support
replace (
golang.org/x/crypto => golang.org/x/crypto v0.33.0
golang.org/x/exp => golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e
golang.org/x/net => golang.org/x/net v0.35.0
golang.org/x/sync => golang.org/x/sync v0.11.0
golang.org/x/sys => golang.org/x/sys v0.30.0
)
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Question the necessity of the replace directive.

The replace directive pins the exact same versions that are already specified in the require section. This appears redundant unless there are specific transitive dependency conflicts.

Please verify if this replace directive is actually necessary by checking if any transitive dependencies pull in incompatible versions:


🏁 Script executed:

#!/bin/bash
# Description: Check if replace directives are necessary by examining transitive dependencies

echo "Checking for version conflicts in transitive dependencies..."

# Check what versions would be selected without replace directives
go mod graph | grep -E "(golang.org/x/crypto|golang.org/x/exp|golang.org/x/net|golang.org/x/sync|golang.org/x/sys)" | head -20

echo -e "\nChecking go mod why for each replaced module..."
go mod why golang.org/x/crypto
go mod
849C
 why golang.org/x/exp  
go mod why golang.org/x/net
go mod why golang.org/x/sync
go mod why golang.org/x/sys

Length of output: 2968


Drop redundant replace directives in go.mod

All of the golang.org/x/{crypto,exp,net,sync,sys} modules are only pulled in indirectly, and the Go resolver already selects the same highest versions you’ve pinned (no transitive dependency is requesting a newer release). You can safely remove the entire replace block (lines 25–32) to simplify your module:

  • go.mod: delete lines 25–32 (the replace (…) section)

If you still intend to proactively guard against future upgrades that might bump these beyond Go 1.20, consider documenting that goal instead of mirroring the current require versions here.

🤖 Prompt for AI Agents
In go.mod around lines 25 to 32, the replace directive pins versions of
golang.org/x/{crypto,exp,net,sync,sys} that are identical to those already
specified in the require section, making it redundant. Remove the entire replace
block from lines 25 to 32 to simplify the module, as the Go module resolver
already selects these versions correctly without conflicts. If you want to guard
against future upgrades, add a comment instead of duplicating the version pins.

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
0