Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue 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

fix: set max for max cookie number to math.MaxInt #16388

Merged
merged 3 commits into from
Nov 20, 2023

Conversation

onematchfox
Copy link
Contributor

@onematchfox onematchfox commented Nov 19, 2023

The goreleaser-based release build for terraform-provider-argocd is currently failing with the following error:

  ⨯ release failed after 3m53s               error=failed to build for freebsd_arm_6: exit status 1: # github.com/argoproj/argo-cd/v2/util/http
../../../go/pkg/mod/github.com/argoproj/argo-cd/[email protected]/util/http/http.go:22:77: cannot use math.MaxInt64 (untyped int constant 9223372036854775807) as int value in argument to env.ParseNumFromEnv (overflows)

The affected code in this project was introduced in #14979, which, set the max value of common.EnvMaxCookieNumber to math.MaxInt64. This, as goreleaser correctly identifies, results in an overflow since the max parameter in ParseNumFromEnv is an int (not int64). See

func ParseNumFromEnv(env string, defaultValue, min, max int) int {

Why goreleaser is failing because of an issue initialising code in this project is a bit of a mystery to me, but regardless, this PR addresses the issue (assuming, of course, that int is big enough and the code should not be updated to use env.ParseInt64FromEnv).

Related: argoproj-labs/terraform-provider-argocd#354

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.

Sorry, something went wrong.

Copy link

codecov bot commented Nov 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (841339d) 49.55% compared to head (11c7890) 49.55%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #16388   +/-   ##
=======================================
  Coverage   49.55%   49.55%           
=======================================
  Files         269      269           
  Lines       47046    47046           
=======================================
  Hits        23313    23313           
  Misses      21445    21445           
  Partials     2288     2288           

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

Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

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

LGTM!

util/http/http.go Outdated Show resolved Hide resolved
@onematchfox onematchfox changed the title fix: set max for max cookie number to math.MaxInt32 fix: set max for max cookie number to math.MaxInt Nov 20, 2023
@gdsoumya gdsoumya enabled auto-merge (squash) November 20, 2023 11:11
@gdsoumya gdsoumya merged commit 61abc80 into argoproj:master Nov 20, 2023
25 checks passed
@onematchfox
Copy link
Contributor Author

Thanks for the quick review folks. @gdsoumya are you able to cherry pick this across to the 2.8 and 2.9 release branches?

@onematchfox onematchfox deleted the fix/max-cookie-number-default branch November 20, 2023 12:34
@gdsoumya
Copy link
Member

@onematchfox I think we can do that but I'll still check with other maintainers and see before doing that.

@gdsoumya
Copy link
Member

/cherry-pick release-2.9

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Nov 20, 2023
* fix: set max for max cookie number to `math.MaxInt32`

Signed-off-by: OneMatchFox <[email protected]>

* refactor: set max for max cookie number to `math.MaxInt`

Co-authored-by: gdsoumya <[email protected]>
Signed-off-by: Brian Fox <[email protected]>

---------

Signed-off-by: OneMatchFox <[email protected]>
Signed-off-by: Brian Fox <[email protected]>
Co-authored-by: gdsoumya <[email protected]>
@gdsoumya
Copy link
Member

/cherry-pick release-2.8

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Nov 20, 2023
* fix: set max for max cookie number to `math.MaxInt32`

Signed-off-by: OneMatchFox <[email protected]>

* refactor: set max for max cookie number to `math.MaxInt`

Co-authored-by: gdsoumya <[email protected]>
Signed-off-by: Brian Fox <[email protected]>

---------

Signed-off-by: OneMatchFox <[email protected]>
Signed-off-by: Brian Fox <[email protected]>
Co-authored-by: gdsoumya <[email protected]>
@gdsoumya
Copy link
Member

@onematchfox the commit has been cherry picked to release branches.

@onematchfox
Copy link
Contributor Author

Thanks!

alexymantha pushed a commit to alexymantha/argo-cd that referenced this pull request Nov 22, 2023
* fix: set max for max cookie number to `math.MaxInt32`

Signed-off-by: OneMatchFox <[email protected]>

* refactor: set max for max cookie number to `math.MaxInt`

Co-authored-by: gdsoumya <[email protected]>
Signed-off-by: Brian Fox <[email protected]>

---------

Signed-off-by: OneMatchFox <[email protected]>
Signed-off-by: Brian Fox <[email protected]>
Co-authored-by: gdsoumya <[email protected]>
vladfr pushed a commit to vladfr/argo-cd that referenced this pull request Dec 13, 2023
* fix: set max for max cookie number to `math.MaxInt32`

Signed-off-by: OneMatchFox <[email protected]>

* refactor: set max for max cookie number to `math.MaxInt`

Co-authored-by: gdsoumya <[email protected]>
Signed-off-by: Brian Fox <[email protected]>

---------

Signed-off-by: OneMatchFox <[email protected]>
Signed-off-by: Brian Fox <[email protected]>
Co-authored-by: gdsoumya <[email protected]>
tesla59 pushed a commit to tesla59/argo-cd that referenced this pull request Dec 16, 2023
* fix: set max for max cookie number to `math.MaxInt32`

Signed-off-by: OneMatchFox <[email protected]>

* refactor: set max for max cookie number to `math.MaxInt`

Co-authored-by: gdsoumya <[email protected]>
Signed-off-by: Brian Fox <[email protected]>

---------

Signed-off-by: OneMatchFox <[email protected]>
Signed-off-by: Brian Fox <[email protected]>
Co-authored-by: gdsoumya <[email protected]>
lyda pushed a commit to lyda/argo-cd that referenced this pull request Mar 28, 2024
* fix: set max for max cookie number to `math.MaxInt32`

Signed-off-by: OneMatchFox <[email protected]>

* refactor: set max for max cookie number to `math.MaxInt`

Co-authored-by: gdsoumya <[email protected]>
Signed-off-by: Brian Fox <[email protected]>

---------

Signed-off-by: OneMatchFox <[email protected]>
Signed-off-by: Brian Fox <[email protected]>
Co-authored-by: gdsoumya <[email protected]>
Signed-off-by: Kevin Lyda <[email protected]>
Hariharasuthan99 pushed a commit to AmadeusITGroup/argo-cd that referenced this pull request Jun 16, 2024
* fix: set max for max cookie number to `math.MaxInt32`

Signed-off-by: OneMatchFox <[email protected]>

* refactor: set max for max cookie number to `math.MaxInt`

Co-authored-by: gdsoumya <[email protected]>
Signed-off-by: Brian Fox <[email protected]>

---------

Signed-off-by: OneMatchFox <[email protected]>
Signed-off-by: Brian Fox <[email protected]>
Co-authored-by: gdsoumya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants