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

Fix failure in package subcommand #1513

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Use `suppression_reason` instead of deprecated `suppressed` field

### Fixed

- Package subcommand failing to parse API responses

## 7.1.0 - 2024-09-24

### Added
Expand Down
27 changes: 11 additions & 16 deletions cli/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ pub struct RevokeTokenRequest<'a> {
pub name: &'a str,
}

#[derive(Serialize, Deserialize)]
pub struct PackageSpecifier {
#[serde(alias = "type")]
pub registry: String,
pub name: String,
pub version: String,
}

/// Response body for `/data/packages/submit`.
#[derive(Serialize, Deserialize)]
#[serde(tag = "status", content = "data")]
Expand All @@ -156,33 +164,19 @@ pub struct Package {
pub versions: Vec<ScoredVersion>,
pub description: Option<String>,
pub license: Option<String>,
pub dep_specs: Vec<PackageSpecifier>,
cd-work marked this conversation as resolved.
Show resolved Hide resolved
pub dependencies: Option<Vec<Package>>,
pub download_count: u32,
pub risk_scores: RiskScores,
pub total_risk_score_dynamics: Option<Vec<ScoreDynamicsPoint>>,
pub issues: Vec<Issue>,
pub authors: Vec<Author>,
pub developer_responsiveness: Option<DeveloperResponsiveness>,
pub complete: bool,
pub release_data: Option<PackageReleaseData>,
pub repo_url: Option<String>,
pub maintainers_recently_changed: Option<bool>,
pub is_abandonware: Option<bool>,
}

#[derive(Serialize, Deserialize)]
pub struct PackageSpecifier {
#[serde(alias = "type")]
pub registry: String,
pub name: String,
pub version: String,
}

#[derive(Serialize, Deserialize)]
pub struct ScoredVersion {
pub version: String,
pub total_risk_score: Option<f32>,
pub published_date: Option<String>,
}

/// Package risk scores, broken down by domain.
Expand Down Expand Up @@ -235,7 +229,7 @@ pub struct VulnDetails {
/// The CVSS score assigned to this vuln.
pub cvss: f32,
/// The CVSS vector string assigned to this vuln.
pub cvss_vector: String,
pub cvss_vector: Option<String>,
}

/// The user-specified reason for an issue to be ignored.
Expand Down Expand Up @@ -277,6 +271,7 @@ pub struct DeveloperResponsiveness {
pub struct PackageReleaseData {
pub first_release_date: String,
pub last_release_date: String,
pub total_releases: u32,
}

#[derive(Serialize, Deserialize, PartialEq, Eq, Copy, Clone, Debug, Hash)]
Expand Down
4 changes: 4 additions & 0 deletions extensions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Changed

- Return type fields of `PhylumApi::getPackageDetails`

## 7.0.0 - 2024-09-17

### Added
Expand Down
12 changes: 0 additions & 12 deletions extensions/phylum.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,7 @@ declare namespace Phylum {
* ],
* description: "TypeScript is a language for application scale JavaScript development",
* license: "Apache-2.0",
* depSpecs: [],
* dependencies: [],
* downloadCount: 134637844,
* riskScores: {
* total: 1,
* vulnerability: 1,
Expand All @@ -346,18 +344,8 @@ declare namespace Phylum {
* engineering: 1,
* license: 1
* },
* totalRiskScoreDynamics: null,
* issuesDetails: [],
* issues: [],
* authors: [],
* developerResponsiveness: {
* open_issue_count: 0,
* total_issue_count: 0,
* open_issue_avg_duration: null,
* open_pull_request_count: 0,
* total_pull_request_count: 0,
* open_pull_request_avg_duration: null
* },
* complete: true
* }
* ```
Expand Down