Ejemplo n.º 1
0
def view_proposals(vendor: str = None, profile: str = None):
    entries = db.session.query(Vulnerability, Nvd)
    entries = entries.filter(Vulnerability.creator == g.user)
    entries = entries.outerjoin(Vulnerability,
                                Nvd.cve_id == Vulnerability.cve_id)
    entries = entries.order_by(desc(Nvd.id))

    bookmarked_page = parse_pagination_param("proposal_p")
    per_page = 10
    entries_non_processed = entries.filter(~Vulnerability.state.in_(
        [VulnerabilityState.ARCHIVED, VulnerabilityState.PUBLISHED]))
    entries_full = entries_non_processed.options(default_nvd_view_options)
    proposal_vulns = get_page(entries_full, per_page, page=bookmarked_page)
    proposal_vulns = VulnViewTypesetPaginationObjectWrapper(
        proposal_vulns.paging)

    entries_processed = entries.filter(
        Vulnerability.state.in_(
            [VulnerabilityState.ARCHIVED, VulnerabilityState.PUBLISHED]))
    bookmarked_page_processed = parse_pagination_param("proposal_processed_p")
    entries_processed_full = entries_processed.options(
        default_nvd_view_options)
    proposal_vulns_processed = get_page(entries_processed_full,
                                        per_page,
                                        page=bookmarked_page_processed)
    proposal_vulns_processed = VulnViewTypesetPaginationObjectWrapper(
        proposal_vulns_processed.paging)

    return render_template(
        "profile/proposals_view.html",
        proposal_vulns=proposal_vulns,
        proposal_vulns_processed=proposal_vulns_processed,
    )
Ejemplo n.º 2
0
def product_view(vendor: str = None, product: str = None):
    sub_query = db.session.query(Cpe.nvd_json_id).filter(
        and_(Cpe.vendor == vendor, Cpe.product == product)).distinct()
    number_vulns = sub_query.count()

    entries = db.session.query(Vulnerability, Nvd)
    entries = entries.filter(Nvd.id.in_(sub_query)).with_labels()
    entries = entries.outerjoin(Vulnerability,
                                Nvd.cve_id == Vulnerability.cve_id)
    entries = entries.order_by(desc(Nvd.id))

    bookmarked_page = parse_pagination_param("product_p")

    per_page = 10
    entries_full = entries.options(default_nvd_view_options)
    product_vulns = get_page(entries_full, per_page, page=bookmarked_page)
    product_vulns = VulnViewTypesetPaginationObjectWrapper(
        product_vulns.paging)

    entries_commits = get_entries_commits(entries)
    repo_urls = get_unique_repo_urls(entries_commits)

    return render_template("product/view.html",
                           vendor=vendor,
                           product=product,
                           product_vulns=product_vulns,
                           repo_urls=repo_urls,
                           number_vulns=number_vulns)
Ejemplo n.º 3
0
def get_pending_proposals_paged():
    entries = db.session.query(Vulnerability, Nvd)
    entries = entries.filter(
        Vulnerability.state != VulnerabilityState.PUBLISHED)
    entries = entries.outerjoin(Vulnerability,
                                Nvd.cve_id == Vulnerability.cve_id)
    entries = entries.order_by(asc(Vulnerability.state), desc(Nvd.id))
    bookmarked_page = parse_pagination_param("review_p")
    per_page = 10
    entries_full = entries.options(default_nvd_view_options)
    review_vulns = get_page(entries_full, per_page, page=bookmarked_page)
    review_vulns = VulnViewTypesetPaginationObjectWrapper(review_vulns.paging)
    return review_vulns
Ejemplo n.º 4
0
def list(vendor: str = None, profile: str = None):
    entries = db.session.query(Vulnerability, Nvd)
    entries = entries.filter(
        Vulnerability.state != VulnerabilityState.PUBLISHED)
    entries = entries.outerjoin(Vulnerability,
                                Nvd.cve_id == Vulnerability.cve_id)
    entries = entries.order_by(desc(Nvd.id))

    bookmarked_page = parse_pagination_param("review_p")
    per_page = 10
    entries_full = entries.options(default_nvd_view_options)
    review_vulns = get_page(entries_full, per_page, page=bookmarked_page)
    review_vulns = VulnViewTypesetPaginationObjectWrapper(review_vulns.paging)
    return render_template("review/list.html", review_vulns=review_vulns)
Ejemplo n.º 5
0
def view_proposals(vendor: str = None, profile: str = None):
    entries = db.session.query(Vulnerability, Nvd)
    entries = entries.filter(
        Vulnerability.creator == g.user,
        Vulnerability.state != VulnerabilityState.PUBLISHED)
    entries = entries.outerjoin(Vulnerability,
                                Nvd.cve_id == Vulnerability.cve_id)
    entries = entries.order_by(desc(Nvd.id))

    #if existing_user_proposals:
    #    flash_error("No proposals exist so far.")
    #    return

    bookmarked_page = parse_pagination_param("proposal_p")
    per_page = 10
    entries_full = entries.options(default_nvd_view_options)
    proposal_vulns = get_page(entries_full, per_page, page=bookmarked_page)
    proposal_vulns = VulnViewTypesetPaginationObjectWrapper(
        proposal_vulns.paging)
    return render_template("profile/proposals_view.html",
                           proposal_vulns=proposal_vulns)