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

Integrate new cross-platform symbolicator #1800

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft

Conversation

detj
Copy link
Contributor

@detj detj commented Feb 11, 2025

Summary

This PR introduces a new cross-platform symbolicator service and replaces the old symbolication pipeline with a new one.

Tasks

  • Integrate new cross-platform symbolicator service
  • Make iOS symbolication work
  • Introduce binary_images for iOS exceptions
  • 📚 Update SDK API docs
    • Update exception event schema for iOS
    • Add binary_images section in event schema for iOS
  • Make event selection for symbolication platform specific
    • For iOS, select only exception events for symbolication
    • For Android, select exception, ANR and few other kind of events for symbolication
  • Retry symbolication requests with backoff
  • Handle different symbolication error cases
  • Add support for uploading multiple dSYM files for iOS
  • Make Android symbolication work
  • Implement TCP connection pooling for symbolication requests
  • Support dSYM writing in sessionator record command
  • Support multiple dSYM file uploads in sessionator record command
  • Remove iOS related fields in exception objects before writing JVM exceptions to ClickHouse
  • Implement a new symbolication batching pipeline
  • Write binary_images for iOS exceptions to ClickHouse
  • Create a iOS system framework(s) uploader system
  • Verify exception fingerprinting logic for iOS
  • Parse and show iOS exceptions on dashboard webapp
  • Configure & tweak Symbolicator's configuration
    • Figure out caching settings
    • Figure out default sources
    • Figure out other settings, like scopes
  • Finish up object up & down migration
  • Create multi-platform docker image of Symbolicator

See also

detj added 10 commits October 11, 2024 10:06
- add a new migrator service
- setup a common migration infrastructure for migrating objects
- add a journal component to keep track of migrations

Signed-off-by: detj <[email protected]>
- modify builds api to process ios build mapping files
- support both ios and android platform

Signed-off-by: detj <[email protected]>
- add tests for dsym debug information file processing

Signed-off-by: detj <[email protected]>
- integrate symbolicator service
- figure out iOS symbolication
- update sdk api docs

fixes #1320

Signed-off-by: detj <[email protected]>
@detj detj added feature new features backend backend related labels Feb 11, 2025
@detj detj self-assigned this Feb 11, 2025
Copy link

vercel bot commented Feb 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
measure-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 24, 2025 3:13pm

@detj detj marked this pull request as draft February 11, 2025 11:57
return
}

fmt.Println("sources:", string(sources))

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by an access to SecretKey
flows to a logging call.
Sensitive data returned by an access to secretKey
flows to a logging call.

Copilot Autofix AI 18 days ago

The best way to fix the problem is to avoid logging sensitive information such as SecretKey and AccessKey. Instead, we can log a message indicating that the sources were processed without including the sensitive details. This can be achieved by removing the logging of the sources variable and replacing it with a more generic log message.

To implement the changes, we need to modify the makeRequest method in the backend/api/symbolicator/symbolicator.go file. Specifically, we will remove the line that logs the sources variable and replace it with a more generic log message.

Suggested changeset 1
backend/api/symbolicator/symbolicator.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/backend/api/symbolicator/symbolicator.go b/backend/api/symbolicator/symbolicator.go
--- a/backend/api/symbolicator/symbolicator.go
+++ b/backend/api/symbolicator/symbolicator.go
@@ -59,3 +59,3 @@
 
-		fmt.Println("sources:", string(sources))
+		fmt.Println("sources processed successfully")
 	}
EOF
@@ -59,3 +59,3 @@

fmt.Println("sources:", string(sources))
fmt.Println("sources processed successfully")
}
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
- add support for uploading multiple mapping files for iOS dSYM files

Signed-off-by: detj <[email protected]>
code = http.StatusBadRequest
maxSize := int64(server.Server.Config.MappingFileMaxSize)

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
detj added 2 commits February 24, 2025 05:17
- update sessionator record command to support uploading multiple
mapping files
- fix an issue where mapping type was not being read properly
- fix an issue where optional build size was not being written properly

Signed-off-by: detj <[email protected]>
}

