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: js-sdk directory/file permission should be set correctly #3616

Merged
merged 8 commits into from
Mar 18, 2025

Conversation

aldy505
Copy link
Collaborator

@aldy505 aldy505 commented Mar 14, 2025

Closes #3614

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@BYK
Copy link
Member

BYK commented Mar 14, 2025

I'm surprised that this wasn't caught by the tests. We should look into that too.

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

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

Can we not resolve the issue by just running the curl command with the nginx user instead?

@aldy505
Copy link
Collaborator Author

aldy505 commented Mar 14, 2025

Can we not resolve the issue by just running the curl command with the nginx user instead?

Is it not?

@BYK
Copy link
Member

BYK commented Mar 14, 2025

Is it not?

Don't know? If it is, we should not have this issue shall we? At least that's what I get from the original issue report?

@aldy505
Copy link
Collaborator Author

aldy505 commented Mar 16, 2025

Ah we got this on CI

Found JS SDKs: v4.6.6, v5.30.0, v6.19.7, v7.120.3, v8.55.0
  curl: Error creating directory /var/www/js-sdk/4.6.6
  curl: (23) Failed writing received data to disk/application
  000 https://browser.sentry-cdn.com/4.6.6/bundle.min.js
  exit status 23
  find: /var/www/js-sdk: No such file or directory
  exit status 1
  fail 👎 with exit code 1

@@ -34,7 +34,12 @@ if [[ "${SETUP_JS_SDK_ASSETS:-}" == "1" ]]; then
variants="{bundle,bundle.tracing,bundle.tracing.replay,bundle.replay,bundle.tracing.replay.feedback,bundle.feedback}"

# Download those versions & variants using curl
$dcr --no-deps --rm -v "sentry-nginx-www:/var/www" nginx curl -w '%{response_code} %{url}\n' --no-progress-meter --compressed --retry 3 --create-dirs -fLo "/var/www/js-sdk/#1/#2.min.js" "https://browser.sentry-cdn.com/${versions}/${variants}.min.js" || true
$dcr --no-deps --rm -v "sentry-nginx-www:/var/www" --user=nginx nginx curl -w '%{response_code} %{url}\n' --no-progress-meter --compressed --retry 3 --create-dirs -fLo "/var/www/js-sdk/#1/#2.min.js" "https://browser.sentry-cdn.com/${versions}/${variants}.min.js" || true
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think of adding this prior to downloading files by nginx user?

$dcr --no-deps --rm -v "sentry-nginx-www:/var/www" nginx mkdir -p "/var/www/js-sdk/#1"

@aldy505
Copy link
Collaborator Author

aldy505 commented Mar 17, 2025

Okay just checked mine. It's owned by root, not nginx.

image

@aldy505
Copy link
Collaborator Author

aldy505 commented Mar 17, 2025

The release window is closing, let's just choose the easy route for now.

@aldy505 aldy505 requested review from BYK and aminvakil March 17, 2025 06:34
Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

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

Merging for the release, please let's revisit this immediately after and find a better solution.

@@ -27,14 +27,20 @@ if [[ "${SETUP_JS_SDK_ASSETS:-}" == "1" ]]; then
latest_js_v6=$(echo "$loader_registry" | $jq -r '.versions | reverse | map(select(.|any(.; startswith("6.")))) | .[0]')
latest_js_v7=$(echo "$loader_registry" | $jq -r '.versions | reverse | map(select(.|any(.; startswith("7.")))) | .[0]')
latest_js_v8=$(echo "$loader_registry" | $jq -r '.versions | reverse | map(select(.|any(.; startswith("8.")))) | .[0]')
latest_js_v9=$(echo "$loader_registry" | $jq -r '.versions | reverse | map(select(.|any(.; startswith("9.")))) | .[0]')
Copy link
Member

Choose a reason for hiding this comment

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

sneaky sneaky?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why not :D

Copy link
Member

Choose a reason for hiding this comment

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

well you just broke unit tests to start? :D

@BYK BYK enabled auto-merge (squash) March 17, 2025 14:39
auto-merge was automatically disabled March 17, 2025 14:46

Head branch was pushed to by a user without write access

@BYK BYK enabled auto-merge (squash) March 17, 2025 14:59
test "23" == "$non_empty_file_count"
echo "Pass"

# Files should be owned by the nginx user
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# Files should be owned by the nginx user
# Files should be owned by the root user

auto-merge was automatically disabled March 18, 2025 00:59

Head branch was pushed to by a user without write access

@aldy505
Copy link
Collaborator Author

aldy505 commented Mar 18, 2025

Since 25.3.0 is released and this is not merged yet. Let's think of a proper solution instead.

@BYK BYK merged commit d350bd4 into getsentry:master Mar 18, 2025
5 checks passed
@BYK
Copy link
Member

BYK commented Mar 18, 2025

@aldy505 still merged as it fixes a problem and adds a test for the issue. Trusting you to follow up with a better solution.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

SETUP_JS_SDK_ASSETS=1 wrong folder permissions
3 participants