Skip to content

Add configuration variables to script.sh#8

Open
Ngwerume wants to merge 4 commits intomainfrom
shell-test
Open

Add configuration variables to script.sh#8
Ngwerume wants to merge 4 commits intomainfrom
shell-test

Conversation

@Ngwerume
Copy link
Contributor

No description provided.

#!/bin/bash
DFS_LOSTANDFOUND_BASE="/user/hadoop/data/rawlogs-new3/lostAndFound/"
GCS_BUCKET_BASE="gs://google/pds/rawlogs/"
REMOTE_SERVER="google.com"

Choose a reason for hiding this comment

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

⚠️ Codacy found a medium ErrorProne issue: REMOTE_SERVER appears unused. Verify use (or export if used externally).

The issue identified by ShellCheck indicates that the variable REMOTE_SERVER is defined but never used in the script. This can lead to confusion, as it suggests that the variable may have been intended for some purpose but ultimately isn't serving any function in the current context of the script.

To address this issue, you can either remove the unused variable if it's not needed, or if you plan to use it later, you could export it for potential use in subprocesses. Since the prompt requests a single line change, I'll provide a suggestion to export the variable, assuming it may be used later in the script or in subprocesses.

Suggested change
REMOTE_SERVER="google.com"
export REMOTE_SERVER="google.com"

This comment was generated by an experimental AI tool.

pass="Malyaj@PassTest1"
STRIPE_API_KEY="rk_test_1234567890abcdefghijklmnopqrstuvwxyz"
STRIPE_SECRET = "sk_live_51234567890abcdefghijklmnopqrstuvwxyz"
AWS_ACCESS_KEY = "AKIAIOSFODNN7EXAMPLE"

Choose a reason for hiding this comment

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

🚫 Codacy found a high ErrorProne issue: Remove spaces around = to assign (or use [ ] to compare, or quote '=' if literal).

The issue identified by the ShellCheck linter is that there are spaces around the = sign in the assignment of the AWS_ACCESS_KEY variable. In shell scripting, spaces are not allowed around the = when assigning values to variables. The correct syntax for variable assignment does not include spaces.

To fix this issue, you should remove the spaces around the = sign in the assignment of the AWS_ACCESS_KEY.

Here is the suggested code change:

Suggested change
AWS_ACCESS_KEY = "AKIAIOSFODNN7EXAMPLE"
AWS_ACCESS_KEY="AKIAIOSFODNN7EXAMPLE"

This comment was generated by an experimental AI tool.

@@ -0,0 +1,15 @@
#!/bin/bash
DFS_LOSTANDFOUND_BASE="/user/hadoop/data/rawlogs-new3/lostAndFound/"
GCS_BUCKET_BASE="gs://google/pds/rawlogs/"

Choose a reason for hiding this comment

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

⚠️ Codacy found a medium ErrorProne issue: GCS_BUCKET_BASE appears unused. Verify use (or export if used externally).

The issue reported by ShellCheck indicates that the variable GCS_BUCKET_BASE is defined but never used in the script. This can lead to confusion as it suggests that the variable is intended for use but has no purpose in the current context. To resolve this, you can either remove the variable if it's unnecessary or use it in a command.

If we assume that GCS_BUCKET_BASE is intended to be used in a command (for example, to upload a file to Google Cloud Storage), we can modify the script to include a command that utilizes this variable.

Here's a code suggestion that demonstrates one way to use GCS_BUCKET_BASE in a hypothetical gsutil command to copy a file to the Google Cloud Storage bucket:

Suggested change
GCS_BUCKET_BASE="gs://google/pds/rawlogs/"
gsutil cp /path/to/local/file.txt "$GCS_BUCKET_BASE"

This line assumes that there is a file you want to copy to the GCS bucket, thus utilizing the GCS_BUCKET_BASE variable meaningfully. Adjust the local file path accordingly based on your requirements.


This comment was generated by an experimental AI tool.

@@ -0,0 +1,15 @@
#!/bin/bash
DFS_LOSTANDFOUND_BASE="/user/hadoop/data/rawlogs-new3/lostAndFound/"

Choose a reason for hiding this comment

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

⚠️ Codacy found a medium ErrorProne issue: DFS_LOSTANDFOUND_BASE appears unused. Verify use (or export if used externally).