mappingFilePath := filepath.Join(outputDir, appUniqueID, versionName, versionCode, filename)
if err := os.MkdirAll(filepath.Dir(mappingFilePath), 0755); err != nil {

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.

Copilot Autofix AI 5 days ago

To fix the problem, we need to validate the appUniqueID, versionName, and versionCode values to ensure they do not contain any path traversal characters or sequences. This can be done by checking for the presence of path separators ("/" or "\") and ".." sequences, and rejecting the input if any are found. Additionally, we should ensure that the resolved path is within a specific safe directory.

Suggested changeset 1
self-host/sessionator/cmd/record.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/self-host/sessionator/cmd/record.go b/self-host/sessionator/cmd/record.go
--- a/self-host/sessionator/cmd/record.go
+++ b/self-host/sessionator/cmd/record.go
@@ -307,2 +307,22 @@
 
+	// Validate inputs to prevent path traversal
+	if strings.Contains(appUniqueID, "/") || strings.Contains(appUniqueID, "\\") || strings.Contains(appUniqueID, "..") {
+		c.JSON(http.StatusBadRequest, gin.H{
+			"error": "Invalid app_unique_id",
+		})
+		return
+	}
+	if strings.Contains(versionName, "/") || strings.Contains(versionName, "\\") || strings.Contains(versionName, "..") {
+		c.JSON(http.StatusBadRequest, gin.H{
+			"error": "Invalid version_name",
+		})
+		return
+	}
+	if strings.Contains(versionCode, "/") || strings.Contains(versionCode, "\\") || strings.Contains(versionCode, "..") {
+		c.JSON(http.StatusBadRequest, gin.H{
+			"error": "Invalid version_code",
+		})
+		return
+	}
+
 	if appUniqueID == "" {
@@ -375,3 +395,10 @@
 		mappingFilePath := filepath.Join(outputDir, appUniqueID, versionName, versionCode, filename)
-		if err := os.MkdirAll(filepath.Dir(mappingFilePath), 0755); err != nil {
+		absMappingFilePath, err := filepath.Abs(mappingFilePath)
+		if err != nil || !strings.HasPrefix(absMappingFilePath, outputDir) {
+			c.JSON(http.StatusBadRequest, gin.H{
+				"error": "Invalid file path",
+			})
+			return
+		}
+		if err := os.MkdirAll(filepath.Dir(absMappingFilePath), 0755); err != nil {
 			c.JSON(http.StatusInternalServerError, gin.H{
EOF
@@ -307,2 +307,22 @@

// Validate inputs to prevent path traversal
if strings.Contains(appUniqueID, "/") || strings.Contains(appUniqueID, "\\") || strings.Contains(appUniqueID, "..") {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid app_unique_id",
})
return
}
if strings.Contains(versionName, "/") || strings.Contains(versionName, "\\") || strings.Contains(versionName, "..") {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid version_name",
})
return
}
if strings.Contains(versionCode, "/") || strings.Contains(versionCode, "\\") || strings.Contains(versionCode, "..") {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid version_code",
})
return
}

if appUniqueID == "" {
@@ -375,3 +395,10 @@
mappingFilePath := filepath.Join(outputDir, appUniqueID, versionName, versionCode, filename)
if err := os.MkdirAll(filepath.Dir(mappingFilePath), 0755); err != nil {
absMappingFilePath, err := filepath.Abs(mappingFilePath)
if err != nil || !strings.HasPrefix(absMappingFilePath, outputDir) {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid file path",
})
return
}
if err := os.MkdirAll(filepath.Dir(absMappingFilePath), 0755); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
defer enc.Close()
_, err = io.Copy(enc, file)

out, err := os.Create(mappingFilePath)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.

Copilot Autofix AI 5 days ago

To fix the problem, we need to validate the user input before using it to construct the file path. Specifically, we should ensure that the appUniqueID, versionName, and versionCode values do not contain any path separators or ".." sequences. This can be done by checking for the presence of these characters and rejecting the input if any are found.

Suggested changeset 1
self-host/sessionator/cmd/record.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/self-host/sessionator/cmd/record.go b/self-host/sessionator/cmd/record.go
--- a/self-host/sessionator/cmd/record.go
+++ b/self-host/sessionator/cmd/record.go
@@ -303,4 +303,22 @@
 	appUniqueID := c.Request.FormValue("app_unique_id")
+	if strings.Contains(appUniqueID, "/") || strings.Contains(appUniqueID, "\\") || strings.Contains(appUniqueID, "..") {
+		c.JSON(http.StatusBadRequest, gin.H{
+			"error": "Invalid app_unique_id",
+		})
+		return
+	}
 	versionName := c.Request.FormValue("version_name")
+	if strings.Contains(versionName, "/") || strings.Contains(versionName, "\\") || strings.Contains(versionName, "..") {
+		c.JSON(http.StatusBadRequest, gin.H{
+			"error": "Invalid version_name",
+		})
+		return
+	}
 	versionCode := c.Request.FormValue("version_code")
+	if strings.Contains(versionCode, "/") || strings.Contains(versionCode, "\\") || strings.Contains(versionCode, "..") {
+		c.JSON(http.StatusBadRequest, gin.H{
+			"error": "Invalid version_code",
+		})
+		return
+	}
 	mappingType := c.Request.FormValue("mapping_type")
EOF
@@ -303,4 +303,22 @@
appUniqueID := c.Request.FormValue("app_unique_id")
if strings.Contains(appUniqueID, "/") || strings.Contains(appUniqueID, "\\") || strings.Contains(appUniqueID, "..") {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid app_unique_id",
})
return
}
versionName := c.Request.FormValue("version_name")
if strings.Contains(versionName, "/") || strings.Contains(versionName, "\\") || strings.Contains(versionName, "..") {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid version_name",
})
return
}
versionCode := c.Request.FormValue("version_code")
if strings.Contains(versionCode, "/") || strings.Contains(versionCode, "\\") || strings.Contains(versionCode, "..") {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid version_code",
})
return
}
mappingType := c.Request.FormValue("mapping_type")
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
buildFilePath := filepath.Join(outputDir, appUniqueID, versionName, "build.toml")
out, err = os.Create(buildFilePath)
buildFilePath := filepath.Join(outputDir, appUniqueID, versionName, versionCode, "build.toml")
if err := os.MkdirAll(filepath.Dir(buildFilePath), 0755); err != nil {

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.

Copilot Autofix AI 5 days ago

To fix the problem, we need to ensure that the user-provided appUniqueID is validated before being used to construct file paths. We can achieve this by checking that the appUniqueID does not contain any path separators or parent directory references. Additionally, we should ensure that the resolved path is within a specific safe directory.

  1. Validate the appUniqueID to ensure it does not contain any path separators or parent directory references.
  2. Ensure that the resolved path is within a specific safe directory.
Suggested changeset 1
self-host/sessionator/cmd/record.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/self-host/sessionator/cmd/record.go b/self-host/sessionator/cmd/record.go
--- a/self-host/sessionator/cmd/record.go
+++ b/self-host/sessionator/cmd/record.go
@@ -303,2 +303,8 @@
 	appUniqueID := c.Request.FormValue("app_unique_id")
+	if strings.Contains(appUniqueID, "/") || strings.Contains(appUniqueID, "\\") || strings.Contains(appUniqueID, "..") {
+		c.JSON(http.StatusBadRequest, gin.H{
+			"error": "Invalid app_unique_id",
+		})
+		return
+	}
 	versionName := c.Request.FormValue("version_name")
@@ -412,3 +418,10 @@
 	buildFilePath := filepath.Join(outputDir, appUniqueID, versionName, versionCode, "build.toml")
-	if err := os.MkdirAll(filepath.Dir(buildFilePath), 0755); err != nil {
+	absBuildFilePath, err := filepath.Abs(buildFilePath)
+	if err != nil || !strings.HasPrefix(absBuildFilePath, outputDir) {
+		c.JSON(http.StatusBadRequest, gin.H{
+			"error": "Invalid build file path",
+		})
+		return
+	}
+	if err := os.MkdirAll(filepath.Dir(absBuildFilePath), 0755); err != nil {
 		c.JSON(http.StatusInternalServerError, gin.H{
EOF
@@ -303,2 +303,8 @@
appUniqueID := c.Request.FormValue("app_unique_id")
if strings.Contains(appUniqueID, "/") || strings.Contains(appUniqueID, "\\") || strings.Contains(appUniqueID, "..") {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid app_unique_id",
})
return
}
versionName := c.Request.FormValue("version_name")
@@ -412,3 +418,10 @@
buildFilePath := filepath.Join(outputDir, appUniqueID, versionName, versionCode, "build.toml")
if err := os.MkdirAll(filepath.Dir(buildFilePath), 0755); err != nil {
absBuildFilePath, err := filepath.Abs(buildFilePath)
if err != nil || !strings.HasPrefix(absBuildFilePath, outputDir) {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid build file path",
})
return
}
if err := os.MkdirAll(filepath.Dir(absBuildFilePath), 0755); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
})
return
}
out, err := os.Create(buildFilePath)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.

