aboutcode-org / purldb

Tools to create and expose a database of purls (Package URLs). This project is sponsored by NLnet project https://nlnet.nl/project/vulnerabilitydatabase/ and nexB for https://www.aboutcode.org/ Chat is at https://gitter.im/aboutcode-org/discuss
https://purldb.readthedocs.io/
35 stars 23 forks source link

Add scanqueue status summary #488

Closed pombredanne closed 4 months ago

pombredanne commented 5 months ago

I would like to access a summary of the scanqueue:

This could be an API endpoint (and later a web UI?)

pombredanne commented 5 months ago

The results look like this:

{
  "total": 236374,
  "processables": 0,
  "scannables": 37341,
  "by_status": [
    {
      "scan_status": "new",
      "count": 37341
    },
    {
      "scan_status": "submitted",
      "count": 78
    },
    {
      "scan_status": "scanned",
      "count": 3
    },
    {
      "scan_status": "indexed",
      "count": 49256
    },
    {
      "scan_status": "failed",
      "count": 148946
    },
    {
      "scan_status": "scan index failed",
      "count": 750
    }
  ],
  "most_recent_submitted": [
    {
      "package_url": "pkg:maven/software.amazon.awssdk/rds@2.4.16",
      "download_url": "https://repo1.maven.org/maven2/software/amazon/awssdk/rds/2.4.16/rds-2.4.16.jar"
    },
    {
      "package_url": "pkg:maven/software.amazon.awssdk/rds@2.17.132",
      "download_url": "https://repo1.maven.org/maven2/software/amazon/awssdk/rds/2.17.132/rds-2.17.132.jar"
    },
    {
      "package_url": "pkg:maven/software.amazon.awssdk/rds@2.17.132?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/software/amazon/awssdk/rds/2.17.132/rds-2.17.132-sources.jar"
    },
    {
      "package_url": "pkg:npm/typescript@2.1.0-dev.20161010",
      "download_url": "https://registry.npmjs.org/typescript/-/typescript-2.1.0-dev.20161010.tgz"
    },
    {
      "package_url": "pkg:npm/typescript@2.1.0-dev.20161009",
      "download_url": "https://registry.npmjs.org/typescript/-/typescript-2.1.0-dev.20161009.tgz"
    },
    {
      "package_url": "pkg:npm/%40babel/plugin-proposal-decorators@7.22.6",
      "download_url": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.22.6.tgz"
    },
    {
      "package_url": "pkg:npm/typescript@1.9.0-dev.20160423",
      "download_url": "https://registry.npmjs.org/typescript/-/typescript-1.9.0-dev.20160423.tgz"
    },
    {
      "package_url": "pkg:npm/typescript@1.9.0-dev.20160422",
      "download_url": "https://registry.npmjs.org/typescript/-/typescript-1.9.0-dev.20160422.tgz"
    },
    {
      "package_url": "pkg:npm/alloy-ui@3.1.0-deprecated.58",
      "download_url": "https://registry.npmjs.org/alloy-ui/-/alloy-ui-3.1.0-deprecated.58.tgz"
    },
    {
      "package_url": "pkg:npm/%40clayui/css@3.76.0",
      "download_url": "https://registry.npmjs.org/@clayui/css/-/css-3.76.0.tgz"
    }
  ],
  "most_recent_indexed": [
    {
      "package_url": "pkg:maven/com.liferay/com.liferay.saml.admin.rest.impl@1.0.16?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/com/liferay/com.liferay.saml.admin.rest.impl/1.0.16/com.liferay.saml.admin.rest.impl-1.0.16-sources.jar"
    },
    {
      "package_url": "pkg:maven/com.liferay/com.liferay.saml.admin.rest.impl@1.0.16",
      "download_url": "https://repo1.maven.org/maven2/com/liferay/com.liferay.saml.admin.rest.impl/1.0.16/com.liferay.saml.admin.rest.impl-1.0.16.jar"
    },
    {
      "package_url": "pkg:maven/com.liferay/com.liferay.saml.admin.rest.impl@1.0.15?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/com/liferay/com.liferay.saml.admin.rest.impl/1.0.15/com.liferay.saml.admin.rest.impl-1.0.15-sources.jar"
    },
    {
      "package_url": "pkg:maven/com.liferay/com.liferay.saml.admin.rest.impl@1.0.15",
      "download_url": "https://repo1.maven.org/maven2/com/liferay/com.liferay.saml.admin.rest.impl/1.0.15/com.liferay.saml.admin.rest.impl-1.0.15.jar"
    },
    {
      "package_url": "pkg:maven/com.liferay/com.liferay.scim.rest.impl@1.0.8?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/com/liferay/com.liferay.scim.rest.impl/1.0.8/com.liferay.scim.rest.impl-1.0.8-sources.jar"
    },
    {
      "package_url": "pkg:maven/com.liferay/com.liferay.scim.rest.impl@1.0.8",
      "download_url": "https://repo1.maven.org/maven2/com/liferay/com.liferay.scim.rest.impl/1.0.8/com.liferay.scim.rest.impl-1.0.8.jar"
    },
    {
      "package_url": "pkg:maven/com.liferay/com.liferay.scim.rest.impl@1.0.7?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/com/liferay/com.liferay.scim.rest.impl/1.0.7/com.liferay.scim.rest.impl-1.0.7-sources.jar"
    },
    {
      "package_url": "pkg:maven/com.liferay/com.liferay.scim.rest.impl@1.0.7",
      "download_url": "https://repo1.maven.org/maven2/com/liferay/com.liferay.scim.rest.impl/1.0.7/com.liferay.scim.rest.impl-1.0.7.jar"
    },
    {
      "package_url": "pkg:maven/com.liferay/com.liferay.saml.admin.rest.impl@1.0.1?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/com/liferay/com.liferay.saml.admin.rest.impl/1.0.1/com.liferay.saml.admin.rest.impl-1.0.1-sources.jar"
    },
    {
      "package_url": "pkg:maven/com.liferay/com.liferay.saml.admin.rest.impl@1.0.1",
      "download_url": "https://repo1.maven.org/maven2/com/liferay/com.liferay.saml.admin.rest.impl/1.0.1/com.liferay.saml.admin.rest.impl-1.0.1.jar"
    }
  ],
  "most_recent_failed": [
    {
      "package_url": "pkg:maven/com.amazonaws/aws-java-sdk-bundle@1.11.271",
      "download_url": "https://repo1.maven.org/maven2/com/amazonaws/aws-java-sdk-bundle/1.11.271/aws-java-sdk-bundle-1.11.271.jar",
      "scan_error": null
    },
    {
      "package_url": "pkg:github/googleapis/google-cloud-java@grafeas-v2.6.0",
      "download_url": "https://github.com/googleapis/google-cloud-java/archive/refs/tags/grafeas-v2.6.0.zip",
      "scan_error": null
    },
    {
      "package_url": "pkg:github/azure/azure-sdk-for-java@azure-storage-queue_12.17.0",
      "download_url": "https://github.com/Azure/azure-sdk-for-java/archive/refs/tags/azure-storage-queue_12.17.0.zip",
      "scan_error": null
    },
    {
      "package_url": "pkg:github/azure/azure-sdk-for-java@azure-storage-internal-avro_12.6.0",
      "download_url": "https://github.com/Azure/azure-sdk-for-java/archive/refs/tags/azure-storage-internal-avro_12.6.0.zip",
      "scan_error": null
    },
    {
      "package_url": "pkg:github/azure/azure-sdk-for-java@azure-storage-common_12.21.0",
      "download_url": "https://github.com/Azure/azure-sdk-for-java/archive/refs/tags/azure-storage-common_12.21.0.zip",
      "scan_error": null
    },
    {
      "package_url": "pkg:github/azure/azure-sdk-for-java@azure-storage-common_12.20.0",
      "download_url": "https://github.com/Azure/azure-sdk-for-java/archive/refs/tags/azure-storage-common_12.20.0.zip",
      "scan_error": null
    },
    {
      "package_url": "pkg:github/azure/azure-sdk-for-java@azure-core-http-netty_1.13.0",
      "download_url": "https://github.com/Azure/azure-sdk-for-java/archive/refs/tags/azure-core-http-netty_1.13.0.zip",
      "scan_error": null
    },
    {
      "package_url": "pkg:npm/%40swc/core-linux-arm64-gnu@1.3.55",
      "download_url": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.55.tgz",
      "scan_error": null
    },
    {
      "package_url": "pkg:npm/%40swc/core-linux-x64-musl@1.3.57",
      "download_url": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.57.tgz",
      "scan_error": null
    },
    {
      "package_url": "pkg:npm/%40swc/core-linux-arm64-musl@1.3.57",
      "download_url": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.57.tgz",
      "scan_error": null
    }
  ],
  "most_recent_in_progress": [],
  "most_recent_completed": [
    {
      "package_url": "pkg:maven/com.amazonaws/aws-java-sdk-bundle@1.11.271?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/com/amazonaws/aws-java-sdk-bundle/1.11.271/aws-java-sdk-bundle-1.11.271-sources.jar"
    },
    {
      "package_url": "pkg:github/azuread/microsoft-authentication-extensions-for-java@1.1.0",
      "download_url": "https://github.com/AzureAD/microsoft-authentication-extensions-for-java/archive/refs/tags/1.1.0.zip"
    },
    {
      "package_url": "pkg:github/fsevents/fsevents@v1.2.7",
      "download_url": "https://github.com/fsevents/fsevents/archive/refs/tags/v1.2.7.tar.gz"
    }
  ],
  "most_recent_index_errors": [
    {
      "package_url": "pkg:npm/function-bind@1.1.2",
      "download_url": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
      "index_error": "Traceback (most recent call last):\n  File \"/app/minecode/management/commands/process_scans.py\", line 128, in process_scan\n    setattr(package, field, value)\nAttributeError: property 'declared_license_expression_spdx' of 'Package' object has no setter\n\n"
    },
    {
      "package_url": "pkg:maven/biz.aQute.bnd/biz.aQute.bnd@6.0.0",
      "download_url": "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/6.0.0/biz.aQute.bnd-6.0.0.jar",
      "index_error": "Traceback (most recent call last):\n  File \"/app/minecode/management/commands/process_scans.py\", line 128, in process_scan\n    setattr(package, field, value)\nAttributeError: property 'declared_license_expression_spdx' of 'Package' object has no setter\n\n"
    },
    {
      "package_url": "pkg:maven/software.amazon.awssdk/rds@2.9.12?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/software/amazon/awssdk/rds/2.9.12/rds-2.9.12-sources.jar",
      "index_error": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.11/site-packages/requests/models.py\", line 971, in json\n    return complexjson.loads(self.text, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.11/json/__init__.py\", line 346, in loads\n    return _default_decoder.decode(s)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.11/json/decoder.py\", line 337, in decode\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.11/json/decoder.py\", line 355, in raw_decode\n    raise JSONDecodeError(\"Expecting value\", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 153 column 1 (char 7759)\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/app/minecode/management/commands/process_scans.py\", line 79, in process_scan\n    scan_data = scanning.get_scan_data(\n                ^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/app/minecode/management/scanning.py\", line 340, in get_scan_data\n    results = _call_scan_get_api(\n              ^^^^^^^^^^^^^^^^^^^\n  File \"/app/minecode/management/scanning.py\", line 280, in _call_scan_get_api\n    return response.json()\n           ^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.11/site-packages/requests/models.py\", line 975, in json\n    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)\nrequests.exceptions.JSONDecodeError: Expecting value: line 153 column 1 (char 7759)\n\n"
    },
    {
      "package_url": "pkg:maven/biz.aQute.bnd/biz.aQute.bnd@6.0.0?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/6.0.0/biz.aQute.bnd-6.0.0-sources.jar",
      "index_error": "Traceback (most recent call last):\n  File \"/app/minecode/management/commands/process_scans.py\", line 128, in process_scan\n    setattr(package, field, value)\nAttributeError: can't set attribute\n\n"
    },
    {
      "package_url": "pkg:maven/biz.aQute.bnd/biz.aQute.bnd@5.3.0?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/5.3.0/biz.aQute.bnd-5.3.0-sources.jar",
      "index_error": "Traceback (most recent call last):\n  File \"/app/minecode/management/commands/process_scans.py\", line 128, in process_scan\n    setattr(package, field, value)\nAttributeError: can't set attribute\n\n"
    },
    {
      "package_url": "pkg:maven/biz.aQute.bnd/biz.aQute.bnd@5.3.0",
      "download_url": "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/5.3.0/biz.aQute.bnd-5.3.0.jar",
      "index_error": "Traceback (most recent call last):\n  File \"/app/minecode/management/commands/process_scans.py\", line 128, in process_scan\n    setattr(package, field, value)\nAttributeError: can't set attribute\n\n"
    },
    {
      "package_url": "pkg:maven/biz.aQute.bnd/biz.aQute.bnd@5.2.0?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/5.2.0/biz.aQute.bnd-5.2.0-sources.jar",
      "index_error": "Traceback (most recent call last):\n  File \"/app/minecode/management/commands/process_scans.py\", line 128, in process_scan\n    setattr(package, field, value)\nAttributeError: can't set attribute\n\n"
    },
    {
      "package_url": "pkg:maven/biz.aQute.bnd/biz.aQute.bnd@5.2.0",
      "download_url": "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/5.2.0/biz.aQute.bnd-5.2.0.jar",
      "index_error": "Traceback (most recent call last):\n  File \"/app/minecode/management/commands/process_scans.py\", line 128, in process_scan\n    setattr(package, field, value)\nAttributeError: can't set attribute\n\n"
    },
    {
      "package_url": "pkg:maven/biz.aQute.bnd/biz.aQute.bnd@5.1.2?classifier=sources",
      "download_url": "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/5.1.2/biz.aQute.bnd-5.1.2-sources.jar",
      "index_error": "Traceback (most recent call last):\n  File \"/app/minecode/management/commands/process_scans.py\", line 128, in process_scan\n    setattr(package, field, value)\nAttributeError: can't set attribute\n\n"
    },
    {
      "package_url": "pkg:maven/biz.aQute.bnd/biz.aQute.bnd@5.1.2",
      "download_url": "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/5.1.2/biz.aQute.bnd-5.1.2.jar",
      "index_error": "Traceback (most recent call last):\n  File \"/app/minecode/management/commands/process_scans.py\", line 128, in process_scan\n    setattr(package, field, value)\nAttributeError: can't set attribute\n\n"
    }
  ]
}
JonoYang commented 4 months ago

This has been added in #487