LabelSearchIssues returns the IFC label for a multi-repository search result, joining per-repository labels across all matched repositories. Used by both search_issues and search_repositories. Public-only results are untrusted and public. All-private results are trusted and private because private
(repoVisibilities []bool)
| 133 | // until then they would invite unsafe declassification of a "public" item that |
| 134 | // actually arrived alongside private data. |
| 135 | func LabelSearchIssues(repoVisibilities []bool) SecurityLabel { |
| 136 | var anyPrivate, anyPublic bool |
| 137 | for _, isPrivate := range repoVisibilities { |
| 138 | if isPrivate { |
| 139 | anyPrivate = true |
| 140 | } else { |
| 141 | anyPublic = true |
| 142 | } |
| 143 | } |
| 144 | switch { |
| 145 | case anyPrivate && anyPublic: |
| 146 | return PrivateUntrusted() |
| 147 | case anyPrivate: |
| 148 | return PrivateTrusted() |
| 149 | default: |
| 150 | return PublicUntrusted() |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | // LabelRepoMetadata returns the IFC label for structural repository metadata |
| 155 | // that only collaborators with write access can define: labels, branches, |