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

flux build/diff: fs-security-constraint error #2785

Closed
1 task done
Thaval opened this issue May 30, 2022 · 18 comments · Fixed by #3317
Closed
1 task done

flux build/diff: fs-security-constraint error #2785

Thaval opened this issue May 30, 2022 · 18 comments · Fixed by #3317
Assignees
Labels
area/diff Diff related issues and pull requests bug Something isn't working

Comments

@Thaval
Copy link

Thaval commented May 30, 2022

Describe the bug

When running flux build ..., an error is shown that indicates security issue. For example:

flux build kustomization my-app --path ./corpsol --kustomization-file ./corpsol/kustomization.yaml

will display the following error

✗ kustomize build failed: fs-security-constraint abs ./corpsol: path './corpsol' is not in or below 'C:\'

The kustomization.yaml looks like this

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- helm-release.yaml
- ../../../../.common/helm_templates/flux_manifests/alert.yaml

Steps to reproduce

  • Install Flux
  • Run flux build kustomization my-app --path ./corpsol --kustomization-file ./corpsol/kustomization.yaml
  • See the error - fs-security-constraint (no files are built)

Expected behavior

The kustomization should be built successfully, so that a preview is shown.

Screenshots and recordings

No response

OS / Distro

Windows 10

Flux version

v0.30.2

Flux check

flux check
► checking prerequisites
✔ Kubernetes 1.22.6 >=1.20.6-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.21.0
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.25.0
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.23.5
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.24.4
✔ all checks passed

Git provider

No response

Container Registry provider

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@stefanprodan stefanprodan added bug Something isn't working area/diff Diff related issues and pull requests labels May 30, 2022
@stefanprodan stefanprodan changed the title Cannot run "flux build ..." flux build/diff: fs-security-constraint error May 30, 2022
@souleb souleb self-assigned this Jun 1, 2022
@souleb
Copy link
Member

souleb commented Jun 1, 2022

@Thaval can we get the root of ./corpsol?

@Thaval
Copy link
Author

Thaval commented Jun 1, 2022

@souleb What do you mean: The files and contents or the absolute path of ./corpsol?

@hiddeco
Copy link
Member

hiddeco commented Jun 1, 2022

The absolute path of ./corpsol.

@Thaval
Copy link
Author

Thaval commented Jun 1, 2022

@hiddeco @souleb The absolute path is C:\Users\dave\source\repos\infra\clusters\apps\domains\corpsol

@Thaval
Copy link
Author

Thaval commented Sep 26, 2022

What's the current state?

@souleb
Copy link
Member

souleb commented Sep 26, 2022

Hello There. I felt behind, but I still plan to fix this.

@Thaval
Copy link
Author

Thaval commented Sep 28, 2022

Alright, thanks! :) Could you reproduce this? Let me know if you need more information.

@4c74356b41
Copy link

4c74356b41 commented Oct 19, 2022

getting the same error for flux diff:

✗ kustomize build failed: must build at directory: not a valid directory: fs-security-constraint abs C:\flux-fleet\clusters\prd: path 'C:\flux-fleet\clusters\prd' is not in or below 'C:\'

same error for any kustomizations (I only use flux ones, not kustomize ones)\path combo

@stefanprodan
Copy link
Member

Fixing this on Windows is not going to be easy as none of the Flux maintainers use MSFT products. I suggest installing the Flux CLI on Windows Subsystem for Linux which has no issues.

@4c74356b41
Copy link

can you, perhaps, point me to the code that is throwing? I'm willing to try, however I'm not really good with go :(

@stefanprodan
Copy link
Member

The error comes from our own filesystem implementation https://github.com/fluxcd/pkg/blob/main/kustomize/filesys/fs_secure.go

@4c74356b41
Copy link

thanks, i'll try looking at it, but at a glance it doesn't look like something I'll be able to figure out xD

@Thaval
Copy link
Author

Thaval commented Oct 19, 2022

@stefanprodan Ok, understand this. Totally new to golang, but I only use Windows. However, is there a guide on how to kickstart flux development? Would like to know how to run the code and test changes.

Just a note for myself:
#2764

@souleb
Copy link
Member

souleb commented Nov 15, 2022

@Thaval can you try with this pull request: #3317?

@Thaval
Copy link
Author

Thaval commented Nov 15, 2022

@Thaval can you try with this pull request: #3317?

Sure I can. But I need to figure out how to run the commands or better said, build and use the project.

@souleb
Copy link
Member

souleb commented Nov 16, 2022

> ~ make build-dev                                                                                         10:14:28
⋊> ~ ./bin/flux diff kustomization ...

@4c74356b41
Copy link

4c74356b41 commented Nov 16, 2022

this doesnt build a binary for windows? at least for me.

i think this works to build for windows: export GOOS=windows

@4c74356b41
Copy link

4c74356b41 commented Nov 16, 2022

okay, with this build it is actually working! sweeeet.

.\flux.exe diff kustomization --path C:\_git\xxx\infrastructure\core\ cluster-base
✓  Kustomization diffing...
► Namespace/yyy drifted

metadata.labels
  + one map entry added:
    test: test

⚠️ identified at least one change, exiting with non-zero exit code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/diff Diff related issues and pull requests bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants