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

Examine unused hash property in Assets class. #1638

Open
samayer12 opened this issue Jan 7, 2025 · 2 comments · May be fixed by #1647
Open

Examine unused hash property in Assets class. #1638

samayer12 opened this issue Jan 7, 2025 · 2 comments · May be fixed by #1647

Comments

@samayer12
Copy link
Collaborator

Describe what should be investigated or refactored

The Assets class has a property, hash: string, and a setter (setHash()) that appear unused. Hashing for assets appears to be generated by a call to crypto.createHash("sha256").update(code).digest("hex") and then passed to relevant consumers.

We should examine if this hash property is truly necessary on the Assets class. If it is not, remove it. If it is, address the unused code.

Links to any relevant code

None.

Additional context

None.

@cmwylie19
Copy link
Collaborator

I could be wrong, but I thought that hash was used in the command section of the controller pods:

        - name: server
          image: ghcr.io/defenseunicorns/pepr/controller:v0.0.0-development
          imagePullPolicy: IfNotPresent
          command:
            - node
            - /app/node_modules/pepr/dist/controller.js
            - ea243bd3eab9e19651f4409b57f9cba2ff8f426d3df78207d96a2e85245ffb29 # Hash

@samayer12
Copy link
Collaborator Author

samayer12 commented Jan 7, 2025

Right, the controller uses the hash to perform checks (see controller.js), but the property on Assets isn't given a meaningful value.

In the Assets constructor, we actually initialize the hash to "" and never use the setHash() function.

The Assets.hash property is set in yaml.ts here, which doesn't treat the hash as a property on the object and is instead something derived from the object.

@samayer12 samayer12 linked a pull request Jan 10, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

2 participants