Reverse conversion of metadata mode is broken
- Dominant language
- Go
- Stars
- 9.6k
- Forks
- 954
- Avg merge
- 23h 27m
- Merged PRs (30d)
- 48
Description
**What happened**:
Syft generate sbom for type `files.metadata.mode` more than int32. `fs.ModeDir` by default equal "20000000000"
https://github.com/anchore/syft/blob/1bec1fc5d397d7f31db29378158f55da71c56747/syft/format/syftjson/to_format_model.go#L155
But reverse conversion just reset to zero all files with type "Directory":
https://github.com/anchore/syft/blob/1bec1fc5d397d7f31db29378158f55da71c56747/syft/format/syftjson/to_syft_model.go#L139-L141
**What you expected to happen**:
Syft should convert correctly files.metadata.mode (example: "20000000777") instead of just equating to 0
**Environment**:
- Output of `syft version`:
Application: syft
Version: 1.4.1
BuildDate: 2024-05-09T19:45:46Z
GitCommit: c200896a9644f9b6bd4bc3785c848276c33bb53c
GitDescription: v1.4.1
Platform: darwin/amd64
GoVersion: go1.21.9
Compiler: gc
- OS (e.g: `cat /etc/os-release` or similar): macOS 14.4.1
Contributor guide
Research direction
Start in syft/format/syftjson/to_format_model.go around line 155 and syft/format/syftjson/to_syft_model.go around lines 139-141. Trace how files.metadata.mode is serialized and reverse-converted, then verify that a directory mode such as "20000000777" survives the round trip instead of becoming zero.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100