The issue reported by ShellCheck indicates that the variable DFS_LOSTANDFOUND_BASE is defined but not used anywhere in the script. This could lead to confusion, as it suggests that the variable might be unnecessary or that the script is incomplete. To address this issue, you should either use the variable in the script or remove it if it's not needed.

If the variable is intended to be used later in the script, you should ensure that it is utilized properly. If it's meant to be exported for use in a subshell or in another script, you can export it.

Here's a code suggestion to export the variable, which allows it to be accessible in subshells or child processes:

Suggested change
DFS_LOSTANDFOUND_BASE="/user/hadoop/data/rawlogs-new3/lostAndFound/"
export DFS_LOSTANDFOUND_BASE="/user/hadoop/data/rawlogs-new3/lostAndFound/"

This comment was generated by an experimental AI tool.

GCS_BUCKET_BASE="gs://google/pds/rawlogs/"
REMOTE_SERVER="google.com"
password="insecure"
pass="Malyaj@PassTest1"

Choose a reason for hiding this comment

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

⚠️ Codacy found a medium ErrorProne issue: pass appears unused. Verify use (or export if used externally).

The issue identified by the ShellCheck linter is that the variable pass is declared but not used anywhere in the script. This could indicate that it was intended for use but is currently not being utilized, which could lead to confusion or maintenance issues in the future. If the variable is meant to be used later in the script (for example, for authentication purposes), it should be integrated appropriately. If it's not needed, it should be removed to clean up the code.

To address this issue while keeping the variable for potential future use, you can export it so that it can be accessed by any child processes. Here's the single line change to fix the issue:

Suggested change
pass="Malyaj@PassTest1"
export pass="Malyaj@PassTest1"

This comment was generated by an experimental AI tool.

DFS_LOSTANDFOUND_BASE="/user/hadoop/data/rawlogs-new3/lostAndFound/"
GCS_BUCKET_BASE="gs://google/pds/rawlogs/"
REMOTE_SERVER="google.com"
password="insecure"

Choose a reason for hiding this comment

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

⚠️ Codacy found a medium ErrorProne issue: password appears unused. Verify use (or export if used externally).

The issue identified by the ShellCheck linter indicates that the variable password is declared but never used in the script. This can lead to confusion and potential security concerns, as it might suggest that sensitive information is being stored without purpose.

To address this issue, you should either remove the unused variable if it's not needed, or if it is intended for future use, you might want to export it for use in subshells. Since the context does not provide any indication that the variable is necessary, the best approach would be to remove it altogether.

Here's the code suggestion to remove the unused variable:

Suggested change
password="insecure"
# password="insecure"

This comment was generated by an experimental AI tool.

password="insecure"
pass="Malyaj@PassTest1"
STRIPE_API_KEY="rk_test_1234567890abcdefghijklmnopqrstuvwxyz"
STRIPE_SECRET = "sk_live_51234567890abcdefghijklmnopqrstuvwxyz"

Choose a reason for hiding this comment

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

🚫 Codacy found a high ErrorProne issue: Remove spaces around = to assign (or use [ ] to compare, or quote '=' if literal).

The issue in the line STRIPE_SECRET = "sk_live_51234567890abcdefghijklmnopqrstuvwxyz" is that there are spaces around the equal sign (=) which is not allowed in variable assignments in shell scripting. To correctly assign a value to a variable, there should be no spaces around the =.

Here’s the corrected line:

Suggested change
STRIPE_SECRET = "sk_live_51234567890abcdefghijklmnopqrstuvwxyz"
STRIPE_SECRET="sk_live_51234567890abcdefghijklmnopqrstuvwxyz"

This comment was generated by an experimental AI tool.

@codacy-production
Copy link

codacy-production bot commented Dec 5, 2025

Codacy's Analysis Summary

7 new issues (≤ 0 medium issue)
0 new security issue (≤ 0 issue)

Review Pull Request in Codacy →

AI Reviewer available: add the codacy-review label to get contextual insights without leaving GitHub.

Copy link

@codacy-production codacy-production bot left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces several configuration variables and a curl command. However, it fails to meet standards due to critical security concerns related to hardcoded sensitive information and syntax errors in shell variable assignments. The hardcoded API keys and passwords pose a significant security risk and must be addressed before merging. There are also several variables that are defined but not used.

About this PR

  • Hardcoding sensitive credentials such as API keys and passwords directly in the script is a critical security vulnerability. These values should be loaded from environment variables, a secure configuration store (e.g., Vault, AWS Secrets Manager), or passed in securely at runtime, not stored in source control. The presence of sk_live for STRIPE_SECRET and AKIAIOSFODNN7EXAMPLE for AWS_ACCESS_KEY is especially concerning.
  • The PR description is empty. Providing a clear and concise description helps reviewers understand the purpose and scope of the changes, facilitating a more effective review process and improving maintainability.

💡 Codacy uses AI. Check for mistakes.

pass="Malyaj@PassTest1"
STRIPE_API_KEY="rk_test_1234567890abcdefghijklmnopqrstuvwxyz"
STRIPE_SECRET = "sk_live_51234567890abcdefghijklmnopqrstuvwxyz"
AWS_ACCESS_KEY = "AKIAIOSFODNN7EXAMPLE"

Choose a reason for hiding this comment

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

🔴 HIGH RISK

Codacy found an incorrect assignment syntax here. In shell scripts, there should be no spaces around the = operator for variable assignments. If this is intended as a comparison, it should be wrapped in [ ] brackets.

See Issue in Codacy

password="insecure"
pass="Malyaj@PassTest1"
STRIPE_API_KEY="rk_test_1234567890abcdefghijklmnopqrstuvwxyz"
STRIPE_SECRET = "sk_live_51234567890abcdefghijklmnopqrstuvwxyz"

Choose a reason for hiding this comment

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

🔴 HIGH RISK

Codacy found an incorrect assignment syntax here. In shell scripts, there should be no spaces around the = operator for variable assignments. If this is intended as a comparison, it should be wrapped in [ ] brackets.

See Issue in Codacy

GCS_BUCKET_BASE="gs://google/pds/rawlogs/"
REMOTE_SERVER="google.com"
password="insecure"
pass="Malyaj@PassTest1"

Choose a reason for hiding this comment

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

🔴 HIGH RISK

Codacy found that pass appears unused. Similar to the password variable, hardcoding this value, especially one that looks like a credential, is a security risk. If unused, remove it. If it's meant to be used, ensure it's handled securely.

See Issue in Codacy

DFS_LOSTANDFOUND_BASE="/user/hadoop/data/rawlogs-new3/lostAndFound/"
GCS_BUCKET_BASE="gs://google/pds/rawlogs/"
REMOTE_SERVER="google.com"
password="insecure"

Choose a reason for hiding this comment

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

🔴 HIGH RISK

Codacy found that password appears unused. Furthermore, setting a default password to "insecure" is a critical security vulnerability and should be avoided even in test scripts. This variable should be removed, or if it's meant to be used, its value must be handled securely (e.g., loaded from a secure source, not hardcoded).

See Issue in Codacy

#!/bin/bash
DFS_LOSTANDFOUND_BASE="/user/hadoop/data/rawlogs-new3/lostAndFound/"
GCS_BUCKET_BASE="gs://google/pds/rawlogs/"
REMOTE_SERVER="google.com"

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Codacy found that REMOTE_SERVER appears unused. If this variable is not intended for use in the script, it should be removed. If it is meant to be used, please ensure it's referenced appropriately.

See Issue in Codacy

@@ -0,0 +1,15 @@
#!/bin/bash
DFS_LOSTANDFOUND_BASE="/user/hadoop/data/rawlogs-new3/lostAndFound/"
GCS_BUCKET_BASE="gs://google/pds/rawlogs/"

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Codacy found that GCS_BUCKET_BASE appears unused. If this variable is not intended for use in the script, it should be removed. If it is meant to be used, please ensure it's referenced appropriately.

See Issue in Codacy

@@ -0,0 +1,15 @@
#!/bin/bash
DFS_LOSTANDFOUND_BASE="/user/hadoop/data/rawlogs-new3/lostAndFound/"

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Codacy found that DFS_LOSTANDFOUND_BASE appears unused. If this variable is not intended for use in the script, it should be removed. If it is meant to be used, please ensure it's referenced appropriately.

See Issue in Codacy

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.

1 participant