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

feat: Support spaces in bom author/vendor and cmd exec inside lxc. #487

Merged
merged 3 commits into from Aug 22, 2023

Conversation

smoser
Copy link
Contributor

@smoser smoser commented Aug 22, 2023

  • refactor: Bind stacker binary into container in SetupBuildContainerConfig

    Previously there were 3 individual calls to bind stacker into
    tools/static-stacker. This just changes that to 1 place, so
    after calling SetupBuildContainerConfig you can use stacker inside.

  • test: Change bom test to contain spaces

    The bom test case previously had Author of 'bom-test',
    which was not realiastic and was intentional to avoid
    exposing the bug with spaces.

  • fix: Use arrays for execution rather than scalar string.

    This changes the interface for container.Execute to be an
    array of strings rather than a string, and then changes
    the internal lxc-wrapper pass arguments provided to it
    through to the lxc 'start' api call.

    It ultimately allows us to safely call programs with spaces,
    quotes or other "odd" characters without first serializing
    them in go and relying on lxc start api call to unserialize
    them properly. lxc.start would ultimately end up just
    split the lxc.execute.cmd on spaces.

What type of PR is this?

Which issue does this PR fix:

What does this PR do / Why do we need it:

If an issue # is not available please add repro steps and logs showing the issue:

Testing done on this change:

Automation added to e2e:

Will this break upgrades or downgrades?

Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

pkg/stacker/bom.go Outdated Show resolved Hide resolved
This changes the interface for container.Execute to be an
array of strings rather than a string, and then changes
the internal lxc-wrapper pass arguments provided to it
through to the lxc 'start' api call.

It ultimately allows us to safely call programs with spaces,
quotes or other "odd" characters without first serializing
them in go and relying on lxc start api call to unserialize
them properly.  lxc.start would ultimately end up just
split the lxc.execute.cmd on spaces.

Signed-off-by: Scott Moser <smoser@brickies.net>
The bom test case previously had Author of 'bom-test',
which was not realiastic and was intentional to avoid
exposing the bug with spaces.

Signed-off-by: Scott Moser <smoser@brickies.net>
…nfig

Previously there were 3 individual calls to bind stacker into
tools/static-stacker.  This just changes that to 1 place, so
after calling SetupBuildContainerConfig you can use stacker inside.

Signed-off-by: Scott Moser <smoser@brickies.net>
@smoser smoser merged commit fae3417 into project-stacker:main Aug 22, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants