Skip to content

Commit c029a41

Browse files
ryanlinkryan linkzlav
authored
Fix SBOM team permission handling (#1499)
* Fix SBOM team permission handling - Include team information in SBOM analyze metadata - Add test coverage for team-scoped permissions - Update documentation to clarify team permission behavior This change allows users with team-scoped permissions to use fossa sbom analyze --team when they are members of the specified team, matching the behavior of fossa analyze --team. * delete test file because this is technically already tested * add changelog --------- Co-authored-by: ryan link <[email protected]> Co-authored-by: Zachary LaVallee <[email protected]>
1 parent dee2229 commit c029a41

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Changelog.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# FOSSA CLI Changelog
22

3+
## 3.9.45
4+
- Preflight: Fix a bug where the preflight checks fail for SBOM team analysis ([#1499](https://github.com/fossas/fossa-cli/pull/1499))
5+
36
## 3.9.44
47
- Preflight: Fix a bug where the preflight check could fail if you ran fossa multiple times simultaneously ([#1498](https://github.com/fossas/fossa-cli/pull/1498))
58

docs/references/subcommands/sbom.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ In addition to the [usual FOSSA project flags](#common-fossa-project-flags) supp
2323

2424
| Name | Short | Description |
2525
| ------------------------------------- | ----- | ----------------------------------------------------------------------------------- |
26-
| `--team 'team name'` | `-T` | Specify a team within your FOSSA organization |
26+
| `--team 'team name'` | `-T` | Specify a team within your FOSSA organization. If you only have team-scoped permissions, you must specify a team of which you are a member. |
2727
| `--force-rescan` | | Force the SBOM file to be rescanned, even if this exact revision has been previously uploaded |
2828

29+
### Team Permissions
30+
31+
When using `fossa sbom analyze`, the command respects team-scoped permissions:
32+
- If you have organization-wide permissions, you can upload SBOMs without specifying a team
33+
- If you only have team-scoped permissions, you must use the `--team` flag to specify a team of which you are a member
34+
- The behavior matches that of `fossa analyze --team`
35+
2936
## `fossa sbom test <path to sbom file>`
3037

3138
The `sbom test` command checks whether the most-recent scan of your FOSSA project raised license-policy or vulnerability issues. This command is usually run immediately after `fossa sbom analyze`.

src/App/Fossa/SBOM/Analyze.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ analyze ::
3434
SBOMAnalyzeConfig ->
3535
m ()
3636
analyze config = do
37-
let emptyMetadata = ProjectMetadata Nothing Nothing Nothing Nothing Nothing Nothing [] Nothing
37+
let metadata = ProjectMetadata Nothing Nothing Nothing Nothing (sbomTeam config) Nothing [] Nothing
3838
let apiOpts = sbomApiOpts config
3939
trackUsage SBOMAnalyzeUsage
40-
void . runFossaApiClient apiOpts . preflightChecks $ AnalyzeChecks (sbomRevision config) emptyMetadata
40+
void . runFossaApiClient apiOpts . preflightChecks $ AnalyzeChecks (sbomRevision config) metadata
4141
runFossaApiClient apiOpts . runStickyLogger (severity config) $ analyzeInternal config
4242

4343
analyzeInternal ::

0 commit comments

Comments
 (0)