Skip to content

Add warn for helper func#38

Merged
BretRen merged 1 commit into
mainfrom
feat/no-silent-error
Apr 20, 2026
Merged

Add warn for helper func#38
BretRen merged 1 commit into
mainfrom
feat/no-silent-error

Conversation

@BretRen
Copy link
Copy Markdown
Member

@BretRen BretRen commented Apr 20, 2026

No description provided.

@BretRen BretRen linked an issue Apr 20, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Warning

Rate limit exceeded

@BretRen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 34 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 5 minutes and 34 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 91695a78-2e2e-4c34-87e3-79c8930c4ebd

📥 Commits

Reviewing files that changed from the base of the PR and between 13adbaa and ff93527.

📒 Files selected for processing (1)
  • config.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/no-silent-error

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@BretRen BretRen merged commit 57f7739 into main Apr 20, 2026
1 check passed
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces structured logging to environment variable configuration helpers using the slog package. The review feedback highlights that logging warnings for missing environment variables in 'IfPresent' functions is inappropriate for optional configurations and will cause excessive log noise. Furthermore, logging the raw values of environment variables when parsing fails is flagged as a security risk due to potential sensitive information leakage; the reviewer recommends logging the error object instead.

Comment thread config.go
Comment on lines +28 to 32
slog.Warn("invalid_bool", "env", key, "value", v)
}
} else {
slog.Warn("missing_env", "env", key)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-high high

This change introduces two issues:

  1. Security: Logging the raw value v from an environment variable can leak sensitive information if a secret was accidentally assigned to the wrong key. It is safer to log the error returned by the parser.
  2. Log Noise: Warning when an optional environment variable is missing is misleading for "IfPresent" helpers.

Consider removing the missing environment warning and logging the error instead of the raw value.

			slog.Warn("invalid_bool", "env", key, "err", err)
		}
	}

Comment thread config.go
Comment on lines +40 to 44
slog.Warn("invalid_int", "env", key, "value", v)
}
} else {
slog.Warn("missing_env", "env", key)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-high high

Similar to setBoolIfPresent, logging the raw value v poses a security risk of leaking secrets into logs. Additionally, warning on missing optional variables creates unnecessary log noise. It is recommended to log the parsing error and remove the warning for missing variables.

			slog.Warn("invalid_int", "env", key, "err", err)
		}
	}

Comment thread config.go
Comment on lines +18 to 20
} else {
slog.Warn("missing_env", "env", key)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The setStringIfPresent function is designed for optional environment variables. Logging a warning when the variable is missing contradicts the "IfPresent" semantics and will result in excessive log noise for optional configuration. If a variable is mandatory, it should be handled by a separate validation step or a different helper function.

	}

@BretRen BretRen deleted the feat/no-silent-error branch April 21, 2026 00:32
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.

Improved silent resolution error ignoring

1 participant