Copilot Autofix AI 5 days ago

To fix the problem, we need to validate the user input before using it to construct a file path. Specifically, we should ensure that the appUniqueID does not contain any path separators or parent directory references. This can be done by checking for the presence of "/" or "\" characters and ".." sequences in the appUniqueID value. If any of these are found, we should reject the input and return an error response.

Suggested changeset 1
self-host/sessionator/cmd/record.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/self-host/sessionator/cmd/record.go b/self-host/sessionator/cmd/record.go
--- a/self-host/sessionator/cmd/record.go
+++ b/self-host/sessionator/cmd/record.go
@@ -313,2 +313,9 @@
 	}
+	// Validate appUniqueID to ensure it does not contain any path separators or parent directory references
+	if strings.Contains(appUniqueID, "/") || strings.Contains(appUniqueID, "\\") || strings.Contains(appUniqueID, "..") {
+		c.JSON(http.StatusBadRequest, gin.H{
+			"error": "Invalid app_unique_id",
+		})
+		return
+	}
 	if versionName == "" {
EOF
@@ -313,2 +313,9 @@
}
// Validate appUniqueID to ensure it does not contain any path separators or parent directory references
if strings.Contains(appUniqueID, "/") || strings.Contains(appUniqueID, "\\") || strings.Contains(appUniqueID, "..") {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid app_unique_id",
})
return
}
if versionName == "" {
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
- add environment variable for symbolicator origin in server config

Signed-off-by: detj <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend backend related feature new features
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Integrate new cross-platform Symbolicator
1 participant