From patchwork Mon Nov 11 22:13:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 179157 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7264008ilf; Mon, 11 Nov 2019 14:14:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzjy5IORjVzRDa02RbX0wDaBlYHzo0DhS+Gie3hC9/08UfBOn3Q5FaL9JlJe4fkEZZGEm+/ X-Received: by 2002:a63:ec42:: with SMTP id r2mr13716021pgj.162.1573510480466; Mon, 11 Nov 2019 14:14:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573510480; cv=none; d=google.com; s=arc-20160816; b=x2inx5fC46bX9TzfcYO2QMtEK5q1DvRDSzI064xsuyHeTjG265rBBlE3WyY2cRYI2U NXiQucMQEovZ7X3GoYPaef8HR3dxwranjxrrmqjBviipi4JcQITuqmzc9C9kivYxo94V upaVHVJ5gRzQ7R/ZEHjzTUKiiQFQ1RraltCIkqvCvdAUbJ7VkVw8EquZf9X6aaYV278x 7/yQB5V7vFbUCJI7pm3okz35wwFGCIEL4fRx8la8WBn543kPZ4zRdcTfJdrjNLUg5bkX 5cB5OuIlbLb5S3+24/s5TJRFPtPbKF814kfbE6znabYPxeZjq+DZf60BxWsFEaukyqx8 8Z1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:delivered-to; bh=0JeXNvaxsH4lEEd0w8gx9VtmlrweWozjF0hKkwx/z30=; b=xegoTMqZN23iv4VOX7R+UTPgYaipNqNwWdVg77vzeWYpaIrmKx3sO5rQajK+Koqpz9 4tjmYMZnXXT/icIFaqTlNT6utTEUOCkFc0EKG03rW3lVsD2E/i7EXLrnuusJLnH9Y80V JMt4n6lNw0OqT9sl52FoRPVHwMeYNn3dA57garPq59IyBDrm3Ujd4cXn73FGICFASrIr ENyLREQ2KSJ68fAvNvRBGPaKj1XEGUKQ1+bn3fVuqUS4WDEClnvxeDexqWLOQ7dlzFcc M0WSodluaqAmY6/v7mJPnZen0GNrYoDX2FHttaKMzDvslEdpwc9ykI6aH4xlC6shx8QS zkIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Cdfiuow2; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id y5si17661985plp.141.2019.11.11.14.14.40; Mon, 11 Nov 2019 14:14:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Cdfiuow2; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ec2-34-214-78-129.us-west-2.compute.amazonaws.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id A4ABC7FBB5; Mon, 11 Nov 2019 22:14:32 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by mail.openembedded.org (Postfix) with ESMTP id 5B4FE7FA88 for ; Mon, 11 Nov 2019 22:13:41 +0000 (UTC) Received: by mail-wm1-f49.google.com with SMTP id l1so976576wme.2 for ; Mon, 11 Nov 2019 14:13:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=M4ctuwA6cZs27fmHe6BG8al2Ng7rxmll+fGGZm4Bf/M=; b=Cdfiuow2q8I5EZQgaeuPn0sZAousQ1v8k4QEZp6twbVbZEJqH7+XSoD0m9WvabXL0Q jEMnyo3e183I4oDVBuvWNaLGXoe8pb4XUzqK+htjJI5FCrWli5dw890lzMPOiRm4mqAP gV4X3DYsO2JV9/iFWDITHrCA+AIcOWCxo24TRuDwIOu5QLwkQZxijOXJIjglTbzkRrcL Bw/pNeSKAdcu7b5ybrVSmR6k+oYlbTEqDOD8i1KYWbFa5In2TwncvDFAGfNgzti2qZuW yJAnlZMJtFl2CQsip0ZRIsaVJnctcrTrluyip/QL7d7qwNH6QNSJPwuKQFp0EDR7QpJf CdlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M4ctuwA6cZs27fmHe6BG8al2Ng7rxmll+fGGZm4Bf/M=; b=QDHLFt1CPQYa6goksYjuYQXWZFCBVrXfDFMzpyrhhSJMSAxh9OqT5ow6hE3Bh3dkxp PvmNS8LIxxqcO0MKprMNdD6mp9BsDF6rUFbOFaHMUAGSnXlgygEFCWQc4COfGqPO4yV5 wlatJD8Ty+uU9GrMbe4f1x/8fdVVhG56N6L8mzZld8KSKkjpJsqyly465hOanekYwEgF LHejzeXvOF0Uqwtm/A1emvi83E7+iSfu4XVci6AEGM9q9poGANzeKah5bD/HeMwPW4LI BcTKC92ophBzRM5idJxAoyhHhMBa+UUkCfoupqmfx3pVAv9JulxOxIg6yespN2/yAwCc SvZQ== X-Gm-Message-State: APjAAAX9abqXoZEUZbQxlLpOXdhSHfuMPE/6E9y3Qy8LqdbtU4xk88aw lK1KOPpTNnq7tqEXIqpr6XMXMGRcG+E= X-Received: by 2002:a1c:3843:: with SMTP id f64mr918722wma.129.1573510421797; Mon, 11 Nov 2019 14:13:41 -0800 (PST) Received: from flashheart.burtonini.com (35.106.2.81.in-addr.arpa. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id d11sm24900083wrf.80.2019.11.11.14.13.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2019 14:13:41 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Mon, 11 Nov 2019 22:13:35 +0000 Message-Id: <20191111221337.20332-2-ross.burton@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191111221337.20332-1-ross.burton@intel.com> References: <20191111221337.20332-1-ross.burton@intel.com> MIME-Version: 1.0 Subject: [OE-core] [PATCH 2/4] cve-update-db-native: add an index on the CVE ID column X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org Create an index on the PRODUCTS table which contains a row for each CPE, drastically increasing the performance of lookups for a specific CVE. Signed-off-by: Ross Burton --- meta/recipes-core/meta/cve-update-db-native.bb | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb index c15534de08b..08b18f064f0 100644 --- a/meta/recipes-core/meta/cve-update-db-native.bb +++ b/meta/recipes-core/meta/cve-update-db-native.bb @@ -120,11 +120,14 @@ python do_populate_cve_db() { def initialize_db(c): c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)") + c.execute("CREATE TABLE IF NOT EXISTS NVD (ID TEXT UNIQUE, SUMMARY TEXT, \ SCOREV2 TEXT, SCOREV3 TEXT, MODIFIED INTEGER, VECTOR TEXT)") + c.execute("CREATE TABLE IF NOT EXISTS PRODUCTS (ID TEXT, \ VENDOR TEXT, PRODUCT TEXT, VERSION_START TEXT, OPERATOR_START TEXT, \ VERSION_END TEXT, OPERATOR_END TEXT)") + c.execute("CREATE INDEX IF NOT EXISTS PRODUCT_ID_IDX on PRODUCTS(ID);") def parse_node_and_insert(c, node, cveId): # Parse children node if needed