Skip to content
Open
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: 3 additions & 1 deletion app/Commands/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public function handle() : int

$coordinates = $parser->getCoordinates($packages);

$ossindex = new OSSIndex();
// Bit odd but a way of getting the package version and sending it to the class without
// it knowing too much about Laravel-Zero
$ossindex = new OSSIndex(null, config('app.version'));

$response = $ossindex->getVulns($coordinates);

Expand Down
6 changes: 5 additions & 1 deletion app/OSSIndex/OSSIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ class OSSIndex
* @param Client|null $client
*/
public function __construct(
$client = null
$client = null,
$version = "not-set"
) {
if ($client == null) {
$this->client = new Client(
['base_uri' => 'https://ossindex.sonatype.org/api/',
'timeout' => 100.0,
'headers' => [
'User-Agent' => "bach-client/{$version}"
],
]
);
} else {
Expand Down