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

some staticExecs should check the exit code #201

Open
ee7 opened this issue Feb 9, 2024 · 0 comments
Open

some staticExecs should check the exit code #201

ee7 opened this issue Feb 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ee7
Copy link
Contributor

ee7 commented Feb 9, 2024

Example

  1. Download a source archive for chalk
  2. Extract it
  3. cd to the extracted location
  4. Run nimble build

This is relevant for packaging chalk - see https://github.com/crashappsec/internal_tickets/issues/138.

Expected behavior

The build succeeds, and chalk is fully functional. In particular, a chalk insert should insert a chalk mark that contains the git commit ref from which chalk was built, like:

"COMMIT_ID": "e50885d33aa5e66fc75cb8e8f133c2159c6d052a",

Observed behavior

The build succeeds, but then a chalk insert inserts a chalk mark with a bad COMMIT_ID value, which contains an error message instead of a commit ref.

The chalk version output has the same issue:

$ chalk version | grep commit
 ┊ Commit ID      ┊ fatal: not a git repository [etc]    ┊

Diagnosis

We have some staticExec that silently use the command's output even when the command indicates an error:

chalk/src/chalk_common.nim

Lines 362 to 364 in cf9ebf8

commitID* = staticexec("git rev-parse HEAD")
archStr* = staticexec("uname -m")
osStr* = staticexec("uname -o")

attestationObfuscator = staticExec(
"dd status=none if=/dev/random bs=1 count=16 | base64").decode()

These should use gorgeEx, or some wrapper around that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant