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
8be4261a
Commit
8be4261a
authored
Apr 03, 2020
by
Leo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(secfixes-check): give better errors in violations
parent
c528c1a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
secfixes-check
secfixes-check
+9
-10
No files found.
secfixes-check
View file @
8be4261a
...
...
@@ -135,12 +135,12 @@ local function checkGNUTLS(str, line)
-- Check if we were given just the string 'GNUTLS-SA'
---
if str:len() == 0 then
violation("GNUTLS-SA
identifier
given is empty", line, "51", "SC")
violation("GNUTLS-SA
ID
given is empty", line, "51", "SC")
return
end
-- GNUTLS-SA Identifirs are made up of only integers and hyphens after the CVE- prefix
if not str:match("^%-[%d%-]*$") then
violation("GNUTLS-SA
identifier
given is not composed of only digits and hyphens", line, "51", "SC")
violation("GNUTLS-SA
ID
given is not composed of only digits and hyphens", line, "51", "SC")
end
-- GNUTLS-SA Identifiers' first field is made of the the year in 4 digits YYYY
if not str:match("^%-%d%d%d%d") then
...
...
@@ -152,23 +152,22 @@ local function checkGNUTLS(str, line)
else
-- Extract the month
local month = tonumber(str:sub(7, 8))
---
-- Check if we have the substring in our set of months, if not then the
-- user gave us an invalid month
---
-- Check if we have a valid month
if (month < 1 or month > 12) then
violation("GNUTLS-SA ID has invalid month, it must be between 01 and 12", line, "51", "SC")
end
end
---
-- Match the starting hyphen, then anything until the next hyphen, then everything until the
-- next hyphen, then try to match 2 integers, they should be the day, if lower than 10 then
-- it should have a leading 0
---
if not str:match("^%-.-%-.-%-%d%d$") then
violation("GNUTLS-SA ID given has a bad day, it needs to be in DD format", line, "51", "SC")
else
-- Extract the day
local day = tonumber(str:sub(10, 11))
---
-- Check if we have the substring in our set of days, if not then the
-- user gave us an invalid day
---
-- Check if we have a valid day
if (day < 1 or day > 31) then
violation("GNUTLS-SA ID given has a bad day, it needs to be between 01 and 31", line, "51", "SC")
end
...
...
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