Skip to content

False-positive for URLs, even with word_boundary: true #272

@sed-i

Description

@sed-i

Currently, woke is triggered by keywords that are part of a URL:

$ echo "http://whitelist.com/slave" | woke --stdin
/dev/stdin:1:7-16: `whitelist` may be insensitive, use `allowlist`, `inclusion list` instead (warning)
http://whitelist.com/slave
       ^
/dev/stdin:1:21-26: `slave` may be insensitive, use `follower`, `replica`, `standby` instead (error)
http://whitelist.com/slave
                     ^

Both of the above are still triggered even with word_boundary: true.

Our CI currently fails for files that have comments with URLs with master, such as:
https://github.com/kubernetes/kube-state-metrics/blob/master/CHANGELOG.md

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
woke version 0.19.0
Config file
$ cat .woke.yml
rules:
  - name: whitelist
    terms:
      - whitelist
      - white-list
    alternatives:
      - allowlist
    note: An optional description why these terms are not inclusive. It can be optionally included in the output message.
    options:
      word_boundary: true

  - name: slave
    terms:
      - slave
      - slaves
    alternatives:
      - secondary
    note: An optional description why these terms are not inclusive. It can be optionally included in the output message.
    options:
      word_boundary: true
Go environment
$ go version && go env
zsh: command not found: go
Verbose output of running
$ woke --debug
2023-05-12T00:23:35-04:00 DBG woke version 0.19.0 built from e588a3e on 2022-07-28T22:46:26Z
2023-05-12T00:23:35-04:00 DBG Adding custom ruleset from filename=/tmp/test/.woke.yml
2023-05-12T00:23:35-04:00 DBG loaded config file config=/tmp/test/.woke.yml
2023-05-12T00:23:35-04:00 DBG config rules rules=["whitelist","slave"]
2023-05-12T00:23:35-04:00 DBG default rules rules=["whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2023-05-12T00:23:35-04:00 DBG all enabled rules rules=["whitelist","slave","blacklist","master-slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2023-05-12T00:23:35-04:00 DBG Could Not Find Root Git Folder
2023-05-12T00:23:35-04:00 DBG finished compiling ignores durationMS=0.093716
2023-05-12T00:23:35-04:00 DBG created new printer printer=text
2023-05-12T00:23:35-04:00 DBG process files path=. type=parallel
2023-05-12T00:23:35-04:00 DBG skipping file=.woke.yml reason="ignored file"
2023-05-12T00:23:35-04:00 DBG skipping content file=. reason="file is a directory"
2023-05-12T00:23:35-04:00 DBG finished processing findings durationMS=0.123635 file=.
No findings found.
2023-05-12T00:23:35-04:00 DBG woke completed durationMS=0.689903

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions