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: Support symlinks in ca-certs folder #32391

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

pratapaprasanna
Copy link
Contributor

@pratapaprasanna pratapaprasanna commented Apr 3, 2024

Fixes: 30928

Summary by CodeRabbit

  • Chores
    • Improved certificate search operation by enabling symbolic link resolution.

@github-actions github-actions bot added DevOps Pod Issues related to devops Enhancement New feature or request K8s Kubernetes related issues Needs Triaging Needs attention from maintainers to triage labels Apr 3, 2024
Copy link
Contributor

coderabbitai bot commented Apr 3, 2024

Walkthrough

Walkthrough

The modification in the entrypoint.sh script for Appsmith involves enhancing the find command within the setup-custom-ca-certificates function by adding the -L flag. This change allows the command to follow symbolic links when searching for files, which can improve the script's ability to locate and handle custom CA certificates in various environments.

Changes

File Path Change Summary
.../appsmith/entrypoint.sh Added -L flag to find in setup-custom-ca-certificates

Possibly related issues

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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/coderabbit-overrides.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.

@github-actions github-actions bot added Enhancement New feature or request and removed Enhancement New feature or request labels Apr 3, 2024
@@ -319,7 +319,7 @@ setup-custom-ca-certificates() (
-deststorepass changeit

# Add the custom CA certificates to the store.
find "$stacks_ca_certs_path" -maxdepth 1 -type f -name '*.crt' \
find -L "$stacks_ca_certs_path" -maxdepth 1 -type f -name '*.crt' \
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider quoting the {} placeholder in the find command to prevent word splitting.

-    -exec keytool -import -alias '{}' -noprompt -keystore "$store" -file '{}' -storepass changeit ';'
+    -exec keytool -import -alias '{}' -noprompt -keystore "$store" -file '{}' -storepass changeit ';'

While this specific usage might not directly lead to issues, consistently quoting placeholders is a good practice to prevent unexpected behavior in scripts.


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.

Suggested change
find -L "$stacks_ca_certs_path" -maxdepth 1 -type f -name '*.crt' \
find -L "$stacks_ca_certs_path" -maxdepth 1 -type f -name '*.crt' \

Comment on lines 319 to 325
-deststorepass changeit

# Add the custom CA certificates to the store.
find "$stacks_ca_certs_path" -maxdepth 1 -type f -name '*.crt' \
find -L "$stacks_ca_certs_path" -maxdepth 1 -type f -name '*.crt' \
-print \
-exec keytool -import -alias '{}' -noprompt -keystore "$store" -file '{}' -storepass changeit ';'

Copy link
Contributor

Choose a reason for hiding this comment

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

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [62-62]

Use -n instead of ! -z for string non-empty check for better readability.

- if [[ ! -z ${APPSMITH_SEGMENT_CE_KEY-} ]]; then
+ if [[ -n ${APPSMITH_SEGMENT_CE_KEY-} ]]; then

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [81-81]

Declare and assign separately to avoid masking return values. This ensures that the return value of the command is not inadvertently masked by the assignment operation.

-  FILESTORE_IP_ADDRESS="$(echo "$FILESTORE_IP_ADDRESS" | xargs)"
+  FILESTORE_IP_ADDRESS=$(echo "$FILESTORE_IP_ADDRESS" | xargs)
-  FILE_SHARE_NAME="$(echo "$FILE_SHARE_NAME" | xargs)"
+  FILE_SHARE_NAME=$(echo "$FILE_SHARE_NAME" | xargs)

Apply this change to all similar instances in the script.

Also applies to: 85-85, 89-89, 93-93


📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [457-457]

Double quote the variable to prevent globbing and word splitting.

-  cp -v "$1" "$MONGODB_TMP_KEY_PATH"
+  cp -v "$1" "$MONGODB_TMP_KEY_PATH"

This change ensures that the script behaves as expected even if the variable contains spaces or glob characters.

@sharat87 sharat87 changed the title [fix]: ca-certs import symlinks fix: Support symlinks in ca-certs folder Apr 4, 2024
@github-actions github-actions bot added Enhancement New feature or request Bug Something isn't working and removed Enhancement New feature or request labels Apr 4, 2024
@sharat87
Copy link
Member

sharat87 commented Apr 4, 2024

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Apr 4, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8549563701.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 32391.
recreate: .

Copy link

github-actions bot commented Apr 4, 2024

Deploy-Preview-URL: https://ce-32391.dp.appsmith.com

@sharat87 sharat87 merged commit 8534e12 into release Apr 4, 2024
22 of 23 checks passed
@sharat87 sharat87 deleted the fix/copy/symlinks/ca-certs branch April 4, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working DevOps Pod Issues related to devops K8s Kubernetes related issues Needs Triaging Needs attention from maintainers to triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Check for ca-certificates even if they are symlinks and not just files
2 participants