Skip to content

Conversation

@ShocOne
Copy link
Member

@ShocOne ShocOne commented Feb 7, 2024

Change

Feel free to remove this sample text

Thank you for your contribution !
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update (Wiki)

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • My corresponding pipelines / checks run clean and green without any errors or warnings
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (readme)
  • I did format my code

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

// calculateBackoff calculates the next delay for retry with exponential backoff and jitter.
func calculateBackoff(retry int) time.Duration {
delay := float64(baseDelay) * math.Pow(2, float64(retry))
jitter := (rand.Float64() - 0.5) * jitterFactor * 2.0 // Random value between -jitterFactor and +jitterFactor

Check failure

Code scanning / gosec

Use of weak random number generator (math/rand instead of crypto/rand)

Use of weak random number generator (math/rand instead of crypto/rand)
OAuthTokenEndpoint = "/api/oauth/token" // OAuthTokenEndpoint: The endpoint to obtain an OAuth token.
BearerTokenEndpoint = "/api/v1/auth/token" // BearerTokenEndpoint: The endpoint to obtain a bearer token.
TokenRefreshEndpoint = "/api/v1/auth/keep-alive" // TokenRefreshEndpoint: The endpoint to refresh an existing token.
TokenInvalidateEndpoint = "/api/v1/auth/invalidate-token" // TokenInvalidateEndpoint: The endpoint to invalidate an active token.

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
DefaultBaseDomain = ".jamfcloud.com" // DefaultBaseDomain: represents the base domain for the jamf instance.
OAuthTokenEndpoint = "/api/oauth/token" // OAuthTokenEndpoint: The endpoint to obtain an OAuth token.
BearerTokenEndpoint = "/api/v1/auth/token" // BearerTokenEndpoint: The endpoint to obtain a bearer token.
TokenRefreshEndpoint = "/api/v1/auth/keep-alive" // TokenRefreshEndpoint: The endpoint to refresh an existing token.

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
const (
DefaultBaseDomain = ".jamfcloud.com" // DefaultBaseDomain: represents the base domain for the jamf instance.
OAuthTokenEndpoint = "/api/oauth/token" // OAuthTokenEndpoint: The endpoint to obtain an OAuth token.
BearerTokenEndpoint = "/api/v1/auth/token" // BearerTokenEndpoint: The endpoint to obtain a bearer token.

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
// Endpoint constants represent the URL suffixes used for Jamf API token interactions.
const (
DefaultBaseDomain = ".jamfcloud.com" // DefaultBaseDomain: represents the base domain for the jamf instance.
OAuthTokenEndpoint = "/api/oauth/token" // OAuthTokenEndpoint: The endpoint to obtain an OAuth token.

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
// LoadAuthConfig reads a JSON configuration file and decodes it into a ClientAuthConfig struct.
// It is used to retrieve authentication details like BaseURL, Username, and Password for the client.
func LoadAuthConfig(filename string) (*AuthConfig, error) {
file, err := os.Open(filename)

Check failure

Code scanning / gosec

Potential file inclusion via variable

Potential file inclusion via variable

// Add the files to the form data
for formField, filepath := range files {
file, err := os.Open(filepath)

Check failure

Code scanning / gosec

Potential file inclusion via variable

Potential file inclusion via variable
// If reading or unmarshalling fails, an error is returned.
func LoadUserConfig(filename string) error {
// Read the user-provided JSON configuration file and unmarshal it into the global configMap.
userConfigBytes, err := os.ReadFile(filename)

Check failure

Code scanning / gosec

Potential file inclusion via variable

Potential file inclusion via variable
***Remove unused http client default configuration***

***Improve error handling and logging in http client***

***Update go.sum with new dependencies
// Endpoint constants represent the URL suffixes used for Graph API token interactions.
const (
DefaultBaseDomain = "graph.microsoft.com" // DefaultBaseDomain: represents the base domain for graph.
TokenInvalidateEndpoint = "/api/v1/auth/invalidate-token" // TokenInvalidateEndpoint: The endpoint to invalidate an active token.

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials

// Add the files to the form data
for formField, filepath := range files {
file, err := os.Open(filepath)

Check failure

Code scanning / gosec

Potential file inclusion via variable

Potential file inclusion via variable
// If reading or unmarshalling fails, an error is returned.
func LoadUserConfig(filename string) error {
// Read the user-provided JSON configuration file and unmarshal it into the global configMap.
userConfigBytes, err := os.ReadFile(filename)

Check failure

Code scanning / gosec

Potential file inclusion via variable

Potential file inclusion via variable
// Debug method implementation
func (d *defaultLogger) Debug(msg string, keysAndValues ...interface{}) {
if d.logLevel >= LogLevelDebug {
d.logger.Debug(msg, toZapFields(keysAndValues...)...)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

[Sensitive data returned by HTTP request headers](1) flows to a logging call. [Sensitive data returned by HTTP request headers](2) flows to a logging call.
@ShocOne ShocOne merged commit a127fe1 into main Feb 7, 2024
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