Skip to content

add thesis depth map application#117

Open
gknapp1 wants to merge 14 commits intomainfrom
thesis-depth-map
Open

add thesis depth map application#117
gknapp1 wants to merge 14 commits intomainfrom
thesis-depth-map

Conversation

@gknapp1
Copy link
Collaborator

@gknapp1 gknapp1 commented Aug 11, 2025

Adds a new type of simulation that produces a map of the melt pool depth as a function of XY location in a layer. Implements a 3DThesis application for the simulation type.

This is different than the existing melt_pool_geometry_part, which outputs melt pool geometry as a time series.

This pull request adds:

  • thesis/depth_map_part simulation tool and template
  • moving some thesis functionality to top-level myna.application.thesis module
  • FileDpethMap output file type
  • ComponentDepthMapPart component class
  • Example for the depth_map_part simulation
  • Test for the depth_map_part simulation configuration and running

The output data from the example, at a higher resolution of 25e-6 m for visual clarity, is plotted below.

image

@gknapp1 gknapp1 added the enhancement New feature or request label Aug 11, 2025
@gknapp1 gknapp1 marked this pull request as ready for review September 12, 2025 20:35
@gknapp1 gknapp1 self-assigned this Sep 12, 2025
@gknapp1 gknapp1 requested a review from streeve October 22, 2025 18:20
@gknapp1 gknapp1 removed the request for review from streeve February 24, 2026 22:20
@gknapp1
Copy link
Collaborator Author

gknapp1 commented Feb 25, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new simulation type, depth_map_part, to calculate the melt pool depth as a function of XY location in a layer using 3DThesis, integrating new application logic, configuration, execution, and post-processing files. However, a security audit identified three critical vulnerabilities related to path traversal and arbitrary file copy. These stem from improper handling of user-supplied input from configuration files, which could allow an attacker to read or write arbitrary files on the system.

Comment on lines +32 to +48
dir_parts = os.path.dirname(mynafile).split(os.path.sep)
case_dict = {
"build": dir_parts[-4],
"part": dir_parts[-3],
"layer": dir_parts[-2],
"case_dir": os.path.dirname(mynafile),
"mynafile": mynafile,
}
return case_dict

def configure_case(self, myna_file):
"""Configure a valid 3DThesis case from Myna data"""
# Load case information
case_info = self.parse_mynafile_path_to_dict(myna_file)

# Copy template case
self.copy(case_info["case_dir"])
Copy link
Contributor

Choose a reason for hiding this comment

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

security-high high

A path traversal vulnerability exists in the configure_case method. The mynafile path, derived from user-controlled settings, is used to construct the case_dir path without proper sanitization. This allows an attacker to use ../ sequences to traverse the file system and perform file operations (like self.copy) outside of the intended directory, leading to arbitrary file writes and information disclosure. Additionally, the parse_mynafile_path_to_dict function assumes a specific directory structure; robust validation is needed to prevent errors and mitigate this vulnerability.

@gknapp1 gknapp1 requested a review from streeve as a code owner March 4, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant