Skip to content

Commit

Permalink
check password format in Password assessor (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomoyamachi committed Jul 9, 2023
1 parent 53e0295 commit e90eb9d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/assessor/passwd/passwd.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ func (a PasswdAssessor) Assess(fileMap deckodertypes.FileMap) ([]*types.Assessme
scanner := bufio.NewScanner(bytes.NewBuffer(file.Body))
for scanner.Scan() {
line := scanner.Text()
if len(line) == 0 || line[0] == '#' {
continue
}
passData := strings.Split(line, ":")
// password must given
if passData[1] == "" {
if len(passData) < 2 {
log.Logger.Debug("The password format may be invalid.", line)
} else if passData[1] == "" {
assesses = append(
assesses,
&types.Assessment{
Expand Down

0 comments on commit e90eb9d

Please sign in to comment.