Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
atools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo
atools
Commits
4c77c1c6
Commit
4c77c1c6
authored
Apr 03, 2020
by
Leo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(secfixes-check): remove obsolete components
parent
5410a787
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
33 deletions
+9
-33
secfixes-check
secfixes-check
+9
-33
No files found.
secfixes-check
View file @
4c77c1c6
...
...
@@ -94,33 +94,9 @@ local function readFile(file)
-- for yaml and merely have the wrong indentation
---
if le:match("^%-%s") then
violation("
CVE
identifier identation is 5 whitespaces", linenum, "47", "SC")
violation("
Security
identifier identation is 5 whitespaces", linenum, "47", "SC")
l = le:gsub("^", " ")
end
---
-- Check if they begin with an integer and are followed by a collection exclusively
-- composed of integers and hyphens until the end. That means they are missing the
-- correct yaml mapping and the CVE identifier
---
if (le:match("^%d[%d%-]*$") or le:match("^%-[%d%-]*$")) then
violation("CVE identifier identation is 5 whitespaces", linenum, "47", "SC")
violation("missing hyphen on '"..l:gsub("^%s+", "").."'", linenum, "41", "SC")
-- If the string doesn't start with a hyphen then add it
-- we will add the '- CVE' later
if le:sub(1, 1) ~= "-" then
le = '-'..le
end
l = le:gsub("^", " - CVE")
end
---
-- Check if they begin with 'CVE' that means they are missing the correct mapping
-- for yaml
---
if le:match("^CVE") then
violation("missing hyphen on '"..l:gsub("^%s+", "").."'", linenum, "41", "SC")
violation("CVE identifier identation is 5 whitespaces", linenum, "47", "SC")
l = le:gsub("^", " - ")
end
end
if (l:match("^%s%s%s%s") and not l:match("^%s%s%s%s%- ")) then
violation("missing hyphen on '"..l:gsub("^%s+", "").."'", linenum, "41", "SC")
...
...
@@ -153,21 +129,21 @@ end
--- Check the CVE identifier for validity
local function checkCVE(str, line)
--
Check if we have the CVE- prefix
if not str:match("^CVE%-") then
violation("missing CVE- prefix", line, "42", "SC")
str = "CVE-"..str
end
--
-
-- Strip the CVE prefix we know that is good
---
str = str:gsub("^CVE", "")
-- CVE Identifirs are made up of only integers and hyphens after the CVE- prefix
if not str:match("^
CVE
%-[%d%-]*$") then
if not str:match("^%-[%d%-]*$") then
violation("only integers and hyphens are valid after CVE-", line, "43", "SC")
end
-- The value right after CVE- is the year which must always be 4 digits (YYYY)
if not str:match("^
CVE
%-%d%d%d%d%-") then
if not str:match("^%-%d%d%d%d%-") then
violation("CVE identifiers have 4 digit year between the first and second hyphens", line, "44", "SC")
end
-- The last value of a CVE identifier is a collection of AT LEAST 4 digits
if not str:match("^
CVE
%-.-%-%d%d%d%d+$") then
if not str:match("^%-.-%-%d%d%d%d+$") then
violation("CVE IDs are at least 4 digits", line, "45", "SC")
end
local _, n = str:gsub("%-", "")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment