step 2/2 opengrep scan --quiet --disable-version-check --config /opt/opengrep-rules --sarif-output="$GITBAY_RESULTS/opengrep.sarif" .
┌───────────────────┐
│ 671 Code Findings │
└───────────────────┘
.gitbay/wiki/Architecture/diagrams/diagrams.py
❯❯❱ opt.opengrep-rules.python.lang.security.use-defused-xml
The Python documentation recommends using `defusedxml` instead of `xml` because the native Python
`xml` library is vulnerable to XML External Entity (XXE) attacks. These attacks can leak
confidential data and "XML bombs" can cause denial of service.
7┆ from xml.sax.saxutils import escape as esc
cmd/gitbay-runner/cgroup_linux.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
47┆ if err := os.MkdirAll(leaf, 0o755); err != nil {
⋮┆----------------------------------------
▶▶┆ Autofix ▶ 0600
57┆ if err := os.MkdirAll(builds, 0o755); err != nil {
⋮┆----------------------------------------
▶▶┆ Autofix ▶ 0600
65┆ if err := os.MkdirAll(dir, 0o755); err != nil {
⋮┆----------------------------------------
▶▶┆ Autofix ▶ 0600
80┆ if err := os.Mkdir(dir, 0o755); err != nil {
cmd/gitbay-runner/init.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
41┆ if err := os.MkdirAll(dir, 0o700); err != nil {
⋮┆----------------------------------------
▶▶┆ Autofix ▶ 0600
45┆ os.Chmod(dir, 0o700)
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
48┆ cmd := exec.Command(toolpath.Look("ssh-keygen"), "-q", "-t", "ed25519", "-N", "", "-C",
"gitbay-runner", "-f", key)
cmd/gitbay-runner/isolate.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
65┆ out, err := exec.Command(bin, "info", "--format",
"{{.Host.Security.Rootless}}").CombinedOutput()
⋮┆----------------------------------------
89┆ cmd := exec.Command(toolpath.Look("sh"), "-c", step)
⋮┆----------------------------------------
167┆ start := exec.Command(podman, args...)
⋮┆----------------------------------------
184┆ defer exec.Command(podman, append(r.podmanGlobal(), "rm", "--force", name)...).Run()
⋮┆----------------------------------------
188┆ cmd := exec.Command(podman, append(r.podmanGlobal(), "exec", "--workdir", "/workspace",
name, "sh", "-c", step)...)
cmd/gitbay-runner/main.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
179┆ if err := os.MkdirAll(r.workdir, 0o700); err != nil {
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
355┆ logCmd := exec.Command(toolpath.Look("ssh"), append(r.sshOpts, r.remote, "runner", "log",
fmt.Sprint(j.ID))...)
⋮┆----------------------------------------
446┆ cmd := exec.Command(toolpath.Look("git"), args...)
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
502┆ if err := os.Mkdir(dir, 0o700); err != nil {
⋮┆----------------------------------------
▶▶┆ Autofix ▶ 0600
516┆ if err := os.MkdirAll(dir, 0o700); err != nil {
⋮┆----------------------------------------
▶▶┆ Autofix ▶ 0600
528┆ os.Chmod(p, 0o700)
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
632┆ cmd := exec.Command(toolpath.Look("ssh"), append(append(r.sshOpts, r.remote), args...)...)
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
692┆ if err := os.Chmod(dir, 0o700); err != nil {
cmd/gitbay/local.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
58┆ ed := exec.Command(toolpath.Look("sh"), "-c", editor+" "+shellQuote(f.Name()))
⋮┆----------------------------------------
82┆ cmd := exec.Command(toolpath.Look("git"), args...)
⋮┆----------------------------------------
198┆ cmd := exec.Command(toolpath.Look("ssh"), args...)
⋮┆----------------------------------------
309┆ out, err := exec.Command(toolpath.Look("git"), "symbolic-ref", "--quiet", "--short",
"HEAD").Output()
⋮┆----------------------------------------
412┆ cmd := exec.Command(toolpath.Look("git"), "status", "--porcelain")
⋮┆----------------------------------------
659┆ cmd := exec.Command(toolpath.Look("git"), args...)
cmd/gitbay/main.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
858┆ if err := os.MkdirAll(dir, 0o755); err != nil {
cmd/gitbay/migrate.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
47┆ return exec.Command(toolpath.Look("ssh"), args...)
⋮┆----------------------------------------
103┆ clone := exec.Command(toolpath.Look("git"), "clone", "--quiet", "--mirror", srcURL,
tmp+"/r")
⋮┆----------------------------------------
110┆ push := exec.Command(toolpath.Look("git"), "-C", tmp+"/r", "push", "--quiet",
t.inst.CloneURL(repoPath),
111┆ "+refs/heads/*:refs/heads/*", "+refs/tags/*:refs/tags/*")
cmd/gitbay/ssh.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
67┆ out, err := exec.Command(toolpath.Look("git"), "remote", "get-url", "origin").Output()
⋮┆----------------------------------------
252┆ cmd := exec.Command(toolpath.Look("ssh"), args...)
⋮┆----------------------------------------
261┆ pager = exec.Command(toolpath.Look(argv[0]), argv[1:]...)
⋮┆----------------------------------------
312┆ out, err := exec.Command(toolpath.Look("ssh"), args...).Output()
cmd/gitbayd/backup.go
❯❱ opt.opengrep-rules.go.lang.security.potential-dos-via-decompression-bomb
Detected a possible denial-of-service via a zip bomb attack. By limiting the max bytes read, you can
mitigate this attack. `io.CopyN()` can specify a size.
▶▶┆ Autofix ▶ io.CopyN(sum, tr, 1024*1024*256)
529┆ _, err = io.Copy(sum, tr)
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
555┆ if err := os.MkdirAll(dest, 0o700); err != nil {
❯❱ opt.opengrep-rules.go.lang.security.potential-dos-via-decompression-bomb
Detected a possible denial-of-service via a zip bomb attack. By limiting the max bytes read, you can
mitigate this attack. `io.CopyN()` can specify a size.
▶▶┆ Autofix ▶ io.CopyN(io.Discard, gz, 1024*1024*256)
566┆ if _, err := io.Copy(io.Discard, gz); err != nil {
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
706┆ if err := os.MkdirAll(filepath.Dir(dest), 0o700); err != nil {
cmd/gitbayd/hook.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
34┆ raw, err := exec.Command(toolpath.Look("git"), "rev-list", u.New, "--not", "--
all").Output()
⋮┆----------------------------------------
68┆ cmd := exec.CommandContext(ctx, toolpath.Look("git"), "cat-file", "--batch")
cmd/gitbayd/main.go
❯❱ opt.opengrep-rules.go.lang.security.injection.open-redirect
An HTTP redirect was found to be crafted from user-input `r`. This can lead to open redirect
vulnerabilities, potentially allowing attackers to redirect users to malicious web sites. It is
recommend where possible to not allow user-input to craft the redirect URL. When user-input is
necessary to craft the request, it is recommended to follow OWASP best practices to restrict the URL
to domains in an allowlist.
362┆ http.Redirect(w, r, "https://"+target+r.URL.RequestURI(), http.StatusMovedPermanently)
cmd/gitbayd/maint.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
74┆ if out, err := exec.Command(toolpath.Look("git"), gcArgs...).CombinedOutput(); err != nil {
cmd/gitbayd/restoredrill.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
54┆ if err := os.MkdirAll(into, 0o700); err != nil {
cmd/gitbayd/tls.go
❯❱ opt.opengrep-rules.go.lang.security.audit.crypto.missing-ssl-minversion
`MinVersion` is missing from this TLS configuration. By default, TLS 1.2 is currently used as the
minimum when acting as a client, and TLS 1.0 when acting as a server. General purpose web
applications should default to TLS 1.3 with all other protocols disabled. Only where it is known
that a web server must support legacy clients with unsupported an insecure browsers (such as
Internet Explorer 10), it may be necessary to enable TLS 1.0 to provide support. Add `MinVersion:
tls.VersionTLS13' to the TLS configuration to bump the minimum version to TLS 1.3.
▶▶┆ Autofix ▶ tls.Config{ $...CONF, MinVersion: tls.VersionTLS13 }
9┆ c = &tls.Config{}
deploy/clonebench.sh
❱ opt.opengrep-rules.bash.lang.correctness.unquoted-command-substitution-in-command
The result of command substitution $(...) or `...`, if unquoted, is split on whitespace or other
separators specified by the IFS variable. You should surround it with double quotes to avoid
splitting the result.
16┆ echo "$i ok $(( $(date +%s) - s ))s"
⋮┆----------------------------------------
18┆ echo "$i failed $(( $(date +%s) - s ))s: $(head -n 1 "$dir/$i.err")"
⋮┆----------------------------------------
24┆ echo "total $(( $(date +%s) - start ))s for $n clones"
internal/backuplock/backuplock.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
27┆ return os.OpenFile(filepath.Join(root, Name), os.O_RDONLY|os.O_CREATE|syscall.O_NOFOLLOW,
0o644)
internal/cliconfig/cliconfig.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
79┆ if err := os.MkdirAll(filepath.Dir(p), 0o700); err != nil {
internal/control/milestone.go
❯❱ opt.opengrep-rules.go.lang.correctness.use-filepath-join
`path.Join(...)` always joins using a forward slash. This may cause issues on Windows or other
systems using a different delimiter. Use `filepath.Join(...)` instead which uses OS-specific path
separators.
326┆ raw, err := gitutil.ReadBlob(dir, ref, path.Join(".gitbay", e.Name), maxBodyBytes)
internal/control/read.go
❯❱ opt.opengrep-rules.go.lang.correctness.use-filepath-join
`path.Join(...)` always joins using a forward slash. This may cause issues on Windows or other
systems using a different delimiter. Use `filepath.Join(...)` instead which uses OS-specific path
separators.
364┆ firstFile = path.Join(dirPath, e.Name)
internal/control/release.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
415┆ if err := os.MkdirAll(dir, 0o750); err != nil {
internal/control/repo.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
607┆ if err := os.MkdirAll(filepath.Dir(newDir), 0o750); err != nil {
internal/gitpin/gitpin.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
177┆ out, err := exec.CommandContext(ctx, toolpath.Look("git"), "version").Output()
internal/gitutil/batch.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
24┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "cat-file", "--batch")
internal/gitutil/blame.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
33┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "blame", "--porcelain",
34┆ fmt.Sprintf("-L%d,%d", start, end), sha, "--", path)
internal/gitutil/facts.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
15┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "rev-list", "--count", "--end-of-
options", ref).Output()
⋮┆----------------------------------------
35┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "log",
36┆ "--use-mailmap", "--format=%aN%x01%aE", "--end-of-options", ref).Output()
⋮┆----------------------------------------
67┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "ls-tree", "-r", "-l", "--full-
name", "--end-of-options", ref).Output()
internal/gitutil/gitutil.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
21┆ if err := os.MkdirAll(filepath.Dir(path), 0o750); err != nil {
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
24┆ cmd := exec.Command(toolpath.Look("git"), "init", "--bare", "--initial-
branch="+defaultBranch, path)
⋮┆----------------------------------------
28┆ cmd = exec.Command(toolpath.Look("git"), "-C", path, "config", "core.hooksPath", hooksPath)
⋮┆----------------------------------------
63┆ cmd := exec.Command(toolpath.Look("git"), args...)
⋮┆----------------------------------------
96┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "merge-base", "--is-ancestor", old,
new)
⋮┆----------------------------------------
135┆ err := exec.Command(toolpath.Look("git"), "-C", dir, "cat-file", "-e", "--end-of-options",
sha).Run()
⋮┆----------------------------------------
148┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "for-each-ref",
149┆ "--count=1", "--format=x", "--contains="+sha).Output()
⋮┆----------------------------------------
171┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "rev-list", fmt.Sprintf("--max-
count=%d", limit), "--end-of-options", ref)
⋮┆----------------------------------------
189┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "rev-list",
190┆ fmt.Sprintf("--max-count=%d", limit), "--end-of-options", ref, "--", filePath)
⋮┆----------------------------------------
207┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "rev-parse", "--verify", "--end-
of-options", ref+"^{commit}").Output()
⋮┆----------------------------------------
216┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "cat-file", "commit", "--end-of-
options", sha)
⋮┆----------------------------------------
234┆ cmd := exec.CommandContext(ctx, toolpath.Look("git"), args...)
⋮┆----------------------------------------
256┆ cmd := exec.CommandContext(ctx, toolpath.Look("git"), args...)
⋮┆----------------------------------------
269┆ cmd := exec.CommandContext(ctx, toolpath.Look("git"), args...)
⋮┆----------------------------------------
288┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "symbolic-ref", "HEAD",
"refs/heads/"+branch)
internal/gitutil/grep.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
28┆ cmd := exec.CommandContext(ctx, toolpath.Look("git"), "-C", dir, "grep", "-nIiF", "-z",
"-e", query, "--end-of-options", ref)
internal/gitutil/lastcommit.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
54┆ cmd := exec.Command(toolpath.Look("git"), args...)
⋮┆----------------------------------------
112┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "log", "-1",
113┆ "--format=%H%x1f%ct%x1f%an%x1f%ae%x1f%s", "--end-of-options", ref).Output()
⋮┆----------------------------------------
142┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "ls-tree", "-l", "--end-of-
options", ref, "--", path).Output()
internal/gitutil/lfs.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
23┆ list := exec.Command(toolpath.Look("git"), "-C", dir, "cat-file", "--batch-all-objects",
24┆ "--batch-check=%(objecttype) %(objectsize) %(objectname)")
⋮┆----------------------------------------
43┆ cat := exec.Command(toolpath.Look("git"), "-C", dir, "cat-file", "--batch")
internal/gitutil/merge.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
17┆ cmd := exec.Command(toolpath.Look("git"), "-C", dstDir, "fetch", "--quiet", "--no-write-
fetch-head",
18┆ srcDir, "+"+srcRef+":"+dstRef)
⋮┆----------------------------------------
33┆ cmd := exec.Command(toolpath.Look("git"), args...)
⋮┆----------------------------------------
41┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "update-ref", "-d", ref)
⋮┆----------------------------------------
52┆ return exec.Command(toolpath.Look("git"), "-C", dir, "show-ref", "--verify", "--quiet",
ref).Run() == nil
⋮┆----------------------------------------
62┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "gc", "--quiet", "--prune=now")
⋮┆----------------------------------------
75┆ cmd := exec.Command(toolpath.Look("git"), "--git-dir="+dir, "fsck", "--connectivity-only",
"--no-progress", "--no-dangling")
⋮┆----------------------------------------
84┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "rev-list", "--end-of-options", new,
"^"+old)
⋮┆----------------------------------------
101┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "merge-tree", "--write-tree", "--end-
of-options", ours, theirs)
⋮┆----------------------------------------
120┆ cmd := exec.Command(toolpath.Look("git"), args...)
⋮┆----------------------------------------
137┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "diff", "--stat", "--patch", "--end-
of-options", old, new)
⋮┆----------------------------------------
164┆ diff := exec.Command(toolpath.Look("git"), "-C", dir, "diff", "--end-of-options", old, new)
⋮┆----------------------------------------
165┆ pid := exec.Command(toolpath.Look("git"), "-C", dir, "patch-id", "--stable")
⋮┆----------------------------------------
190┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "merge-base", "--end-of-options", a,
b)
⋮┆----------------------------------------
230┆ hb := exec.Command(toolpath.Look("git"), "-C", dir, "hash-object", "-w", "--stdin")
⋮┆----------------------------------------
252┆ rt := exec.Command(toolpath.Look("git"), "-C", dir, "read-tree", tree0)
⋮┆----------------------------------------
257┆ ui := exec.Command(toolpath.Look("git"), "-C", dir, "update-index", "--add", "--cacheinfo",
mode+","+blob+","+path)
⋮┆----------------------------------------
262┆ wt := exec.Command(toolpath.Look("git"), "-C", dir, "write-tree")
⋮┆----------------------------------------
280┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "rev-list", "-n1", "--
all").Output()
⋮┆----------------------------------------
286┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "rev-list", "--parents", "-n1", "
--end-of-options", sha).Output()
⋮┆----------------------------------------
299┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "log", "-1", "--
format=%an%x1f%ae%x1f%aI", "--end-of-options", sha).Output()
⋮┆----------------------------------------
312┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "log", "-1", "--format=%B", "--
end-of-options", sha).Output()
⋮┆----------------------------------------
322┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "merge-tree", "--write-tree", "--
merge-base="+base, "--end-of-options", onto, commit)
⋮┆----------------------------------------
342┆ cmd := exec.Command(toolpath.Look("git"), args...)
⋮┆----------------------------------------
360┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "rev-parse", "--verify", "--end-
of-options", sha+"^{tree}").Output()
⋮┆----------------------------------------
369┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "diff", "--name-only", "--end-of-
options", old, new).Output()
⋮┆----------------------------------------
401┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "range-diff", "--creation-factor=80",
"--end-of-options",
402┆ oldBase+".."+oldHead, newBase+".."+newHead)
internal/gitutil/messages.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
27┆ out, err := exec.Command(toolpath.Look("git"), args...).Output()
⋮┆----------------------------------------
44┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "log", "-1", "--format=%P",
sha).Output()
⋮┆----------------------------------------
54┆ out, err := exec.Command(toolpath.Look("git"), "-C", dir, "log", "-1", "--format=%cs",
ref).Output()
⋮┆----------------------------------------
63┆ return exec.Command(toolpath.Look("git"), "-C", dir, "cat-file", "-e",
sha+"^{commit}").Run() == nil
⋮┆----------------------------------------
81┆ out, err := exec.Command(toolpath.Look("git"), args...).Output()
⋮┆----------------------------------------
125┆ out, err := exec.Command(toolpath.Look("git"), args...).Output()
internal/gitutil/numstat.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
26┆ cmd := exec.Command(toolpath.Look("git"), append([]string{"-C", dir}, args...)...)
internal/gitutil/read.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
45┆ cmd := exec.Command(toolpath.Look("git"), append(args, "--end-of-options", spec)...)
⋮┆----------------------------------------
75┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "cat-file", "blob", "--end-of-
options", ref+":"+path)
⋮┆----------------------------------------
98┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "cat-file", "--batch-
check=%(objecttype) %(objectname)")
⋮┆----------------------------------------
113┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "rev-parse", "--verify", "--quiet", "
--end-of-options", ref+"^{commit}")
⋮┆----------------------------------------
128┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "for-each-ref",
129┆ "--format=%(refname:short) %(objectname)", "refs/"+kind)
⋮┆----------------------------------------
162┆ cmd := exec.CommandContext(ctx, toolpath.Look("git"), "-C", dir, "archive", "--
format=tar.gz", "--prefix="+prefix+"/", "--end-of-options", ref)
⋮┆----------------------------------------
196┆ cmd := exec.Command(toolpath.Look("git"), "-C", dir, "show", "--stat", "--patch", "--
format=", "--end-of-options", sha)
internal/gitutil/treeblobs.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
21┆ out, err := exec.CommandContext(ctx, toolpath.Look("git"), "-C", dir,
22┆ "ls-tree", "-r", "-l", "-z", "--end-of-options", tree).Output()
⋮┆----------------------------------------
53┆ cmd := exec.CommandContext(ctx, toolpath.Look("git"), "-C", dir, "cat-file", "--batch")
internal/hookd/hookd.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
395┆ if err := os.MkdirAll(hooksDir, 0o755); err != nil {
internal/httpd/account.go
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-io-writestring-to-responsewriter
Detected 'io.WriteString()' writing directly to 'http.ResponseWriter'. This bypasses HTML escaping
that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package to
render data to users.
180┆ io.WriteString(w, out)
internal/httpd/accounts.go
❯❱ opt.opengrep-rules.go.lang.security.audit.net.cookie-missing-secure
A session cookie was detected without setting the 'Secure' flag. The 'secure' flag for cookies
prevents the client from transmitting the cookie over insecure channels such as HTTP. Set the
'Secure' flag by setting 'Secure' to 'true' in the Options struct.
▶▶┆ Autofix ▶ http.Cookie{ Name: sessionCookie, Value: tok, Path: "/", HttpOnly: true, SameSite:
sessionSameSite, Secure: s.cfg.HTTP.TLS != "off", MaxAge: 7 * 24 * 3600, }
175┆ return &http.Cookie{
176┆ Name: sessionCookie, Value: tok, Path: "/",
177┆ HttpOnly: true, SameSite: sessionSameSite,
178┆ Secure: s.cfg.HTTP.TLS != "off",
179┆ MaxAge: 7 * 24 * 3600,
180┆ }
❯❱ opt.opengrep-rules.go.lang.security.injection.open-redirect
An HTTP redirect was found to be crafted from user-input `r`. This can lead to open redirect
vulnerabilities, potentially allowing attackers to redirect users to malicious web sites. It is
recommend where possible to not allow user-input to craft the redirect URL. When user-input is
necessary to craft the request, it is recommended to follow OWASP best practices to restrict the URL
to domains in an allowlist.
241┆ http.Redirect(w, r, "/"+name, http.StatusSeeOther)
⋮┆----------------------------------------
264┆ http.Redirect(w, r, "/"+owner+"/"+name, http.StatusSeeOther)
⋮┆----------------------------------------
275┆ http.Redirect(w, r, "/"+owner+"/"+name, http.StatusSeeOther)
internal/httpd/adminusers.go
❯❱ opt.opengrep-rules.go.lang.security.injection.open-redirect
An HTTP redirect was found to be crafted from user-input `r`. This can lead to open redirect
vulnerabilities, potentially allowing attackers to redirect users to malicious web sites. It is
recommend where possible to not allow user-input to craft the redirect URL. When user-input is
necessary to craft the request, it is recommended to follow OWASP best practices to restrict the URL
to domains in an allowlist.
94┆ http.Redirect(w, r, dest, http.StatusSeeOther)
internal/httpd/apiread.go
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-direct-write-to-responsewriter
Detected directly writing or similar in 'http.ResponseWriter.write()'. This bypasses HTML escaping
that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package and
render data using 'template.Execute()'.
90┆ w.Write(payload)
⋮┆----------------------------------------
113┆ w.Write(payload)
internal/httpd/atom.go
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-fprintf-to-responsewriter
Detected 'Fprintf' or similar writing to 'http.ResponseWriter'. This bypasses HTML escaping that
prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package to render
data to users.
74┆ fmt.Fprint(w, xml.Header)
internal/httpd/badge.go
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-fprintf-to-responsewriter
Detected 'Fprintf' or similar writing to 'http.ResponseWriter'. This bypasses HTML escaping that
prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package to render
data to users.
74┆ fmt.Fprint(w, badgeSVG(label, state))
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-direct-write-to-responsewriter
Detected directly writing or similar in 'http.ResponseWriter.write()'. This bypasses HTML escaping
that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package and
render data using 'template.Execute()'.
91┆ w.Write(out)
internal/httpd/builds.go
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-io-writestring-to-responsewriter
Detected 'io.WriteString()' writing directly to 'http.ResponseWriter'. This bypasses HTML escaping
that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package to
render data to users.
365┆ io.WriteString(w, head)
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-fprintf-to-responsewriter
Detected 'Fprintf' or similar writing to 'http.ResponseWriter'. This bypasses HTML escaping that
prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package to render
data to users.
385┆ fmt.Fprintf(w, `<p class="notice" role="status">build finished: %s</p>`,
template.HTMLEscapeString(b.Status))
⋮┆----------------------------------------
391┆ fmt.Fprintf(w, `<p class="error" role="alert">%s</p>`, template.HTMLEscapeString(msg))
⋮┆----------------------------------------
393┆ fmt.Fprintf(w, `<p class="notice" role="status">%s</p>`, template.HTMLEscapeString(msg))
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-io-writestring-to-responsewriter
Detected 'io.WriteString()' writing directly to 'http.ResponseWriter'. This bypasses HTML escaping
that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package to
render data to users.
395┆ io.WriteString(w, tail)
internal/httpd/diff.go
❯❱ opt.opengrep-rules.go.lang.security.shared-url-struct-mutation
Shared URL struct may have been accidentally mutated. Ensure that this behavior is intended.
70┆ cur.OldPath, cur.Path = a, b
⋮┆----------------------------------------
85┆ cur.Status, cur.Path = "renamed", strings.TrimPrefix(l, "rename to ")
⋮┆----------------------------------------
97┆ cur.Path = strings.TrimPrefix(p, "b/")
⋮┆----------------------------------------
109┆ d.Class, d.Path = "hunk", ""
⋮┆----------------------------------------
123┆ d.Class, d.Path = "meta", ""
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.unsafe-template-type
Semgrep could not determine that the argument to 'template.HTML()' is a constant. 'template.HTML()'
and similar does not escape contents. Be absolutely sure there is no user-controlled data in this
template. If user data can reach this template, you may have a XSS vulnerability. Instead, do not
use this function and use 'template.Execute()'.
247┆ out = append(out, template.HTML(line))
internal/httpd/filenav.go
❯❱ opt.opengrep-rules.go.lang.correctness.use-filepath-join
`path.Join(...)` always joins using a forward slash. This may cause issues on Windows or other
systems using a different delimiter. Use `filepath.Join(...)` instead which uses OS-specific path
separators.
61┆ full := path.Join(dir, e.Name)
internal/httpd/flash.go
❯❱ opt.opengrep-rules.go.lang.security.audit.net.cookie-missing-secure
A session cookie was detected without setting the 'Secure' flag. The 'secure' flag for cookies
prevents the client from transmitting the cookie over insecure channels such as HTTP. Set the
'Secure' flag by setting 'Secure' to 'true' in the Options struct.
▶▶┆ Autofix ▶ http.Cookie{ Name: flashCookie, Value: url.QueryEscape(msg), Path: "/", HttpOnly: true,
SameSite: http.SameSiteLaxMode, Secure: s.cfg.HTTP.TLS != "off", MaxAge: 60, }
27┆ http.SetCookie(w, &http.Cookie{
28┆ Name: flashCookie, Value: url.QueryEscape(msg), Path: "/",
29┆ HttpOnly: true, SameSite: http.SameSiteLaxMode,
30┆ Secure: s.cfg.HTTP.TLS != "off",
31┆ MaxAge: 60,
32┆ })
⋮┆----------------------------------------
▶▶┆ Autofix ▶ http.Cookie{ Name: nextCookie, Value: url.QueryEscape(path), Path: "/", HttpOnly: true,
SameSite: http.SameSiteLaxMode, Secure: s.cfg.HTTP.TLS != "off", MaxAge: 600, }
76┆ http.SetCookie(w, &http.Cookie{
77┆ Name: nextCookie, Value: url.QueryEscape(path), Path: "/",
78┆ HttpOnly: true, SameSite: http.SameSiteLaxMode,
79┆ Secure: s.cfg.HTTP.TLS != "off", MaxAge: 600,
80┆ })
⋮┆----------------------------------------
▶▶┆ Autofix ▶ http.Cookie{ Name: name, Value: "", Path: "/", HttpOnly: true, SameSite: sameSite, Secure:
s.cfg.HTTP.TLS != "off", MaxAge: -1, }
122┆ return &http.Cookie{
123┆ Name: name, Value: "", Path: "/",
124┆ HttpOnly: true, SameSite: sameSite,
125┆ Secure: s.cfg.HTTP.TLS != "off",
126┆ MaxAge: -1,
127┆ }
internal/httpd/mractions.go
❯❱ opt.opengrep-rules.go.lang.security.injection.open-redirect
An HTTP redirect was found to be crafted from user-input `r`. This can lead to open redirect
vulnerabilities, potentially allowing attackers to redirect users to malicious web sites. It is
recommend where possible to not allow user-input to craft the redirect URL. When user-input is
necessary to craft the request, it is recommended to follow OWASP best practices to restrict the URL
to domains in an allowlist.
303┆ http.Redirect(w, r, fmt.Sprintf("/%s/mrs/new?%s", p.Repo.Path(), q.Encode()),
http.StatusSeeOther)
internal/httpd/orgweb.go
❯❱ opt.opengrep-rules.go.lang.security.injection.open-redirect
An HTTP redirect was found to be crafted from user-input `r`. This can lead to open redirect
vulnerabilities, potentially allowing attackers to redirect users to malicious web sites. It is
recommend where possible to not allow user-input to craft the redirect URL. When user-input is
necessary to craft the request, it is recommended to follow OWASP best practices to restrict the URL
to domains in an allowlist.
69┆ http.Redirect(w, r, "/"+name, http.StatusSeeOther)
internal/httpd/pages.go
❯❱ opt.opengrep-rules.go.lang.security.injection.open-redirect
An HTTP redirect was found to be crafted from user-input `r`. This can lead to open redirect
vulnerabilities, potentially allowing attackers to redirect users to malicious web sites. It is
recommend where possible to not allow user-input to craft the redirect URL. When user-input is
necessary to craft the request, it is recommended to follow OWASP best practices to restrict the URL
to domains in an allowlist.
81┆ http.Redirect(w, r, pageRedirectTarget(r.URL.Path), http.StatusMovedPermanently)
⋮┆----------------------------------------
108┆ http.Redirect(w, r, pageRedirectTarget(r.URL.Path), http.StatusMovedPermanently)
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-direct-write-to-responsewriter
Detected directly writing or similar in 'http.ResponseWriter.write()'. This bypasses HTML escaping
that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package and
render data using 'template.Execute()'.
127┆ w.Write(data)
internal/httpd/readme.go
❯❱ opt.opengrep-rules.go.lang.correctness.use-filepath-join
`path.Join(...)` always joins using a forward slash. This may cause issues on Windows or other
systems using a different delimiter. Use `filepath.Join(...)` instead which uses OS-specific path
separators.
20┆ target := path.Clean(path.Join(baseDir, v))
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.unsafe-template-type
Semgrep could not determine that the argument to 'template.HTML()' is a constant. 'template.HTML()'
and similar does not escape contents. Be absolutely sure there is no user-controlled data in this
template. If user data can reach this template, you may have a XSS vulnerability. Instead, do not
use this function and use 'template.Execute()'.
80┆ return template.HTML(out.String())
internal/httpd/rendered.go
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.unsafe-template-type
Semgrep could not determine that the argument to 'template.HTML()' is a constant. 'template.HTML()'
and similar does not escape contents. Be absolutely sure there is no user-controlled data in this
template. If user data can reach this template, you may have a XSS vulnerability. Instead, do not
use this function and use 'template.Execute()'.
20┆ return template.HTML(preTag.ReplaceAllStringFunc(string(h), func(m string) string {
21┆ if strings.Contains(m, "tabindex") {
22┆ return m
23┆ }
24┆ return `<pre tabindex="0"` + m[len("<pre"):]
25┆ }))
⋮┆----------------------------------------
33┆ return template.HTML(imgTag.ReplaceAllStringFunc(string(h), func(m string) string {
34┆ if strings.Contains(m, " alt=") {
35┆ return m
36┆ }
37┆ name := ""
38┆ if sub := srcAttr.FindStringSubmatch(m); sub != nil {
39┆ src := sub[1]
40┆ if i := strings.IndexAny(src, "?#"); i >= 0 {
41┆ src = src[:i]
42┆ }
[hid 8 additional lines, adjust with --max-lines-per-finding]
internal/httpd/routes.go
❯❱ opt.opengrep-rules.go.lang.security.injection.open-redirect
An HTTP redirect was found to be crafted from user-input `r`. This can lead to open redirect
vulnerabilities, potentially allowing attackers to redirect users to malicious web sites. It is
recommend where possible to not allow user-input to craft the redirect URL. When user-input is
necessary to craft the request, it is recommended to follow OWASP best practices to restrict the URL
to domains in an allowlist.
299┆ http.Redirect(w, r, u.String(), http.StatusMovedPermanently)
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-fprintf-to-responsewriter
Detected 'Fprintf' or similar writing to 'http.ResponseWriter'. This bypasses HTML escaping that
prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package to render
data to users.
344┆ fmt.Fprintf(w, `<!DOCTYPE html><html><head><meta name="go-import" content="%s git
%s/%s.git"></head><body>%s</body></html>`,
345┆ module, s.cfg.Server.SiteURL, repo, module)
internal/httpd/smart.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
111┆ cmd := exec.CommandContext(r.Context(), toolpath.Look("git"), "upload-pack", "--stateless-
rpc", "--advertise-refs", dir)
⋮┆----------------------------------------
162┆ cmd := exec.Command(toolpath.Look("git"), "-c", "uploadpack.keepAlive=5", "upload-pack", "
--stateless-rpc", dir)
internal/httpd/snippets.go
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-direct-write-to-responsewriter
Detected directly writing or similar in 'http.ResponseWriter.write()'. This bypasses HTML escaping
that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package and
render data using 'template.Execute()'.
129┆ w.Write(f.Content)
internal/httpd/symbols.go
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.unsafe-template-type
Semgrep could not determine that the argument to 'template.HTML()' is a constant. 'template.HTML()'
and similar does not escape contents. Be absolutely sure there is no user-controlled data in this
template. If user data can reach this template, you may have a XSS vulnerability. Instead, do not
use this function and use 'template.Execute()'.
76┆ return template.HTML(linked), list
internal/httpd/web.go
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-direct-write-to-responsewriter
Detected directly writing or similar in 'http.ResponseWriter.write()'. This bypasses HTML escaping
that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package and
render data using 'template.Execute()'.
99┆ w.Write(styleCSS)
⋮┆----------------------------------------
100┆ w.Write(chromaCSS)
⋮┆----------------------------------------
105┆ w.Write(web.FaviconSVG)
⋮┆----------------------------------------
118┆ w.Write(data)
❯❱ opt.opengrep-rules.go.lang.correctness.use-filepath-join
`path.Join(...)` always joins using a forward slash. This may cause issues on Windows or other
systems using a different delimiter. Use `filepath.Join(...)` instead which uses OS-specific path
separators.
451┆ acc = path.Join(acc, part)
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.unsafe-template-type
Semgrep could not determine that the argument to 'template.HTML()' is a constant. 'template.HTML()'
and similar does not escape contents. Be absolutely sure there is no user-controlled data in this
template. If user data can reach this template, you may have a XSS vulnerability. Instead, do not
use this function and use 'template.Execute()'.
1021┆ return template.HTML(b.String())
❯❱ opt.opengrep-rules.go.lang.security.audit.net.formatted-template-string
Found a formatted template string passed to 'template.HTML()'. 'template.HTML()' does not escape
contents. Be absolutely sure there is no user-controlled data in this template. If user data can
reach this template, you may have a XSS vulnerability.
1166┆ return template.HTML("<pre>" + template.HTMLEscapeString(string(data)) + "</pre>")
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.unsafe-template-type
Semgrep could not determine that the argument to 'template.HTML()' is a constant. 'template.HTML()'
and similar does not escape contents. Be absolutely sure there is no user-controlled data in this
template. If user data can reach this template, you may have a XSS vulnerability. Instead, do not
use this function and use 'template.Execute()'.
1166┆ return template.HTML("<pre>" + template.HTMLEscapeString(string(data)) + "</pre>")
❯❱ opt.opengrep-rules.go.lang.security.audit.net.formatted-template-string
Found a formatted template string passed to 'template.HTML()'. 'template.HTML()' does not escape
contents. Be absolutely sure there is no user-controlled data in this template. If user data can
reach this template, you may have a XSS vulnerability.
1170┆ return focusableBlocks(template.HTML("<pre>" + template.HTMLEscapeString(string(data)) +
"</pre>"))
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.unsafe-template-type
Semgrep could not determine that the argument to 'template.HTML()' is a constant. 'template.HTML()'
and similar does not escape contents. Be absolutely sure there is no user-controlled data in this
template. If user data can reach this template, you may have a XSS vulnerability. Instead, do not
use this function and use 'template.Execute()'.
1170┆ return focusableBlocks(template.HTML("<pre>" + template.HTMLEscapeString(string(data)) +
"</pre>"))
⋮┆----------------------------------------
1172┆ return focusableBlocks(template.HTML(buf.String()))
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-direct-write-to-responsewriter
Detected directly writing or similar in 'http.ResponseWriter.write()'. This bypasses HTML escaping
that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package and
render data using 'template.Execute()'.
1247┆ w.Write(data)
❯❱ opt.opengrep-rules.go.lang.security.audit.net.formatted-template-string
Found a formatted template string passed to 'template.HTML()'. 'template.HTML()' does not escape
contents. Be absolutely sure there is no user-controlled data in this template. If user data can
reach this template, you may have a XSS vulnerability.
1333┆ return focusableBlocks(template.HTML("<pre>" + template.HTMLEscapeString(raw) + "</pre>"))
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.unsafe-template-type
Semgrep could not determine that the argument to 'template.HTML()' is a constant. 'template.HTML()'
and similar does not escape contents. Be absolutely sure there is no user-controlled data in this
template. If user data can reach this template, you may have a XSS vulnerability. Instead, do not
use this function and use 'template.Execute()'.
1333┆ return focusableBlocks(template.HTML("<pre>" + template.HTMLEscapeString(raw) + "</pre>"))
⋮┆----------------------------------------
1335┆ return focusableBlocks(template.HTML(buf.String()))
❯❱ opt.opengrep-rules.go.lang.security.audit.net.formatted-template-string
Found a formatted template string passed to 'template.HTML()'. 'template.HTML()' does not escape
contents. Be absolutely sure there is no user-controlled data in this template. If user data can
reach this template, you may have a XSS vulnerability.
1408┆ return template.HTML("<pre>" + template.HTMLEscapeString(raw) + "</pre>")
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.unsafe-template-type
Semgrep could not determine that the argument to 'template.HTML()' is a constant. 'template.HTML()'
and similar does not escape contents. Be absolutely sure there is no user-controlled data in this
template. If user data can reach this template, you may have a XSS vulnerability. Instead, do not
use this function and use 'template.Execute()'.
1408┆ return template.HTML("<pre>" + template.HTMLEscapeString(raw) + "</pre>")
⋮┆----------------------------------------
1427┆ return template.HTML(autolink.Rewrite(string(h), repo.OwnerName, repo.Name, res))
⋮┆----------------------------------------
1511┆ return imageAlt(template.HTML(ow.math.fill(ugcPolicy.Sanitize(out))))
⋮┆----------------------------------------
1567┆ return template.HTML(headingTag.ReplaceAllStringFunc(string(h), func(m string) string {
1568┆ sub := headingTag.FindStringSubmatch(m)
1569┆ return "<" + sub[1] + "h" + string(rune(sub[2][0]+1)) + sub[3]
1570┆ }))
❯❱ opt.opengrep-rules.go.lang.security.audit.net.formatted-template-string
Found a formatted template string passed to 'template.HTML()'. 'template.HTML()' does not escape
contents. Be absolutely sure there is no user-controlled data in this template. If user data can
reach this template, you may have a XSS vulnerability.
1575┆ return template.HTML("<pre>" + template.HTMLEscapeString(string(raw)) + "</pre>")
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.unsafe-template-type
Semgrep could not determine that the argument to 'template.HTML()' is a constant. 'template.HTML()'
and similar does not escape contents. Be absolutely sure there is no user-controlled data in this
template. If user data can reach this template, you may have a XSS vulnerability. Instead, do not
use this function and use 'template.Execute()'.
1575┆ return template.HTML("<pre>" + template.HTMLEscapeString(string(raw)) + "</pre>")
⋮┆----------------------------------------
1587┆ out = demoteHeadings(template.HTML(buf.String()))
⋮┆----------------------------------------
1591┆ out = template.HTML(ugcPolicy.Sanitize(string(raw)))
⋮┆----------------------------------------
2025┆ out[name] = template.CSS("--chip-l:" + light + ";--chip-d:" + dark)
internal/httpd/wiki.go
❯❱ opt.opengrep-rules.go.lang.correctness.use-filepath-join
`path.Join(...)` always joins using a forward slash. This may cause issues on Windows or other
systems using a different delimiter. Use `filepath.Join(...)` instead which uses OS-specific path
separators.
168┆ rel := path.Join(wikiTreePath, strings.Trim(r.PathValue("path"), "/"))
❯❱ opt.opengrep-rules.go.lang.security.audit.xss.no-direct-write-to-responsewriter
Detected directly writing or similar in 'http.ResponseWriter.write()'. This bypasses HTML escaping
that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package and
render data using 'template.Execute()'.
192┆ w.Write(data)
❯❱ opt.opengrep-rules.go.lang.correctness.use-filepath-join
`path.Join(...)` always joins using a forward slash. This may cause issues on Windows or other
systems using a different delimiter. Use `filepath.Join(...)` instead which uses OS-specific path
separators.
202┆ local := path.Clean(path.Join(dir, v))
internal/leaks/scan.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
97┆ cmd := exec.CommandContext(ctx, toolpath.Look("git"), args...)
⋮┆----------------------------------------
168┆ cmd := exec.CommandContext(ctx, toolpath.Look("git"), "-C", dir, "cat-file", "--batch")
internal/lfs/lfs.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
60┆ if err := os.MkdirAll(dir, 0o755); err != nil {
internal/mirror/mirror.go
❯❯❱ opt.opengrep-rules.go.lang.security.audit.dangerous-exec-command
Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user
data can reach this call site, this is a code injection vulnerability. A malicious actor can inject
a malicious script to execute arbitrary code.
136┆ cmd := exec.CommandContext(ctx, toolpath.Look("git"), args...)
internal/sshd/sshd.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
124┆ if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {
internal/store/commentmigrate.go
❯❱ opt.opengrep-rules.go.lang.security.audit.database.string-formatted-query
String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized
properly. Audit this call to ensure the SQL is not manipulable by external data.
31┆ q := fmt.Sprintf(`
32┆ SELECT c.id, c.body, COALESCE(u.username, o.name) || '/' || r.name
33┆ FROM %s c
34┆ JOIN %s it ON it.id = c.%s
35┆ JOIN repos r ON r.id = it.repo_id
36┆ LEFT JOIN users u ON r.owner_kind = 'user' AND u.id = r.owner_id
37┆ LEFT JOIN orgs o ON r.owner_kind = 'org' AND o.id = r.owner_id
38┆ WHERE c.kind = 'comment' AND (c.body LIKE %s)`, table, itemTable, fk, likeClause)
internal/store/labels.go
❯❱ opt.opengrep-rules.go.lang.security.audit.database.string-formatted-query
String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized
properly. Audit this call to ensure the SQL is not manipulable by external data.
39┆ q := `SELECT l.name, l.color, l.org_id IS NOT NULL,
40┆ (SELECT COUNT(*) FROM issue_labels il JOIN issues i ON i.id = il.issue_id
41┆ WHERE il.label_id = l.id AND i.repo_id IN ` + in + `),
42┆ (SELECT COUNT(*) FROM mr_labels ml JOIN merge_requests m ON m.id = ml.mr_id
43┆ WHERE ml.label_id = l.id AND m.repo_id IN ` + in + `)
44┆ FROM labels l WHERE ` + where + ` ORDER BY l.org_id IS NULL, l.name`
internal/store/savedqueries.go
❯❱ opt.opengrep-rules.go.lang.security.audit.database.string-formatted-query
String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized
properly. Audit this call to ensure the SQL is not manipulable by external data.
269┆ q = "SELECT * FROM (" + q + ") ORDER BY created_at DESC, kord DESC, id DESC"
internal/store/statuses.go
❯❱ opt.opengrep-rules.go.lang.security.audit.database.string-formatted-query
String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized
properly. Audit this call to ensure the SQL is not manipulable by external data.
99┆ q := `SELECT commit_sha, state FROM commit_statuses WHERE repo_id = ? AND commit_sha IN (?`
+
100┆ strings.Repeat(",?", len(shas)-1) + `)`
internal/store/store.go
❯❱ opt.opengrep-rules.go.lang.correctness.permissions.incorrect-default-permission
Detected file permissions that are set to more than `0600` (user/owner can read and write). Setting
file permissions to higher than `0600` is most likely unnecessary and violates the principle of
least privilege. Instead, set permissions to be `0600` or less for os.Chmod, os.Mkdir, os.OpenFile,
os.MkdirAll, and ioutil.WriteFile
▶▶┆ Autofix ▶ 0600
80┆ if err := os.Chmod(path, 0o640); err != nil && !errors.Is(err, fs.ErrNotExist) {
internal/web/templates/account.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
30┆ <form method="post" action="/settings" class="setform stack">
31┆ <input type="hidden" name="field" value="profile">
32┆ <label for="p-description">Description</label>
33┆ <input type="text" id="p-description" name="description" value="{{.Profile.Description}}"
placeholder="one line, shown in listings">
34┆ <label for="p-website">Website</label>
35┆ <input type="text" id="p-website" name="website" value="{{.Profile.Website}}"
placeholder="https://example.org">
36┆ <label for="p-links">Links</label>
37┆ <textarea id="p-links" name="links" rows="3" placeholder="one per line: label|https://…
or a bare https://… (at most 5)">{{.LinksText}}</textarea>
38┆ <span class="btngroup"><button type="submit" class="btn">Save profile</button></span>
39┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
44┆ {{if .AboutEdit}}<p><a class="btn" href="{{.AboutEdit}}">Edit
{{.Profile.AboutPath}}</a></p>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
45┆ {{else}}<form method="post" action="/settings" class="setform">
46┆ <input type="hidden" name="field" value="profile-repo">
47┆ <button type="submit" class="btn">Create {{.AboutRepo}}</button>
48┆ </form>{{end}}
⋮┆----------------------------------------
61┆ <td class="act"><form method="post" action="/settings"><input type="hidden" name="field"
value="key-remove"><input type="hidden" name="fingerprint"
value="{{.Fingerprint}}">{{template "confirmfield" .Confirm}} <button type="submit"
class="danger">Remove</button></form></td>
⋮┆----------------------------------------
67┆ <form method="post" action="/settings" class="setform stack">
68┆ <input type="hidden" name="field" value="key-add">
69┆ <label for="key">Public key</label>
70┆ <textarea id="key" name="key" rows="3" required spellcheck="false" placeholder="ssh-
ed25519 AAAA… you@machine"></textarea>
71┆ <label for="key-label">Label</label>
72┆ <input id="key-label" name="label" maxlength="64" placeholder="defaults to the key's
comment">
73┆ <label for="scope">Scope</label>
74┆ <select id="scope" name="scope">
75┆ <option value="full">full: commands and git</option>
76┆ <option value="git">git: git transport only</option>
[hid 3 additional lines, adjust with --max-lines-per-finding]
91┆ {{if not .Primary}}{{if .Verified}}<form method="post" action="/settings"
class="inline"><input type="hidden" name="field" value="email-primary"><input type="hidden"
name="address" value="{{.Address}}"><button type="submit" class="linklike">Make
primary</button></form>{{end}}
⋮┆----------------------------------------
92┆ <form method="post" action="/settings" class="inline"><input type="hidden" name="field"
value="email-remove"><input type="hidden" name="address" value="{{.Address}}">{{template
"confirmfield" .Address}} <button type="submit"
class="danger">Remove</button></form>{{end}}</li>
⋮┆----------------------------------------
96┆ <form method="post" action="/settings" class="setform">
97┆ <input type="hidden" name="field" value="email-add">
98┆ <label for="address">Address</label>
99┆ <input type="email" id="address" name="address" required autocomplete="email"
placeholder="you@example.org">
100┆ <button type="submit" class="btn">Send code</button>
101┆ </form>
⋮┆----------------------------------------
102┆ <form method="post" action="/settings" class="setform">
103┆ <input type="hidden" name="field" value="email-verify">
104┆ <label for="code">Verification code</label>
105┆ <input type="text" id="code" name="code" required autocomplete="one-time-code"
autocapitalize="none" spellcheck="false" placeholder="from the mail">
106┆ <button type="submit" class="btn">Verify</button>
107┆ </form>
⋮┆----------------------------------------
119┆ <td class="act"><form method="post" action="/settings"><input type="hidden" name="field"
value="pgp-remove"><input type="hidden" name="fingerprint"
value="{{.Fingerprint}}">{{template "confirmfield" .Confirm}} <button type="submit"
class="danger">Remove</button></form></td>
⋮┆----------------------------------------
125┆ <form method="post" action="/settings" class="setform stack">
126┆ <input type="hidden" name="field" value="pgp-add">
127┆ <label for="pgpkey">Armored public key</label>
128┆ <textarea id="pgpkey" name="key" rows="6" required placeholder="-----BEGIN PGP PUBLIC KEY
BLOCK-----"></textarea>
129┆ <button type="submit" class="btn">Add key</button>
130┆ </form>
⋮┆----------------------------------------
135┆ <form method="post" action="/settings" class="setform">
136┆ <input type="hidden" name="field" value="notify-mail">
137┆ <label for="notify-mail">Activity by mail</label>
138┆ <div class="check"><input type="checkbox" id="notify-mail" name="mail" value="on"{{if
.MailOn}} checked{{end}}></div>
139┆ <button type="submit" class="btn">Save</button>
140┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
138┆ <div class="check"><input type="checkbox" id="notify-mail" name="mail" value="on"{{if
.MailOn}} checked{{end}}></div>
⋮┆----------------------------------------
138┆ <div class="check"><input type="checkbox" id="notify-mail" name="mail" value="on"{{if
.MailOn}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
142┆ {{if .ReplyOffered}}<form method="post" action="/settings" class="setform">
143┆ <input type="hidden" name="field" value="notify-reply">
144┆ <label for="notify-reply">Reply to mail to comment</label>
145┆ <div class="check"><input type="checkbox" id="notify-reply" name="reply" value="on"{{if
.ReplyOn}} checked{{end}}></div>
146┆ <button type="submit" class="btn">Save</button>
147┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
145┆ <div class="check"><input type="checkbox" id="notify-reply" name="reply" value="on"{{if
.ReplyOn}} checked{{end}}></div>
⋮┆----------------------------------------
145┆ <div class="check"><input type="checkbox" id="notify-reply" name="reply" value="on"{{if
.ReplyOn}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
149┆ {{end}}<form method="post" action="/settings" class="setform">
150┆ <input type="hidden" name="field" value="notify-watch">
151┆ <label for="notify-watch">Watch repositories you can write to</label>
152┆ <div class="check"><input type="checkbox" id="notify-watch" name="watch" value="on"{{if
.WatchOn}} checked{{end}}></div>
153┆ <button type="submit" class="btn">Save</button>
154┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
152┆ <div class="check"><input type="checkbox" id="notify-watch" name="watch" value="on"{{if
.WatchOn}} checked{{end}}></div>
⋮┆----------------------------------------
152┆ <div class="check"><input type="checkbox" id="notify-watch" name="watch" value="on"{{if
.WatchOn}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
156┆ <form method="post" action="/settings" class="setform">
157┆ <input type="hidden" name="field" value="notify-push">
158┆ <label for="notify-push">Activity on your registered devices</label>
159┆ <div class="check"><input type="checkbox" id="notify-push" name="push" value="on"{{if
.PushOn}} checked{{end}}></div>
160┆ <button type="submit" class="btn">Save</button>
161┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
159┆ <div class="check"><input type="checkbox" id="notify-push" name="push" value="on"{{if
.PushOn}} checked{{end}}></div>
⋮┆----------------------------------------
159┆ <div class="check"><input type="checkbox" id="notify-push" name="push" value="on"{{if
.PushOn}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
171┆ <td class="act"><form method="post" action="/settings"><input type="hidden" name="field"
value="device-remove"><input type="hidden" name="id" value="{{.ID}}">{{template
"confirmfield" .Confirm}} <button type="submit" class="danger">Remove</button></form></td>
⋮┆----------------------------------------
180┆ <form method="post" action="/settings" class="setform">
181┆ <input type="hidden" name="field" value="theme">
182┆ <label for="theme">Colour scheme</label>
183┆ <select id="theme" name="theme">
184┆ <option value="system"{{if eq .ThemeSetting "system"}} selected{{end}}>follow the
browser</option>
185┆ <option value="light"{{if eq .ThemeSetting "light"}} selected{{end}}>light</option>
186┆ <option value="dark"{{if eq .ThemeSetting "dark"}} selected{{end}}>dark</option>
187┆ </select>
188┆ <button type="submit" class="btn">Save</button>
189┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
184┆ <option value="system"{{if eq .ThemeSetting "system"}} selected{{end}}>follow the
browser</option>
⋮┆----------------------------------------
184┆ <option value="system"{{if eq .ThemeSetting "system"}} selected{{end}}>follow the
browser</option>
⋮┆----------------------------------------
185┆ <option value="light"{{if eq .ThemeSetting "light"}} selected{{end}}>light</option>
⋮┆----------------------------------------
185┆ <option value="light"{{if eq .ThemeSetting "light"}} selected{{end}}>light</option>
⋮┆----------------------------------------
186┆ <option value="dark"{{if eq .ThemeSetting "dark"}} selected{{end}}>dark</option>
⋮┆----------------------------------------
186┆ <option value="dark"{{if eq .ThemeSetting "dark"}} selected{{end}}>dark</option>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
191┆ <form method="post" action="/settings" class="setform">
192┆ <input type="hidden" name="field" value="diff-layout">
193┆ <label for="layout">Diff layout</label>
194┆ <select id="layout" name="layout">
195┆ <option value="unified"{{if ne .DiffSetting "split"}} selected{{end}}>unified</option>
196┆ <option value="split"{{if eq .DiffSetting "split"}} selected{{end}}>side by
side</option>
197┆ </select>
198┆ <button type="submit" class="btn">Save</button>
199┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
195┆ <option value="unified"{{if ne .DiffSetting "split"}} selected{{end}}>unified</option>
⋮┆----------------------------------------
195┆ <option value="unified"{{if ne .DiffSetting "split"}} selected{{end}}>unified</option>
⋮┆----------------------------------------
196┆ <option value="split"{{if eq .DiffSetting "split"}} selected{{end}}>side by side</option>
⋮┆----------------------------------------
196┆ <option value="split"{{if eq .DiffSetting "split"}} selected{{end}}>side by side</option>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
225┆ <td class="act"><form method="post" action="/settings"><input type="hidden" name="field"
value="token-revoke"><input type="hidden" name="name" value="{{.Name}}">{{template
"confirmfield" .Name}} <button type="submit" class="danger">Revoke</button></form></td>
⋮┆----------------------------------------
231┆ <form method="post" action="/settings" class="setform stack">
232┆ <input type="hidden" name="field" value="token-create">
233┆ <label for="token-name">Name</label>
234┆ <input id="token-name" name="name" required autocomplete="off" placeholder="e.g. iphone">
235┆ <label for="token-scope">Scope</label>
236┆ <select id="token-scope" name="scope">
237┆ <option value="read" selected>read: read-only commands</option>
238┆ <option value="full">full: everything your account can do</option>
239┆ </select>
240┆ <label for="token-ttl">Expires after</label>
[hid 3 additional lines, adjust with --max-lines-per-finding]
263┆ <form method="post" action="/settings" class="setform"><input type="hidden" name="field"
value="account-delete">{{template "confirmfield" .Viewer}} <button type="submit"
class="danger">Mail the deletion link</button></form>
internal/web/templates/accountdelete.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
15┆ <form method="post">
16┆ <p class="btngroup"><button type="submit" class="danger">Delete {{.User}}</button> <a
href="/">Cancel</a></p>
17┆ </form>
internal/web/templates/adminusers.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
13┆ <a {{if eq .State "all"}}class="active" aria-current="page"
{{end}}href="?state=all">all</a>
⋮┆----------------------------------------
13┆ <a {{if eq .State "all"}}class="active" aria-current="page"
{{end}}href="?state=all">all</a>
⋮┆----------------------------------------
14┆ <a {{if eq .State "active"}}class="active" aria-current="page"
{{end}}href="?state=active">active</a>
⋮┆----------------------------------------
14┆ <a {{if eq .State "active"}}class="active" aria-current="page"
{{end}}href="?state=active">active</a>
⋮┆----------------------------------------
15┆ <a {{if eq .State "pending"}}class="active" aria-current="page"
{{end}}href="?state=pending">pending</a>
⋮┆----------------------------------------
15┆ <a {{if eq .State "pending"}}class="active" aria-current="page"
{{end}}href="?state=pending">pending</a>
⋮┆----------------------------------------
16┆ <a {{if eq .State "disabled"}}class="active" aria-current="page"
{{end}}href="?state=disabled">disabled</a>
⋮┆----------------------------------------
16┆ <a {{if eq .State "disabled"}}class="active" aria-current="page"
{{end}}href="?state=disabled">disabled</a>
⋮┆----------------------------------------
17┆ <a {{if eq .State "admin"}}class="active" aria-current="page"
{{end}}href="?state=admin">admins</a>
⋮┆----------------------------------------
17┆ <a {{if eq .State "admin"}}class="active" aria-current="page"
{{end}}href="?state=admin">admins</a>
⋮┆----------------------------------------
25┆ <td><span class="chip {{if eq .State "active"}}chip-open{{else if eq .State
"disabled"}}chip-closed{{else}}chip-neutral{{end}}">{{.State}}</span></td>
⋮┆----------------------------------------
25┆ <td><span class="chip {{if eq .State "active"}}chip-open{{else if eq .State
"disabled"}}chip-closed{{else}}chip-neutral{{end}}">{{.State}}</span></td>
⋮┆----------------------------------------
25┆ <td><span class="chip {{if eq .State "active"}}chip-open{{else if eq .State
"disabled"}}chip-closed{{else}}chip-neutral{{end}}">{{.State}}</span></td>
⋮┆----------------------------------------
25┆ <td><span class="chip {{if eq .State "active"}}chip-open{{else if eq .State
"disabled"}}chip-closed{{else}}chip-neutral{{end}}">{{.State}}</span></td>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
30┆ <form method="post" action="/admin/users" class="actions">
31┆ <input type="hidden" name="field" value="demote">
32┆ <input type="hidden" name="user" value="{{.Username}}">
33┆ <input type="hidden" name="state" value="{{$.State}}">
34┆ {{template "confirmfield" .Username}} <button type="submit" class="btn">Demote</button>
35┆ </form>
⋮┆----------------------------------------
37┆ <form method="post" action="/admin/users" class="actions">
38┆ <input type="hidden" name="field" value="promote">
39┆ <input type="hidden" name="user" value="{{.Username}}">
40┆ <input type="hidden" name="state" value="{{$.State}}">
41┆ {{template "confirmfield" .Username}} <button type="submit" class="btn">Promote</button>
42┆ </form>
⋮┆----------------------------------------
49┆ <form method="post" action="/admin/users" class="actions" title="Only an active account can
be promoted">
50┆ <button type="submit" class="btn" disabled>Promote</button>
51┆ </form>
⋮┆----------------------------------------
54┆ <form method="post" action="/admin/users" class="actions">
55┆ <input type="hidden" name="field" value="enable">
56┆ <input type="hidden" name="user" value="{{.Username}}">
57┆ <input type="hidden" name="state" value="{{$.State}}">
58┆ <button type="submit" class="btn">Enable</button>
59┆ </form>
⋮┆----------------------------------------
61┆ <form method="post" action="/admin/users" class="actions">
62┆ <input type="hidden" name="field" value="disable">
63┆ <input type="hidden" name="user" value="{{.Username}}">
64┆ <input type="hidden" name="state" value="{{$.State}}">
65┆ {{template "confirmfield" .Username}} <button type="submit" class="btn">Disable</button>
66┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
72┆ {{if .Next}}<p class="pager"><a href="{{.Next}}">more →</a></p>{{end}}
internal/web/templates/blame.html
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
10┆ <span class="crumbs"><a
href="/{{.Repo.OwnerName}}/{{.Repo.Name}}">{{.Repo.Name}}</a>/{{range .Crumbs}}<a
href="{{.URL}}">{{.Name}}</a>/{{end}}<strong>{{.Base}}</strong></span>
internal/web/templates/blob.html
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
10┆ <span class="crumbs"><a
href="/{{.Repo.OwnerName}}/{{.Repo.Name}}">{{.Repo.Name}}</a>/{{range .Crumbs}}<a
href="{{.URL}}">{{.Name}}</a>/{{end}}<strong>{{.Base}}</strong></span>
⋮┆----------------------------------------
16┆ <ul>{{range .Symbols}}<li><a href="{{if
$.Rendered}}?view=source{{end}}#L{{.Line}}"><code>{{.Name}}</code></a> <span
class="meta">{{.Kind}}, line {{.Line}}</span></li>
internal/web/templates/build.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
9┆ <form method="post"
action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds/{{.Build.Number}}/cancel"
class="actions">
10┆ <button type="submit" class="btn">{{if eq .Build.Status "running"}}Cancel (stops at the
runner's next check){{else}}Cancel{{end}}</button>
11┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
18┆ <details class="difffold buildstep"{{if .Failed}} id="failed" open{{end}}>
⋮┆----------------------------------------
18┆ <details class="difffold buildstep"{{if .Failed}} id="failed" open{{end}}>
internal/web/templates/builds.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
10┆ <ul>{{range .Items}}<li><a{{if .Active}} aria-current="page"{{end}}
href="{{.Href}}">{{.Label}}</a></li>{{end}}</ul>
⋮┆----------------------------------------
10┆ <ul>{{range .Items}}<li><a{{if .Active}} aria-current="page"{{end}}
href="{{.Href}}">{{.Label}}</a></li>{{end}}</ul>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
10┆ <ul>{{range .Items}}<li><a{{if .Active}} aria-current="page"{{end}}
href="{{.Href}}">{{.Label}}</a></li>{{end}}</ul>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
28┆ <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds" class="setform">
29┆ <label for="job">Run a job now</label>
30┆ <select id="job" name="job">
31┆ {{range .Jobs}}<option value="{{.Name}}">{{.Name}}{{if .Schedule}} (schedule
{{.Schedule}}){{else if .Tags}} (tags {{.Tags}}){{end}}</option>{{end}}
32┆ </select>
33┆ <button type="submit" class="btn">Run</button>
34┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
57┆ {{if .Older}}<p class="pager"><a href="{{.Older}}">older →</a></p>{{end}}
internal/web/templates/dashboard.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
27┆ {{range .Pins}}<li><a href="/{{.Owner}}/{{.Name}}"><span
class="owner">{{.Owner}}/</span>{{.Name}}</a><span class="n" title="{{.Issues}} open
issue{{if ne .Issues 1}}s{{end}}, {{.MRs}} open merge request{{if ne .MRs 1}}s{{end}}{{with
.Build}}, last build {{.}}{{end}}"><b{{if .Issues}} class="wants"{{end}}>{{.Issues}} <span
class="vh">open issues</span></b> <b{{if .MRs}} class="wants"{{end}}>{{.MRs}} <span
class="vh">open merge requests</span></b> <span class="dot{{if eq .Build "success"}}
ok{{else if or (eq .Build "failure") (eq .Build "error")}} bad{{else if or (eq .Build
"pending") (eq .Build "running")}} pend{{end}}"><span class="vh">{{with .Build}}last build
{{.}}{{else}}no builds{{end}}</span></span></span></li>
⋮┆----------------------------------------
27┆ {{range .Pins}}<li><a href="/{{.Owner}}/{{.Name}}"><span
class="owner">{{.Owner}}/</span>{{.Name}}</a><span class="n" title="{{.Issues}} open
issue{{if ne .Issues 1}}s{{end}}, {{.MRs}} open merge request{{if ne .MRs 1}}s{{end}}{{with
.Build}}, last build {{.}}{{end}}"><b{{if .Issues}} class="wants"{{end}}>{{.Issues}} <span
class="vh">open issues</span></b> <b{{if .MRs}} class="wants"{{end}}>{{.MRs}} <span
class="vh">open merge requests</span></b> <span class="dot{{if eq .Build "success"}}
ok{{else if or (eq .Build "failure") (eq .Build "error")}} bad{{else if or (eq .Build
"pending") (eq .Build "running")}} pend{{end}}"><span class="vh">{{with .Build}}last build
{{.}}{{else}}no builds{{end}}</span></span></span></li>
⋮┆----------------------------------------
27┆ {{range .Pins}}<li><a href="/{{.Owner}}/{{.Name}}"><span
class="owner">{{.Owner}}/</span>{{.Name}}</a><span class="n" title="{{.Issues}} open
issue{{if ne .Issues 1}}s{{end}}, {{.MRs}} open merge request{{if ne .MRs 1}}s{{end}}{{with
.Build}}, last build {{.}}{{end}}"><b{{if .Issues}} class="wants"{{end}}>{{.Issues}} <span
class="vh">open issues</span></b> <b{{if .MRs}} class="wants"{{end}}>{{.MRs}} <span
class="vh">open merge requests</span></b> <span class="dot{{if eq .Build "success"}}
ok{{else if or (eq .Build "failure") (eq .Build "error")}} bad{{else if or (eq .Build
"pending") (eq .Build "running")}} pend{{end}}"><span class="vh">{{with .Build}}last build
{{.}}{{else}}no builds{{end}}</span></span></span></li>
⋮┆----------------------------------------
27┆ {{range .Pins}}<li><a href="/{{.Owner}}/{{.Name}}"><span
class="owner">{{.Owner}}/</span>{{.Name}}</a><span class="n" title="{{.Issues}} open
issue{{if ne .Issues 1}}s{{end}}, {{.MRs}} open merge request{{if ne .MRs 1}}s{{end}}{{with
.Build}}, last build {{.}}{{end}}"><b{{if .Issues}} class="wants"{{end}}>{{.Issues}} <span
class="vh">open issues</span></b> <b{{if .MRs}} class="wants"{{end}}>{{.MRs}} <span
class="vh">open merge requests</span></b> <span class="dot{{if eq .Build "success"}}
ok{{else if or (eq .Build "failure") (eq .Build "error")}} bad{{else if or (eq .Build
"pending") (eq .Build "running")}} pend{{end}}"><span class="vh">{{with .Build}}last build
{{.}}{{else}}no builds{{end}}</span></span></span></li>
⋮┆----------------------------------------
27┆ {{range .Pins}}<li><a href="/{{.Owner}}/{{.Name}}"><span
class="owner">{{.Owner}}/</span>{{.Name}}</a><span class="n" title="{{.Issues}} open
issue{{if ne .Issues 1}}s{{end}}, {{.MRs}} open merge request{{if ne .MRs 1}}s{{end}}{{with
.Build}}, last build {{.}}{{end}}"><b{{if .Issues}} class="wants"{{end}}>{{.Issues}} <span
class="vh">open issues</span></b> <b{{if .MRs}} class="wants"{{end}}>{{.MRs}} <span
class="vh">open merge requests</span></b> <span class="dot{{if eq .Build "success"}}
ok{{else if or (eq .Build "failure") (eq .Build "error")}} bad{{else if or (eq .Build
"pending") (eq .Build "running")}} pend{{end}}"><span class="vh">{{with .Build}}last build
{{.}}{{else}}no builds{{end}}</span></span></span></li>
⋮┆----------------------------------------
27┆ {{range .Pins}}<li><a href="/{{.Owner}}/{{.Name}}"><span
class="owner">{{.Owner}}/</span>{{.Name}}</a><span class="n" title="{{.Issues}} open
issue{{if ne .Issues 1}}s{{end}}, {{.MRs}} open merge request{{if ne .MRs 1}}s{{end}}{{with
.Build}}, last build {{.}}{{end}}"><b{{if .Issues}} class="wants"{{end}}>{{.Issues}} <span
class="vh">open issues</span></b> <b{{if .MRs}} class="wants"{{end}}>{{.MRs}} <span
class="vh">open merge requests</span></b> <span class="dot{{if eq .Build "success"}}
ok{{else if or (eq .Build "failure") (eq .Build "error")}} bad{{else if or (eq .Build
"pending") (eq .Build "running")}} pend{{end}}"><span class="vh">{{with .Build}}last build
{{.}}{{else}}no builds{{end}}</span></span></span></li>
⋮┆----------------------------------------
27┆ {{range .Pins}}<li><a href="/{{.Owner}}/{{.Name}}"><span
class="owner">{{.Owner}}/</span>{{.Name}}</a><span class="n" title="{{.Issues}} open
issue{{if ne .Issues 1}}s{{end}}, {{.MRs}} open merge request{{if ne .MRs 1}}s{{end}}{{with
.Build}}, last build {{.}}{{end}}"><b{{if .Issues}} class="wants"{{end}}>{{.Issues}} <span
class="vh">open issues</span></b> <b{{if .MRs}} class="wants"{{end}}>{{.MRs}} <span
class="vh">open merge requests</span></b> <span class="dot{{if eq .Build "success"}}
ok{{else if or (eq .Build "failure") (eq .Build "error")}} bad{{else if or (eq .Build
"pending") (eq .Build "running")}} pend{{end}}"><span class="vh">{{with .Build}}last build
{{.}}{{else}}no builds{{end}}</span></span></span></li>
⋮┆----------------------------------------
27┆ {{range .Pins}}<li><a href="/{{.Owner}}/{{.Name}}"><span
class="owner">{{.Owner}}/</span>{{.Name}}</a><span class="n" title="{{.Issues}} open
issue{{if ne .Issues 1}}s{{end}}, {{.MRs}} open merge request{{if ne .MRs 1}}s{{end}}{{with
.Build}}, last build {{.}}{{end}}"><b{{if .Issues}} class="wants"{{end}}>{{.Issues}} <span
class="vh">open issues</span></b> <b{{if .MRs}} class="wants"{{end}}>{{.MRs}} <span
class="vh">open merge requests</span></b> <span class="dot{{if eq .Build "success"}}
ok{{else if or (eq .Build "failure") (eq .Build "error")}} bad{{else if or (eq .Build
"pending") (eq .Build "running")}} pend{{end}}"><span class="vh">{{with .Build}}last build
{{.}}{{else}}no builds{{end}}</span></span></span></li>
⋮┆----------------------------------------
52┆ <p class="title"><a href="/{{.Repo}}/{{if eq .Kind
"mr"}}mrs{{else}}issues{{end}}/{{.Number}}">{{.Title}}</a></p>
⋮┆----------------------------------------
52┆ <p class="title"><a href="/{{.Repo}}/{{if eq .Kind
"mr"}}mrs{{else}}issues{{end}}/{{.Number}}">{{.Title}}</a></p>
⋮┆----------------------------------------
52┆ <p class="title"><a href="/{{.Repo}}/{{if eq .Kind
"mr"}}mrs{{else}}issues{{end}}/{{.Number}}">{{.Title}}</a></p>
⋮┆----------------------------------------
52┆ <p class="title"><a href="/{{.Repo}}/{{if eq .Kind
"mr"}}mrs{{else}}issues{{end}}/{{.Number}}">{{.Title}}</a></p>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
65┆ {{range .Feed}}<p class="feedline"><a href="/{{.Actor}}">{{.Actor}}</a> {{.Verb}} <a
href="{{.URL}}"{{if .Jobs}} title="{{join .Jobs ", "}}"{{end}}>{{.Ref}}</a>{{if .Extra}}
{{.Extra}}{{end}}<br><span class="none">{{.Repo}} · <span title="{{whenT .WhenT}}">{{ago
.WhenT}}</span></span></p>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
65┆ {{range .Feed}}<p class="feedline"><a href="/{{.Actor}}">{{.Actor}}</a> {{.Verb}} <a
href="{{.URL}}"{{if .Jobs}} title="{{join .Jobs ", "}}"{{end}}>{{.Ref}}</a>{{if .Extra}}
{{.Extra}}{{end}}<br><span class="none">{{.Repo}} · <span title="{{whenT .WhenT}}">{{ago
.WhenT}}</span></span></p>
⋮┆----------------------------------------
65┆ {{range .Feed}}<p class="feedline"><a href="/{{.Actor}}">{{.Actor}}</a> {{.Verb}} <a
href="{{.URL}}"{{if .Jobs}} title="{{join .Jobs ", "}}"{{end}}>{{.Ref}}</a>{{if .Extra}}
{{.Extra}}{{end}}<br><span class="none">{{.Repo}} · <span title="{{whenT .WhenT}}">{{ago
.WhenT}}</span></span></p>
⋮┆----------------------------------------
65┆ {{range .Feed}}<p class="feedline"><a href="/{{.Actor}}">{{.Actor}}</a> {{.Verb}} <a
href="{{.URL}}"{{if .Jobs}} title="{{join .Jobs ", "}}"{{end}}>{{.Ref}}</a>{{if .Extra}}
{{.Extra}}{{end}}<br><span class="none">{{.Repo}} · <span title="{{whenT .WhenT}}">{{ago
.WhenT}}</span></span></p>
internal/web/templates/edit.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
12┆ <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/edit/{{.Ref}}/{{.Path}}"
class="editform">
13┆ <p><textarea name="content" aria-label="File contents" rows="24"
spellcheck="false">{{.Content}}</textarea></p>
14┆ <p><input name="message" aria-label="Commit message" placeholder="commit message"
value="{{.Draft.Or "content" "message" ""}}">
15┆ <button type="submit">Commit to {{.Ref}}</button>{{if .Markup}} {{template
"previewbtn"}}{{end}}</p>
16┆ <p class="crumbs">this commit will be unsigned and authored as {{.Viewer}}</p>
17┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
14┆ <p><input name="message" aria-label="Commit message" placeholder="commit message"
value="{{.Draft.Or "content" "message" ""}}">
internal/web/templates/explore.html
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
20┆ {{if gt .Pages 1}}<p class="pager">page {{.Page}} of {{.Pages}}{{with .Prev}} · <a
href="{{.}}">← newer</a>{{end}}{{with .Next}} · <a href="{{.}}">older
→</a>{{end}}</p>{{end}}
⋮┆----------------------------------------
20┆ {{if gt .Pages 1}}<p class="pager">page {{.Page}} of {{.Pages}}{{with .Prev}} · <a
href="{{.}}">← newer</a>{{end}}{{with .Next}} · <a href="{{.}}">older
→</a>{{end}}</p>{{end}}
internal/web/templates/fork.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
9┆ <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/fork">
10┆ <p><label>Owner <select name="owner">
11┆ <option value="{{.Viewer}}">{{.Viewer}}</option>
12┆ {{range .Orgs}}<option value="{{.}}"{{if eq . $.Owner}}
selected{{end}}>{{.}}</option>{{end}}
13┆ </select></label>
14┆ <label>/ Name <input name="name" required maxlength="63"
pattern="[a-z0-9][a-z0-9._\-]{0,62}" value="{{.Name}}" aria-describedby="forkhint"
autocomplete="off" spellcheck="false"></label>
15┆ <span class="hint" id="forkhint">Defaults to the source name; change it to fork twice into
the same owner.</span></p>
16┆ <p><button type="submit">Create fork</button></p>
17┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
12┆ {{range .Orgs}}<option value="{{.}}"{{if eq . $.Owner}}
selected{{end}}>{{.}}</option>{{end}}
⋮┆----------------------------------------
12┆ {{range .Orgs}}<option value="{{.}}"{{if eq . $.Owner}}
selected{{end}}>{{.}}</option>{{end}}
internal/web/templates/globalsearch.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
10┆ <li><a{{if eq .Kind ""}} aria-current="page"{{end}}
href="?q={{.Query}}">everything</a></li>
⋮┆----------------------------------------
10┆ <li><a{{if eq .Kind ""}} aria-current="page"{{end}}
href="?q={{.Query}}">everything</a></li>
⋮┆----------------------------------------
11┆ <li><a{{if eq .Kind "repo"}} aria-current="page"{{end}}
href="?q={{.Query}}&kind=repo">repositories</a></li>
⋮┆----------------------------------------
11┆ <li><a{{if eq .Kind "repo"}} aria-current="page"{{end}}
href="?q={{.Query}}&kind=repo">repositories</a></li>
⋮┆----------------------------------------
12┆ <li><a{{if eq .Kind "issue"}} aria-current="page"{{end}}
href="?q={{.Query}}&kind=issue">issues</a></li>
⋮┆----------------------------------------
12┆ <li><a{{if eq .Kind "issue"}} aria-current="page"{{end}}
href="?q={{.Query}}&kind=issue">issues</a></li>
⋮┆----------------------------------------
13┆ <li><a{{if eq .Kind "mr"}} aria-current="page"{{end}}
href="?q={{.Query}}&kind=mr">merge requests</a></li>
⋮┆----------------------------------------
13┆ <li><a{{if eq .Kind "mr"}} aria-current="page"{{end}}
href="?q={{.Query}}&kind=mr">merge requests</a></li>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
33┆ <p class="title"><a href="{{.Href}}">{{if
.Number}}{{.Title}}{{else}}{{.Repo}}{{end}}</a></p>
internal/web/templates/issue.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
4┆ <p class="issuemeta"><span class="chip {{if eq .Issue.State "open"}}chip-open{{else}}chip-
done{{end}}">{{.Issue.State}}</span>
⋮┆----------------------------------------
4┆ <p class="issuemeta"><span class="chip {{if eq .Issue.State "open"}}chip-open{{else}}chip-
done{{end}}">{{.Issue.State}}</span>
⋮┆----------------------------------------
4┆ <p class="issuemeta"><span class="chip {{if eq .Issue.State "open"}}chip-open{{else}}chip-
done{{end}}">{{.Issue.State}}</span>
⋮┆----------------------------------------
14┆ {{if .CanEdit}}<details class="editbox"{{if .Draft.Is "edit"}}
open{{end}}><summary>edit</summary>
⋮┆----------------------------------------
14┆ {{if .CanEdit}}<details class="editbox"{{if .Draft.Is "edit"}}
open{{end}}><summary>edit</summary>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
16┆ <form method="post"
action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Issue.Number}}/edit"
class="commentform">
17┆ <p><input type="text" name="title" aria-label="Title" value="{{.Draft.Or "edit" "title"
.Issue.Title}}" required></p>
18┆ <p><textarea name="body" aria-label="Description" rows="8">{{.Draft.Or "edit" "body"
.Issue.Body}}</textarea></p>
19┆ <p><input type="text" name="labels" aria-label="Labels" value="{{$.Draft.Or "edit" "labels"
(join .Issue.Labels " ")}}" placeholder="labels, space-separated (write access)"></p>
20┆ <p><button type="submit" class="btn">Save</button> {{template "previewbtn"}}</p>
21┆ </form></details>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
17┆ <p><input type="text" name="title" aria-label="Title" value="{{.Draft.Or "edit" "title"
.Issue.Title}}" required></p>
⋮┆----------------------------------------
19┆ <p><input type="text" name="labels" aria-label="Labels" value="{{$.Draft.Or "edit" "labels"
(join .Issue.Labels " ")}}" placeholder="labels, space-separated (write access)"></p>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
37┆ <form method="post"
action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Issue.Number}}/comment"
class="commentform">
38┆ <p><textarea name="body" aria-label="Comment" rows="4" placeholder="Comment as
{{.Viewer}}">{{.Draft.Or "comment" "body" ""}}</textarea></p>
39┆ <p><button type="submit">Comment</button> {{template "previewbtn"}}</p>
40┆ </form>
⋮┆----------------------------------------
49┆ <form method="post" action="{{$base}}/state" class="actions">
50┆ {{if eq .Issue.State "open"}}<button type="submit" name="action" value="close">Close
issue</button>
51┆ {{else}}<button type="submit" name="action" value="reopen">Reopen issue</button>{{end}}
52┆ </form>
⋮┆----------------------------------------
60┆ <form method="post" action="{{$base}}/label" class="actions">
61┆ <input type="text" name="add" aria-label="Add labels" autocomplete="off"
spellcheck="false" placeholder="add, space-separated">
62┆ <input type="text" name="remove" aria-label="Remove labels" autocomplete="off"
spellcheck="false" placeholder="remove">
63┆ <button type="submit" class="btn">Apply</button>
64┆ </form>
⋮┆----------------------------------------
72┆ <form method="post" action="{{$base}}/assign" class="actions">
73┆ <input type="text" name="add" aria-label="Add assignees" autocomplete="off"
spellcheck="false" placeholder="add, space-separated">
74┆ <input type="text" name="remove" aria-label="Remove assignees" autocomplete="off"
spellcheck="false" placeholder="remove">
75┆ <button type="submit" class="btn">Apply</button>
76┆ </form>
⋮┆----------------------------------------
84┆ <form method="post" action="{{$base}}/milestone" class="actions">
85┆ <label class="none" for="milestone">Set milestone</label>
86┆ <select id="milestone" name="milestone">
87┆ <option value="none">No milestone</option>
88┆ {{range .Milestones}}<option value="{{.Title}}"{{if eq .Title $.Issue.Milestone}}
selected{{end}}>{{.Title}}</option>{{end}}
89┆ </select>
90┆ <button type="submit" class="btn">Apply</button>
91┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
88┆ {{range .Milestones}}<option value="{{.Title}}"{{if eq .Title $.Issue.Milestone}}
selected{{end}}>{{.Title}}</option>{{end}}
⋮┆----------------------------------------
88┆ {{range .Milestones}}<option value="{{.Title}}"{{if eq .Title $.Issue.Milestone}}
selected{{end}}>{{.Title}}</option>{{end}}
internal/web/templates/issuenew.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
9┆ <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/new"
class="commentform">
10┆ <p><input type="text" name="title" aria-label="Title" placeholder="title"
value="{{.Title}}" required></p>
11┆ <p><textarea name="body" aria-label="Description" rows="12">{{.Body}}</textarea></p>
12┆ {{template "formatpicker" .Format}}
13┆ {{if .CanWrite}}
14┆ <p><input type="text" name="labels" aria-label="Labels" placeholder="labels, space-
separated (optional)" value="{{.Labels}}"></p>
15┆ <p><input type="text" name="milestone" aria-label="Milestone" placeholder="milestone
(optional)" value="{{.Milestone}}"></p>
16┆ <p><input type="text" name="assignee" aria-label="Assignee" placeholder="assignees, space-
separated (optional)" value="{{.Assignee}}"></p>
17┆ {{end}}
18┆ <p><button type="submit">Open issue</button> {{template "previewbtn"}}</p>
[hid 1 additional lines, adjust with --max-lines-per-finding]
internal/web/templates/issues.html
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
14┆ {{range .Filters}}<p class="meta">{{.Key}}: {{if eq .Key "label"}}<span class="chip label"
style="{{index $.LabelColors .Value}}">{{.Value}}</span>{{else}}<b>{{.Value}}</b>{{end}} <a
href="{{.Clear}}">clear</a></p>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
25┆ {{if eq $.State "all"}}<span class="chip {{if eq .State "open"}}chip-open{{else}}chip-
done{{end}}">{{.State}}</span>{{end}}
⋮┆----------------------------------------
25┆ {{if eq $.State "all"}}<span class="chip {{if eq .State "open"}}chip-open{{else}}chip-
done{{end}}">{{.State}}</span>{{end}}
⋮┆----------------------------------------
25┆ {{if eq $.State "all"}}<span class="chip {{if eq .State "open"}}chip-open{{else}}chip-
done{{end}}">{{.State}}</span>{{end}}
internal/web/templates/labels.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
9┆ {{if or $.CanWrite $.AnyColor}}<td>{{if and $.CanWrite (not .Org)}}<form method="post"
action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/labels" class="inline">
10┆ <input type="hidden" name="name" value="{{.Name}}">
11┆ <input type="text" name="color" value="{{.Color}}" aria-label="Colour for {{.Name}}"
placeholder="rrggbb" size="8">
12┆ <button type="submit" class="btn">Save</button>
13┆ </form>{{else}}<span class="mono">{{if
.Color}}{{.Color}}{{else}}—{{end}}</span>{{end}}</td>{{end}}
⋮┆----------------------------------------
16┆ <td class="act">{{if and $.CanWrite (not .Org)}}<form method="post"
action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/labels" class="inline">
17┆ <input type="hidden" name="action" value="remove">
18┆ <input type="hidden" name="name" value="{{.Name}}">
19┆ {{template "confirmfield" .Name}}
20┆ <button type="submit" class="danger">Remove</button>
21┆ </form>{{else if .Org}}<a href="/{{$.Repo.OwnerName}}/-/labels">org</a>{{end}}</td>
⋮┆----------------------------------------
28┆ <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/labels" class="setform
stack">
29┆ <label for="labelname">Name</label>
30┆ <input type="text" id="labelname" name="name" maxlength="50" required>
31┆ <label for="labelcolor">Colour</label>
32┆ <input type="text" id="labelcolor" name="color" placeholder="rrggbb, or blank for one
picked from the name">
33┆ <button type="submit" class="btn">Create label</button>
34┆ </form>
internal/web/templates/layout.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
2┆ <html lang="en"{{with field . "Theme"}} data-theme="{{.}}"{{end}}>
⋮┆----------------------------------------
2┆ <html lang="en"{{with field . "Theme"}} data-theme="{{.}}"{{end}}>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
39┆ {{range $items}}{{if .Show}}<a href="{{.Href}}">{{template "icon" .Icon}}
{{.Name}}</a>{{end}}{{end}}
⋮┆----------------------------------------
43┆ {{$logout := index $items 3}}<a class="railopt railicon" href="{{$logout.Href}}" aria-
label="{{$logout.Name}}" title="{{$logout.Name}}">{{template "icon" $logout.Icon}}<span
class="vh">{{$logout.Name}}</span></a>
⋮┆----------------------------------------
60┆ {{if eq $top "code"}}{{if or (field $ "Desc") (field $ "Topics")
$.Repo.Settings.Website}}<p class="repodesc">{{with field $ "Desc"}}{{.}}{{end}} {{with
field $ "Topics"}}{{range .}}<a class="chip topic" href="/explore?q={{.}}">{{.}}</a>
{{end}}{{end}}{{with $.Repo.Settings.Website}}<a class="site" href="{{.}}"
rel="nofollow">{{.}}</a>{{end}}</p>{{end}}{{end}}
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
62┆ {{if $.Viewer}}<form method="post" action="/{{.OwnerName}}/{{.Name}}/pin"
class="inline"><button type="submit" class="btn" aria-pressed="{{if field $
"Pinned"}}true{{else}}false{{end}}" title="Pinned repositories show on your
dashboard"><span aria-hidden="true">{{if field $ "Pinned"}}★{{else}}☆{{end}}</span> {{if
field $ "Pinned"}}Pinned{{else}}Pin{{end}}</button></form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
62┆ {{if $.Viewer}}<form method="post" action="/{{.OwnerName}}/{{.Name}}/pin"
class="inline"><button type="submit" class="btn" aria-pressed="{{if field $
"Pinned"}}true{{else}}false{{end}}" title="Pinned repositories show on your
dashboard"><span aria-hidden="true">{{if field $ "Pinned"}}★{{else}}☆{{end}}</span> {{if
field $ "Pinned"}}Pinned{{else}}Pin{{end}}</button></form>
⋮┆----------------------------------------
62┆ {{if $.Viewer}}<form method="post" action="/{{.OwnerName}}/{{.Name}}/pin"
class="inline"><button type="submit" class="btn" aria-pressed="{{if field $
"Pinned"}}true{{else}}false{{end}}" title="Pinned repositories show on your
dashboard"><span aria-hidden="true">{{if field $ "Pinned"}}★{{else}}☆{{end}}</span> {{if
field $ "Pinned"}}Pinned{{else}}Pin{{end}}</button></form>
⋮┆----------------------------------------
62┆ {{if $.Viewer}}<form method="post" action="/{{.OwnerName}}/{{.Name}}/pin"
class="inline"><button type="submit" class="btn" aria-pressed="{{if field $
"Pinned"}}true{{else}}false{{end}}" title="Pinned repositories show on your
dashboard"><span aria-hidden="true">{{if field $ "Pinned"}}★{{else}}☆{{end}}</span> {{if
field $ "Pinned"}}Pinned{{else}}Pin{{end}}</button></form>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
63┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><button
type="submit" class="btn" aria-pressed="{{if ne (str $ "Watch")
""}}true{{else}}false{{end}}" title="{{if eq (str $ "Watch") "watching"}}Watching: every
issue, request and build. Click to mute.{{else if eq (str $ "Watch") "muted"}}Muted:
nothing from this repository. Click to stop muting.{{else}}Only what involves you. Click to
watch everything.{{end}}">{{if eq (str $ "Watch") "watching"}}Watching{{else if eq (str $
"Watch") "muted"}}Muted{{else}}Watch{{end}}</button></form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
63┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><button
type="submit" class="btn" aria-pressed="{{if ne (str $ "Watch")
""}}true{{else}}false{{end}}" title="{{if eq (str $ "Watch") "watching"}}Watching: every
issue, request and build. Click to mute.{{else if eq (str $ "Watch") "muted"}}Muted:
nothing from this repository. Click to stop muting.{{else}}Only what involves you. Click to
watch everything.{{end}}">{{if eq (str $ "Watch") "watching"}}Watching{{else if eq (str $
"Watch") "muted"}}Muted{{else}}Watch{{end}}</button></form>
⋮┆----------------------------------------
63┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><button
type="submit" class="btn" aria-pressed="{{if ne (str $ "Watch")
""}}true{{else}}false{{end}}" title="{{if eq (str $ "Watch") "watching"}}Watching: every
issue, request and build. Click to mute.{{else if eq (str $ "Watch") "muted"}}Muted:
nothing from this repository. Click to stop muting.{{else}}Only what involves you. Click to
watch everything.{{end}}">{{if eq (str $ "Watch") "watching"}}Watching{{else if eq (str $
"Watch") "muted"}}Muted{{else}}Watch{{end}}</button></form>
⋮┆----------------------------------------
63┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><button
type="submit" class="btn" aria-pressed="{{if ne (str $ "Watch")
""}}true{{else}}false{{end}}" title="{{if eq (str $ "Watch") "watching"}}Watching: every
issue, request and build. Click to mute.{{else if eq (str $ "Watch") "muted"}}Muted:
nothing from this repository. Click to stop muting.{{else}}Only what involves you. Click to
watch everything.{{end}}">{{if eq (str $ "Watch") "watching"}}Watching{{else if eq (str $
"Watch") "muted"}}Muted{{else}}Watch{{end}}</button></form>
⋮┆----------------------------------------
63┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><button
type="submit" class="btn" aria-pressed="{{if ne (str $ "Watch")
""}}true{{else}}false{{end}}" title="{{if eq (str $ "Watch") "watching"}}Watching: every
issue, request and build. Click to mute.{{else if eq (str $ "Watch") "muted"}}Muted:
nothing from this repository. Click to stop muting.{{else}}Only what involves you. Click to
watch everything.{{end}}">{{if eq (str $ "Watch") "watching"}}Watching{{else if eq (str $
"Watch") "muted"}}Muted{{else}}Watch{{end}}</button></form>
⋮┆----------------------------------------
63┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><button
type="submit" class="btn" aria-pressed="{{if ne (str $ "Watch")
""}}true{{else}}false{{end}}" title="{{if eq (str $ "Watch") "watching"}}Watching: every
issue, request and build. Click to mute.{{else if eq (str $ "Watch") "muted"}}Muted:
nothing from this repository. Click to stop muting.{{else}}Only what involves you. Click to
watch everything.{{end}}">{{if eq (str $ "Watch") "watching"}}Watching{{else if eq (str $
"Watch") "muted"}}Muted{{else}}Watch{{end}}</button></form>
⋮┆----------------------------------------
63┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><button
type="submit" class="btn" aria-pressed="{{if ne (str $ "Watch")
""}}true{{else}}false{{end}}" title="{{if eq (str $ "Watch") "watching"}}Watching: every
issue, request and build. Click to mute.{{else if eq (str $ "Watch") "muted"}}Muted:
nothing from this repository. Click to stop muting.{{else}}Only what involves you. Click to
watch everything.{{end}}">{{if eq (str $ "Watch") "watching"}}Watching{{else if eq (str $
"Watch") "muted"}}Muted{{else}}Watch{{end}}</button></form>
⋮┆----------------------------------------
63┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><button
type="submit" class="btn" aria-pressed="{{if ne (str $ "Watch")
""}}true{{else}}false{{end}}" title="{{if eq (str $ "Watch") "watching"}}Watching: every
issue, request and build. Click to mute.{{else if eq (str $ "Watch") "muted"}}Muted:
nothing from this repository. Click to stop muting.{{else}}Only what involves you. Click to
watch everything.{{end}}">{{if eq (str $ "Watch") "watching"}}Watching{{else if eq (str $
"Watch") "muted"}}Muted{{else}}Watch{{end}}</button></form>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
64┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/bookmark" class="inline"><button
type="submit" class="btn" aria-pressed="{{if field $ "Marked"}}true{{else}}false{{end}}"
title="Bookmarked lists it under Bookmarks">{{if field $
"Marked"}}Bookmarked{{else}}Bookmark{{end}}</button></form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
64┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/bookmark" class="inline"><button
type="submit" class="btn" aria-pressed="{{if field $ "Marked"}}true{{else}}false{{end}}"
title="Bookmarked lists it under Bookmarks">{{if field $
"Marked"}}Bookmarked{{else}}Bookmark{{end}}</button></form>
⋮┆----------------------------------------
64┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/bookmark" class="inline"><button
type="submit" class="btn" aria-pressed="{{if field $ "Marked"}}true{{else}}false{{end}}"
title="Bookmarked lists it under Bookmarks">{{if field $
"Marked"}}Bookmarked{{else}}Bookmark{{end}}</button></form>
⋮┆----------------------------------------
64┆ <form method="post" action="/{{.OwnerName}}/{{.Name}}/bookmark" class="inline"><button
type="submit" class="btn" aria-pressed="{{if field $ "Marked"}}true{{else}}false{{end}}"
title="Bookmarked lists it under Bookmarks">{{if field $
"Marked"}}Bookmarked{{else}}Bookmark{{end}}</button></form>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
67┆ {{if eq $top "code"}}{{if field $ "Mirrors"}}<p class="repometa">{{range $i, $m := field $
"Mirrors"}}{{if $i}} · {{end}}{{if eq $m.Direction "push"}}mirrors to{{else}}mirrors
from{{end}} <a href="{{$m.URL}}" rel="nofollow">{{$m.Target}}</a>{{if $m.Error}}, <span
class="bad">sync error: {{$m.Error}}</span>{{else if $m.Synced}}, synced
{{$m.Synced}}{{end}}{{end}}</p>{{end}}{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
74┆ <a {{if eq $top "code"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}">Code</a>
⋮┆----------------------------------------
74┆ <a {{if eq $top "code"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}">Code</a>
⋮┆----------------------------------------
75┆ <a {{if eq $top "issues"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/issues">Issues{{with field $ "OpenIssues"}}{{if .}}
<i>{{.}}</i>{{end}}{{end}}</a>
⋮┆----------------------------------------
75┆ <a {{if eq $top "issues"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/issues">Issues{{with field $ "OpenIssues"}}{{if .}}
<i>{{.}}</i>{{end}}{{end}}</a>
⋮┆----------------------------------------
76┆ <a {{if eq $top "mrs"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/mrs">Merge requests{{with field $ "OpenMRs"}}{{if
.}} <i>{{.}}</i>{{end}}{{end}}</a>
⋮┆----------------------------------------
76┆ <a {{if eq $top "mrs"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/mrs">Merge requests{{with field $ "OpenMRs"}}{{if
.}} <i>{{.}}</i>{{end}}{{end}}</a>
⋮┆----------------------------------------
77┆ <a {{if eq $top "builds"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/builds">Builds</a>
⋮┆----------------------------------------
77┆ <a {{if eq $top "builds"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/builds">Builds</a>
⋮┆----------------------------------------
78┆ <a {{if eq $top "releases"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/releases">Releases</a>
⋮┆----------------------------------------
78┆ <a {{if eq $top "releases"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/releases">Releases</a>
⋮┆----------------------------------------
79┆ {{if field $ "HasWiki"}}<a {{if eq $top "wiki"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/wiki">Wiki</a>{{end}}
⋮┆----------------------------------------
79┆ {{if field $ "HasWiki"}}<a {{if eq $top "wiki"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/wiki">Wiki</a>{{end}}
⋮┆----------------------------------------
80┆ {{if field $ "CanAdmin"}}<a {{if eq $top "settings"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/settings">Settings</a>{{end}}
⋮┆----------------------------------------
80┆ {{if field $ "CanAdmin"}}<a {{if eq $top "settings"}}aria-current="page"
{{end}}href="/{{.OwnerName}}/{{.Name}}/settings">Settings</a>{{end}}
⋮┆----------------------------------------
86┆ <main id="content" class="content {{template "width" .}}">
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
91┆ <p>Powered by <a href="https://gitbay.org/krz/gitbay">gitbay</a> · <a
href="https://apps.apple.com/us/app/gitbay/id6806399095">iOS app</a> · <a
href="/privacy">Privacy</a>{{with field . "TermsURL"}} · <a
href="{{.}}">Terms</a>{{end}}{{with field . "AbuseURL"}} · <a href="{{.}}">Report
abuse</a>{{end}}</p>
⋮┆----------------------------------------
91┆ <p>Powered by <a href="https://gitbay.org/krz/gitbay">gitbay</a> · <a
href="https://apps.apple.com/us/app/gitbay/id6806399095">iOS app</a> · <a
href="/privacy">Privacy</a>{{with field . "TermsURL"}} · <a
href="{{.}}">Terms</a>{{end}}{{with field . "AbuseURL"}} · <a href="{{.}}">Report
abuse</a>{{end}}</p>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
121┆ {{define "raillink"}}<a class="railicon" {{if .Current}}aria-current="page"
{{end}}href="{{.Href}}" aria-label="{{.Name}}" title="{{.Name}}">{{template "icon"
.Icon}}<span class="vh">{{.Name}}</span>{{with .Count}}<b
class="count">{{.}}</b>{{end}}</a>{{end}}
⋮┆----------------------------------------
121┆ {{define "raillink"}}<a class="railicon" {{if .Current}}aria-current="page"
{{end}}href="{{.Href}}" aria-label="{{.Name}}" title="{{.Name}}">{{template "icon"
.Icon}}<span class="vh">{{.Name}}</span>{{with .Count}}<b
class="count">{{.}}</b>{{end}}</a>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
121┆ {{define "raillink"}}<a class="railicon" {{if .Current}}aria-current="page"
{{end}}href="{{.Href}}" aria-label="{{.Name}}" title="{{.Name}}">{{template "icon"
.Icon}}<span class="vh">{{.Name}}</span>{{with .Count}}<b
class="count">{{.}}</b>{{end}}</a>{{end}}
⋮┆----------------------------------------
144┆ {{with .Parent}}<li><a class="up" href="{{.}}">..</a></li>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
145┆ {{range .Entries}}<li><a{{if .Dir}} class="dir"{{end}}{{if .Current}} aria-
current="page"{{end}} href="{{.URL}}">{{.Name}}</a></li>
⋮┆----------------------------------------
145┆ {{range .Entries}}<li><a{{if .Dir}} class="dir"{{end}}{{if .Current}} aria-
current="page"{{end}} href="{{.URL}}">{{.Name}}</a></li>
⋮┆----------------------------------------
145┆ {{range .Entries}}<li><a{{if .Dir}} class="dir"{{end}}{{if .Current}} aria-
current="page"{{end}} href="{{.URL}}">{{.Name}}</a></li>
⋮┆----------------------------------------
145┆ {{range .Entries}}<li><a{{if .Dir}} class="dir"{{end}}{{if .Current}} aria-
current="page"{{end}} href="{{.URL}}">{{.Name}}</a></li>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
145┆ {{range .Entries}}<li><a{{if .Dir}} class="dir"{{end}}{{if .Current}} aria-
current="page"{{end}} href="{{.URL}}">{{.Name}}</a></li>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
160┆ <ul>{{range .Items}}<li><a{{if .Active}} aria-current="page"{{end}}
href="{{.Href}}">{{.Label}}{{if .Count}} <i>{{.Count}}</i>{{end}}</a></li>{{end}}</ul>
⋮┆----------------------------------------
160┆ <ul>{{range .Items}}<li><a{{if .Active}} aria-current="page"{{end}}
href="{{.Href}}">{{.Label}}{{if .Count}} <i>{{.Count}}</i>{{end}}</a></li>{{end}}</ul>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
160┆ <ul>{{range .Items}}<li><a{{if .Active}} aria-current="page"{{end}}
href="{{.Href}}">{{.Label}}{{if .Count}} <i>{{.Count}}</i>{{end}}</a></li>{{end}}</ul>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
177┆ <option value="md"{{if ne . "org"}} selected{{end}}>Markdown</option>
⋮┆----------------------------------------
177┆ <option value="md"{{if ne . "org"}} selected{{end}}>Markdown</option>
⋮┆----------------------------------------
178┆ <option value="org"{{if eq . "org"}} selected{{end}}>Org</option>
⋮┆----------------------------------------
178┆ <option value="org"{{if eq . "org"}} selected{{end}}>Org</option>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
187┆ {{define "reactions"}}{{if .Items}}{{if .Signed}}<form method="post" action="{{.Action}}"
class="reactions">{{if .Comment}}<input type="hidden" name="comment"
value="{{.Comment}}">{{end}}
188┆ {{range .Items}}<button type="submit" name="{{if .Me}}remove{{else}}add{{end}}"
value="{{.Name}}" class="react{{if .Me}} mine{{end}}" aria-pressed="{{.Me}}" aria-
label="{{.Label}}">{{.Emoji}}{{if .Count}} <span>{{.Count}}</span>{{end}}</button>
189┆ {{end}}</form>{{else}}<p class="reactions">{{range .Items}}<span class="react" aria-
label="{{.Label}}">{{.Emoji}} {{.Count}}</span> {{end}}</p>{{end}}{{end}}{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
209┆ {{with $L}}{{if .UnifiedURL}}<p class="layoutpick">Layout: {{if .Split}}<a
href="{{.UnifiedURL}}">unified</a> · <strong aria-
current="true">split</strong>{{else}}<strong aria-current="true">unified</strong> · <a
href="{{.SplitURL}}">split</a>{{end}}</p>{{end}}{{end}}
⋮┆----------------------------------------
209┆ {{with $L}}{{if .UnifiedURL}}<p class="layoutpick">Layout: {{if .Split}}<a
href="{{.UnifiedURL}}">unified</a> · <strong aria-
current="true">split</strong>{{else}}<strong aria-current="true">unified</strong> · <a
href="{{.SplitURL}}">split</a>{{end}}</p>{{end}}{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
210┆ {{range $fi, $f := .Files}}<details class="difffold" id="f{{$fi}}"{{if .Open}} open{{end}}>
⋮┆----------------------------------------
210┆ {{range $fi, $f := .Files}}<details class="difffold" id="f{{$fi}}"{{if .Open}} open{{end}}>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
224┆ {{with .Compose}}<tr class="threadrow"><td colspan="4"><form id="compose" method="post"
action="{{$base}}/diff-comment" class="thread composing">
225┆ <input type="hidden" name="path" value="{{.Path}}">
226┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
227┆ <input type="hidden" name="side" value="{{if eq .Class "del"}}old{{else}}new{{end}}">
228┆ {{if ne .Class "del"}}<p><label>From line <input type="number" name="start_line" min="1"
max="{{.NewLine}}" placeholder="{{.NewLine}}"></label> to {{.NewLine}}; a
<code>```suggestion</code> block proposes replacement lines</p>{{end}}
229┆ <p><textarea name="body" aria-label="Comment on {{.Path}}" rows="3" placeholder="Comment
on this line" autofocus></textarea></p>
230┆ <p><button type="submit" class="btn">Comment</button>
231┆ <button type="submit" name="pending" value="on" class="btn">Add to review</button>
232┆ <a href="{{$base}}?view=diff{{if
$L.Carry}}&layout={{$L.Carry}}{{end}}">Cancel</a></p>
233┆ </form></td></tr>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
226┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
⋮┆----------------------------------------
226┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
⋮┆----------------------------------------
226┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
⋮┆----------------------------------------
226┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
⋮┆----------------------------------------
226┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
⋮┆----------------------------------------
227┆ <input type="hidden" name="side" value="{{if eq .Class "del"}}old{{else}}new{{end}}">
⋮┆----------------------------------------
227┆ <input type="hidden" name="side" value="{{if eq .Class "del"}}old{{else}}new{{end}}">
⋮┆----------------------------------------
227┆ <input type="hidden" name="side" value="{{if eq .Class "del"}}old{{else}}new{{end}}">
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
232┆ <a href="{{$base}}?view=diff{{if $L.Carry}}&layout={{$L.Carry}}{{end}}">Cancel</a></p>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
240┆ {{else}}<tr class="{{.Class}}" id="f{{$fi}}-{{if eq .Class
"del"}}o{{.OldLine}}{{else}}n{{.NewLine}}{{end}}"><td class="ln">{{if .OldLine}}{{if eq
.Class "del"}}{{template "cmtln" dict "N" .OldLine "Path" .Path "Side" "old" "Base" $base
"Viewer" $viewer "Carry" $L.Carry}}{{else}}{{.OldLine}}{{end}}{{end}}</td><td
class="ln">{{if .NewLine}}{{template "cmtln" dict "N" .NewLine "Path" .Path "Side" "new"
"Base" $base "Viewer" $viewer "Carry" $L.Carry}}{{end}}</td><td class="src chroma">{{if
.Code}}{{.Code}}{{else}}{{.Content}}{{end}}</td></tr>
⋮┆----------------------------------------
240┆ {{else}}<tr class="{{.Class}}" id="f{{$fi}}-{{if eq .Class
"del"}}o{{.OldLine}}{{else}}n{{.NewLine}}{{end}}"><td class="ln">{{if .OldLine}}{{if eq
.Class "del"}}{{template "cmtln" dict "N" .OldLine "Path" .Path "Side" "old" "Base" $base
"Viewer" $viewer "Carry" $L.Carry}}{{else}}{{.OldLine}}{{end}}{{end}}</td><td
class="ln">{{if .NewLine}}{{template "cmtln" dict "N" .NewLine "Path" .Path "Side" "new"
"Base" $base "Viewer" $viewer "Carry" $L.Carry}}{{end}}</td><td class="src chroma">{{if
.Code}}{{.Code}}{{else}}{{.Content}}{{end}}</td></tr>
⋮┆----------------------------------------
240┆ {{else}}<tr class="{{.Class}}" id="f{{$fi}}-{{if eq .Class
"del"}}o{{.OldLine}}{{else}}n{{.NewLine}}{{end}}"><td class="ln">{{if .OldLine}}{{if eq
.Class "del"}}{{template "cmtln" dict "N" .OldLine "Path" .Path "Side" "old" "Base" $base
"Viewer" $viewer "Carry" $L.Carry}}{{else}}{{.OldLine}}{{end}}{{end}}</td><td
class="ln">{{if .NewLine}}{{template "cmtln" dict "N" .NewLine "Path" .Path "Side" "new"
"Base" $base "Viewer" $viewer "Carry" $L.Carry}}{{end}}</td><td class="src chroma">{{if
.Code}}{{.Code}}{{else}}{{.Content}}{{end}}</td></tr>
⋮┆----------------------------------------
240┆ {{else}}<tr class="{{.Class}}" id="f{{$fi}}-{{if eq .Class
"del"}}o{{.OldLine}}{{else}}n{{.NewLine}}{{end}}"><td class="ln">{{if .OldLine}}{{if eq
.Class "del"}}{{template "cmtln" dict "N" .OldLine "Path" .Path "Side" "old" "Base" $base
"Viewer" $viewer "Carry" $L.Carry}}{{else}}{{.OldLine}}{{end}}{{end}}</td><td
class="ln">{{if .NewLine}}{{template "cmtln" dict "N" .NewLine "Path" .Path "Side" "new"
"Base" $base "Viewer" $viewer "Carry" $L.Carry}}{{end}}</td><td class="src chroma">{{if
.Code}}{{.Code}}{{else}}{{.Content}}{{end}}</td></tr>
⋮┆----------------------------------------
240┆ {{else}}<tr class="{{.Class}}" id="f{{$fi}}-{{if eq .Class
"del"}}o{{.OldLine}}{{else}}n{{.NewLine}}{{end}}"><td class="ln">{{if .OldLine}}{{if eq
.Class "del"}}{{template "cmtln" dict "N" .OldLine "Path" .Path "Side" "old" "Base" $base
"Viewer" $viewer "Carry" $L.Carry}}{{else}}{{.OldLine}}{{end}}{{end}}</td><td
class="ln">{{if .NewLine}}{{template "cmtln" dict "N" .NewLine "Path" .Path "Side" "new"
"Base" $base "Viewer" $viewer "Carry" $L.Carry}}{{end}}</td><td class="src chroma">{{if
.Code}}{{.Code}}{{else}}{{.Content}}{{end}}</td></tr>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
241┆ {{if .Compose}}<tr class="threadrow"><td colspan="3"><form id="compose" method="post"
action="{{$base}}/diff-comment" class="thread composing">
242┆ <input type="hidden" name="path" value="{{.Path}}">
243┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
244┆ <input type="hidden" name="side" value="{{if eq .Class "del"}}old{{else}}new{{end}}">
245┆ {{if ne .Class "del"}}<p><label>From line <input type="number" name="start_line" min="1"
max="{{.NewLine}}" placeholder="{{.NewLine}}"></label> to {{.NewLine}}; a
<code>```suggestion</code> block proposes replacement lines</p>{{end}}
246┆ <p><textarea name="body" aria-label="Comment on {{.Path}}" rows="3" placeholder="Comment
on this line" autofocus></textarea></p>
247┆ <p><button type="submit" class="btn">Comment</button>
248┆ <button type="submit" name="pending" value="on" class="btn">Add to review</button>
249┆ <a href="{{$base}}?view=diff{{if
$L.Carry}}&layout={{$L.Carry}}{{end}}">Cancel</a></p>
250┆ </form></td></tr>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
243┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
⋮┆----------------------------------------
243┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
⋮┆----------------------------------------
243┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
⋮┆----------------------------------------
243┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
⋮┆----------------------------------------
243┆ <input type="hidden" name="line" value="{{if eq .Class
"del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
⋮┆----------------------------------------
244┆ <input type="hidden" name="side" value="{{if eq .Class "del"}}old{{else}}new{{end}}">
⋮┆----------------------------------------
244┆ <input type="hidden" name="side" value="{{if eq .Class "del"}}old{{else}}new{{end}}">
⋮┆----------------------------------------
244┆ <input type="hidden" name="side" value="{{if eq .Class "del"}}old{{else}}new{{end}}">
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
249┆ <a href="{{$base}}?view=diff{{if $L.Carry}}&layout={{$L.Carry}}{{end}}">Cancel</a></p>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
268┆ <form method="post" action="{{.Base}}/diff-comment">
269┆ <input type="hidden" name="reply" value="{{$t.ID}}">
270┆ <p><textarea name="body" aria-label="Reply to thread {{$t.ID}}" rows="2"
placeholder="Reply as {{.Viewer}}"></textarea></p>
271┆ <p><button type="submit" class="btn">Reply</button></p>
272┆ </form></details>{{end}}
⋮┆----------------------------------------
273┆ {{if $t.CanResolve}}<form method="post" action="{{.Base}}/thread" class="threadact"><input
type="hidden" name="thread" value="{{$t.ID}}"><button type="submit" name="action"
value="{{if $t.Resolved}}unresolve{{else}}resolve{{end}}" class="linklike">{{if
$t.Resolved}}Reopen thread{{else}}Resolve thread{{end}}</button></form>{{end}}
⋮┆----------------------------------------
286┆ {{else}}<form method="post" action="{{.Base}}/suggestion" class="threadact"><input
type="hidden" name="thread" value="{{.T}}"><button type="submit" class="btn">Apply
suggestion</button></form>
internal/web/templates/login.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
12┆ <form method="post" action="/login">
13┆ <div class="field"><label for="identifier">Username or email address</label>
14┆ <input type="text" id="identifier" name="identifier" autocomplete="username"
autocapitalize="none" spellcheck="false" required></div>
15┆ <button type="submit">Email me a link</button>
16┆ </form>
internal/web/templates/logout.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
6┆ <form method="post" action="/logout">
7┆ <p class="btngroup"><button type="submit" class="danger">Log out</button> <a
href="/">Cancel</a></p>
8┆ </form>
internal/web/templates/milestones.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
6┆ <a {{if eq .State "open"}}class="active" aria-current="page"
{{end}}href="?state=open">open</a>
⋮┆----------------------------------------
6┆ <a {{if eq .State "open"}}class="active" aria-current="page"
{{end}}href="?state=open">open</a>
⋮┆----------------------------------------
7┆ <a {{if eq .State "closed"}}class="active" aria-current="page"
{{end}}href="?state=closed">closed</a>
⋮┆----------------------------------------
7┆ <a {{if eq .State "closed"}}class="active" aria-current="page"
{{end}}href="?state=closed">closed</a>
⋮┆----------------------------------------
8┆ <a {{if eq .State "all"}}class="active" aria-current="page"
{{end}}href="?state=all">all</a>
⋮┆----------------------------------------
8┆ <a {{if eq .State "all"}}class="active" aria-current="page"
{{end}}href="?state=all">all</a>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
15┆ <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/milestones" class="setform
stack">
16┆ <label for="mstitle">Title</label>
17┆ <input type="text" id="mstitle" name="title" required>
18┆ <label for="msdesc">Description</label>
19┆ <input type="text" id="msdesc" name="description">
20┆ <label for="msdue">Due</label>
21┆ <input type="text" id="msdue" name="due" placeholder="YYYY-MM-DD">
22┆ <button type="submit" class="btn">Create milestone</button>
23┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
29┆ <p class="title">{{.Title}} <span class="chip {{if eq .State "open"}}chip-open{{else}}chip-
done{{end}}">{{.State}}</span>{{if .OrgID}} <span class="chip chip-
neutral">org</span>{{end}}</p>
⋮┆----------------------------------------
29┆ <p class="title">{{.Title}} <span class="chip {{if eq .State "open"}}chip-open{{else}}chip-
done{{end}}">{{.State}}</span>{{if .OrgID}} <span class="chip chip-
neutral">org</span>{{end}}</p>
⋮┆----------------------------------------
29┆ <p class="title">{{.Title}} <span class="chip {{if eq .State "open"}}chip-open{{else}}chip-
done{{end}}">{{.State}}</span>{{if .OrgID}} <span class="chip chip-
neutral">org</span>{{end}}</p>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
33┆ {{if and $.CanWrite (not .OrgID)}}<form method="post"
action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/milestones" class="inline">
34┆ <input type="hidden" name="title" value="{{.Title}}">
35┆ {{if eq .State "open"}}<input type="hidden" name="action" value="close"><button
type="submit" class="btn">Close</button>{{else}}<input type="hidden" name="action"
value="reopen"><button type="submit" class="btn">Reopen</button>{{end}}
36┆ </form>{{end}}
internal/web/templates/mr.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
22┆ <a {{if eq .View "conversation"}}aria-current="page"
{{end}}href="{{$base}}">Conversation{{if .Comments}} <i>{{len .Comments}}</i>{{end}}</a>
⋮┆----------------------------------------
22┆ <a {{if eq .View "conversation"}}aria-current="page"
{{end}}href="{{$base}}">Conversation{{if .Comments}} <i>{{len .Comments}}</i>{{end}}</a>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
22┆ <a {{if eq .View "conversation"}}aria-current="page"
{{end}}href="{{$base}}">Conversation{{if .Comments}} <i>{{len .Comments}}</i>{{end}}</a>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
23┆ <a {{if eq .View "commits"}}aria-current="page"
{{end}}href="{{$base}}?view=commits">Commits{{if .Commits}} <i>{{len
.Commits}}</i>{{end}}</a>
⋮┆----------------------------------------
23┆ <a {{if eq .View "commits"}}aria-current="page"
{{end}}href="{{$base}}?view=commits">Commits{{if .Commits}} <i>{{len
.Commits}}</i>{{end}}</a>
⋮┆----------------------------------------
24┆ <a {{if eq .View "diff"}}aria-current="page" {{end}}href="{{$base}}?view=diff">Files
changed{{if .Stat.Files}} <i>{{.Stat.Files}}</i>{{end}}</a>
⋮┆----------------------------------------
24┆ <a {{if eq .View "diff"}}aria-current="page" {{end}}href="{{$base}}?view=diff">Files
changed{{if .Stat.Files}} <i>{{.Stat.Files}}</i>{{end}}</a>
⋮┆----------------------------------------
30┆ {{if .CanEdit}}<details class="editbox"{{if .Draft.Is "edit"}}
open{{end}}><summary>Edit</summary>
⋮┆----------------------------------------
30┆ {{if .CanEdit}}<details class="editbox"{{if .Draft.Is "edit"}}
open{{end}}><summary>Edit</summary>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
32┆ <form method="post" action="{{$base}}/edit" class="commentform">
33┆ <p><input type="text" name="title" aria-label="Title" value="{{.Draft.Or "edit" "title"
.MR.Title}}" required></p>
34┆ <p><textarea name="body" aria-label="Description" rows="8">{{.Draft.Or "edit" "body"
.MR.Body}}</textarea></p>
35┆ <p><button type="submit" class="btn">Save</button> {{template "previewbtn"}}</p>
36┆ </form></details>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
33┆ <p><input type="text" name="title" aria-label="Title" value="{{.Draft.Or "edit" "title"
.MR.Title}}" required></p>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
54┆ <form method="post" action="{{$base}}/comment" class="commentform">
55┆ <p><textarea name="body" aria-label="Comment" rows="4" placeholder="Comment as
{{.Viewer}}">{{.Draft.Or "comment" "body" ""}}</textarea></p>
56┆ <p><button type="submit">Comment</button> {{template "previewbtn"}}</p>
57┆ </form>
⋮┆----------------------------------------
92┆ <form method="post" action="{{$base}}/review" class="actions">
93┆ <button type="submit" name="verdict" value="approve" class="btn">Approve</button>
94┆ <button type="submit" name="verdict" value="request-changes" class="btn">Request
changes</button>
95┆ </form>
⋮┆----------------------------------------
102┆ <form method="post" action="{{$base}}/merge" class="actions">
103┆ <input type="hidden" name="cancel" value="on">
104┆ <button type="submit" class="btn">Cancel queued merge</button>
105┆ </form>{{end}}
⋮┆----------------------------------------
106┆ <form method="post" action="{{$base}}/merge" class="actions">
107┆ <label class="none" for="strategy">Strategy</label>
108┆ <select id="strategy" name="strategy">
109┆ <option value="auto">Automatic</option>
110┆ <option value="ff">Fast-forward</option>
111┆ <option value="merge">Merge commit</option>
112┆ <option value="squash">Squash</option>
113┆ <option value="rebase">Rebase</option>
114┆ </select>
115┆ <button type="submit">Merge</button>
[hid 2 additional lines, adjust with --max-lines-per-finding]
123┆ <form method="post" action="{{$base}}/close" class="actions">
124┆ <label class="vh" for="by">Closed in favour of</label>
125┆ <input type="text" id="by" name="by" size="4" autocomplete="off" placeholder="!N">
126┆ <button type="submit" class="danger">Close without merging</button>
127┆ </form>
⋮┆----------------------------------------
128┆ <form method="post" action="{{$base}}/draft" class="actions">
129┆ {{if .MR.Draft}}<button type="submit" class="btn">Ready for review</button>
130┆ {{else}}<input type="hidden" name="draft" value="on"><button type="submit"
class="btn">Convert to draft</button>{{end}}
131┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
146┆ {{range .Checks}}<p class="row"><span class="dot {{if eq .State "success"}}ok{{else if eq
.State "failure"}}bad{{else}}pend{{end}}"></span>{{if .TargetURL}}<a href="{{.TargetURL}}"
rel="nofollow">{{.Context}}</a>{{else}}{{.Context}}{{end}} <span
class="none">{{.State}}</span><span class="sub">{{when .UpdatedAt}}{{if .Duration}} ·
{{.Duration}}{{end}}</span></p>{{end}}
⋮┆----------------------------------------
146┆ {{range .Checks}}<p class="row"><span class="dot {{if eq .State "success"}}ok{{else if eq
.State "failure"}}bad{{else}}pend{{end}}"></span>{{if .TargetURL}}<a href="{{.TargetURL}}"
rel="nofollow">{{.Context}}</a>{{else}}{{.Context}}{{end}} <span
class="none">{{.State}}</span><span class="sub">{{when .UpdatedAt}}{{if .Duration}} ·
{{.Duration}}{{end}}</span></p>{{end}}
⋮┆----------------------------------------
146┆ {{range .Checks}}<p class="row"><span class="dot {{if eq .State "success"}}ok{{else if eq
.State "failure"}}bad{{else}}pend{{end}}"></span>{{if .TargetURL}}<a href="{{.TargetURL}}"
rel="nofollow">{{.Context}}</a>{{else}}{{.Context}}{{end}} <span
class="none">{{.State}}</span><span class="sub">{{when .UpdatedAt}}{{if .Duration}} ·
{{.Duration}}{{end}}</span></p>{{end}}
⋮┆----------------------------------------
146┆ {{range .Checks}}<p class="row"><span class="dot {{if eq .State "success"}}ok{{else if eq
.State "failure"}}bad{{else}}pend{{end}}"></span>{{if .TargetURL}}<a href="{{.TargetURL}}"
rel="nofollow">{{.Context}}</a>{{else}}{{.Context}}{{end}} <span
class="none">{{.State}}</span><span class="sub">{{when .UpdatedAt}}{{if .Duration}} ·
{{.Duration}}{{end}}</span></p>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
146┆ {{range .Checks}}<p class="row"><span class="dot {{if eq .State "success"}}ok{{else if eq
.State "failure"}}bad{{else}}pend{{end}}"></span>{{if .TargetURL}}<a href="{{.TargetURL}}"
rel="nofollow">{{.Context}}</a>{{else}}{{.Context}}{{end}} <span
class="none">{{.State}}</span><span class="sub">{{when .UpdatedAt}}{{if .Duration}} ·
{{.Duration}}{{end}}</span></p>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
151┆ {{range .Reviews}}<p class="row"><span class="dot {{if eq .Verdict
"approve"}}ok{{else}}pend{{end}}"></span><a href="/{{.Reviewer}}">{{.Reviewer}}</a>
{{.Verdict}}{{if .Stale}} <span class="chip chip-stale">stale</span>{{end}}{{if not
.Counts}} <span class="chip chip-neutral" title="This reviewer has no write access, so the
merge gates do not count it">advisory</span>{{end}}<span class="sub">{{when
.CreatedAt}}</span></p>
⋮┆----------------------------------------
151┆ {{range .Reviews}}<p class="row"><span class="dot {{if eq .Verdict
"approve"}}ok{{else}}pend{{end}}"></span><a href="/{{.Reviewer}}">{{.Reviewer}}</a>
{{.Verdict}}{{if .Stale}} <span class="chip chip-stale">stale</span>{{end}}{{if not
.Counts}} <span class="chip chip-neutral" title="This reviewer has no write access, so the
merge gates do not count it">advisory</span>{{end}}<span class="sub">{{when
.CreatedAt}}</span></p>
⋮┆----------------------------------------
151┆ {{range .Reviews}}<p class="row"><span class="dot {{if eq .Verdict
"approve"}}ok{{else}}pend{{end}}"></span><a href="/{{.Reviewer}}">{{.Reviewer}}</a>
{{.Verdict}}{{if .Stale}} <span class="chip chip-stale">stale</span>{{end}}{{if not
.Counts}} <span class="chip chip-neutral" title="This reviewer has no write access, so the
merge gates do not count it">advisory</span>{{end}}<span class="sub">{{when
.CreatedAt}}</span></p>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
156┆ {{range $i, $rv := .Revisions}}<p class="row none">{{add $i 1}}. <code>{{short
$rv.SHA}}</code> {{when $rv.CreatedAt}}{{if $i}} · <a href="{{$base}}/range-
diff?from={{(index $.Revisions (sub $i 1)).SHA}}&to={{$rv.SHA}}">compare to
previous</a>{{end}}</p>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
164┆ <form method="post" action="{{$base}}/review-request" class="actions">
165┆ <input type="text" name="add" aria-label="Add reviewers" autocomplete="off"
spellcheck="false" placeholder="add, space-separated">
166┆ <input type="text" name="remove" aria-label="Remove reviewers" autocomplete="off"
spellcheck="false" placeholder="remove">
167┆ <button type="submit" class="btn">Apply</button>
168┆ </form>
⋮┆----------------------------------------
176┆ <form method="post" action="{{$base}}/retarget" class="actions">
177┆ <label class="none" for="target">Branch</label>
178┆ <select id="target" name="target">
179┆ {{range .Branches}}<option value="{{.Name}}"{{if eq .Name $.MR.TargetRef}}
selected{{end}}>{{.Name}}</option>{{end}}
180┆ </select>
181┆ <button type="submit" class="btn">Retarget</button>
182┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
179┆ {{range .Branches}}<option value="{{.Name}}"{{if eq .Name $.MR.TargetRef}}
selected{{end}}>{{.Name}}</option>{{end}}
⋮┆----------------------------------------
179┆ {{range .Branches}}<option value="{{.Name}}"{{if eq .Name $.MR.TargetRef}}
selected{{end}}>{{.Name}}</option>{{end}}
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
195┆ <form method="post" action="{{$base}}/label" class="actions">
196┆ <input type="text" name="add" aria-label="Add labels" autocomplete="off"
spellcheck="false" placeholder="add, space-separated">
197┆ <input type="text" name="remove" aria-label="Remove labels" autocomplete="off"
spellcheck="false" placeholder="remove">
198┆ <button type="submit" class="btn">Apply</button>
199┆ </form>
internal/web/templates/mrnew.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
7┆ <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/mrs/new"
class="commentform">
8┆ <p class="branchpick">
9┆ <label for="source">Merge</label>
10┆ <select id="source" name="source" required>
11┆ <option value="">Choose a branch…</option>
12┆ {{range .Sources}}<option value="{{.}}"{{if eq . $.Source}}
selected{{end}}>{{.}}</option>{{end}}
13┆ </select>
14┆ <label for="target">into</label>
15┆ <select id="target" name="target">
16┆ {{range .Branches}}<option value="{{.Name}}"{{if eq .Name $.Target}}
selected{{end}}>{{.Name}}</option>{{end}}
[hid 7 additional lines, adjust with --max-lines-per-finding]
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
12┆ {{range .Sources}}<option value="{{.}}"{{if eq . $.Source}}
selected{{end}}>{{.}}</option>{{end}}
⋮┆----------------------------------------
12┆ {{range .Sources}}<option value="{{.}}"{{if eq . $.Source}}
selected{{end}}>{{.}}</option>{{end}}
⋮┆----------------------------------------
16┆ {{range .Branches}}<option value="{{.Name}}"{{if eq .Name $.Target}}
selected{{end}}>{{.Name}}</option>{{end}}
⋮┆----------------------------------------
16┆ {{range .Branches}}<option value="{{.Name}}"{{if eq .Name $.Target}}
selected{{end}}>{{.Name}}</option>{{end}}
internal/web/templates/mrs.html
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
14┆ {{range .Filters}}<p class="meta">{{.Key}}: {{if eq .Key "label"}}<span class="chip label"
style="{{index $.LabelColors .Value}}">{{.Value}}</span>{{else}}<b>{{.Value}}</b>{{end}} <a
href="{{.Clear}}">clear</a></p>{{end}}
⋮┆----------------------------------------
33┆ {{if .Older}}<p class="pager"><a href="{{.Older}}">older →</a></p>{{end}}
internal/web/templates/new.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
7┆ <form method="post" action="/new">
8┆ <p><label>Owner <select name="owner">
9┆ <option value="{{.Viewer}}">{{.Viewer}}</option>
10┆ {{range .Orgs}}<option value="{{.}}">{{.}}</option>{{end}}
11┆ </select></label>
12┆ <label>/ Name <input name="name" required maxlength="63"
pattern="[a-z0-9][a-z0-9._\-]{0,62}" aria-describedby="namehint" autocomplete="off"
spellcheck="false"></label>
13┆ <span class="hint" id="namehint">Lowercase letters, digits, dot, dash and underscore; must
start with a letter or digit; up to 63 characters.</span></p>
14┆ <fieldset class="segmented">
15┆ <legend>Visibility</legend>
16┆ <div class="options">
[hid 6 additional lines, adjust with --max-lines-per-finding]
26┆ <form method="post" action="/new" autocomplete="off">
27┆ <input type="hidden" name="field" value="import">
28┆ <p><label>Owner <select name="owner">
29┆ {{$o := index .Submitted "owner"}}<option value="{{.Viewer}}">{{.Viewer}}</option>
30┆ {{range .Orgs}}<option value="{{.}}"{{if eq . $o}} selected{{end}}>{{.}}</option>{{end}}
31┆ </select></label>
32┆ <label>/ Name <input name="name" value="{{index .Submitted "name"}}" required
maxlength="63" pattern="[a-z0-9][a-z0-9._\-]{0,62}" autocomplete="off"
spellcheck="false"></label></p>
33┆ <p><label>From <input type="text" name="from" value="{{index .Submitted "from"}}" required
placeholder="https://github.com/owner/repo.git" spellcheck="false" size="48"></label></p>
34┆ <p><label>Access token <input type="password" name="token" autocomplete="new-
password"></label> <span class="hint">Optional.</span></p>
35┆ <fieldset class="segmented">
[hid 8 additional lines, adjust with --max-lines-per-finding]
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
30┆ {{range .Orgs}}<option value="{{.}}"{{if eq . $o}} selected{{end}}>{{.}}</option>{{end}}
⋮┆----------------------------------------
30┆ {{range .Orgs}}<option value="{{.}}"{{if eq . $o}} selected{{end}}>{{.}}</option>{{end}}
⋮┆----------------------------------------
32┆ <label>/ Name <input name="name" value="{{index .Submitted "name"}}" required
maxlength="63" pattern="[a-z0-9][a-z0-9._\-]{0,62}" autocomplete="off"
spellcheck="false"></label></p>
⋮┆----------------------------------------
33┆ <p><label>From <input type="text" name="from" value="{{index .Submitted "from"}}" required
placeholder="https://github.com/owner/repo.git" spellcheck="false" size="48"></label></p>
⋮┆----------------------------------------
38┆ <label><input type="radio" name="visibility" value="public"{{if ne (index .Submitted
"visibility") "private"}} checked{{end}}><span>Public</span></label>
⋮┆----------------------------------------
38┆ <label><input type="radio" name="visibility" value="public"{{if ne (index .Submitted
"visibility") "private"}} checked{{end}}><span>Public</span></label>
⋮┆----------------------------------------
39┆ <label><input type="radio" name="visibility" value="private"{{if eq (index .Submitted
"visibility") "private"}} checked{{end}}><span>Private</span></label>
⋮┆----------------------------------------
39┆ <label><input type="radio" name="visibility" value="private"{{if eq (index .Submitted
"visibility") "private"}} checked{{end}}><span>Private</span></label>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
48┆ <form method="post" action="/new">
49┆ <input type="hidden" name="field" value="org-create">
50┆ <p><label>Name <input name="name" required maxlength="63"
pattern="[a-z0-9][a-z0-9._\-]{0,62}" aria-describedby="orghint" autocomplete="off"
spellcheck="false"></label>
51┆ <span class="hint" id="orghint">The same rules as a repository name, and it becomes a top-
level path.</span></p>
52┆ <p><button type="submit">Create organization</button></p>
53┆ </form>
internal/web/templates/notifications.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
7┆ <a {{if not .All}}class="active" aria-current="page"
{{end}}href="/notifications">unread</a>
⋮┆----------------------------------------
7┆ <a {{if not .All}}class="active" aria-current="page"
{{end}}href="/notifications">unread</a>
⋮┆----------------------------------------
8┆ <a {{if .All}}class="active" aria-current="page" {{end}}href="/notifications?all=1">all</a>
⋮┆----------------------------------------
8┆ <a {{if .All}}class="active" aria-current="page" {{end}}href="/notifications?all=1">all</a>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
11┆ {{if .Notices}}<form method="post" action="/notifications" class="inline"><button
type="submit" class="btn">Mark all read</button></form>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
16┆ <p class="title"><a href="{{.Href}}">{{.Actor}} {{.Summary}}</a></p>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
19┆ {{if not .Read}}<form method="post" action="/notifications" class="inline"><input
type="hidden" name="id" value="{{.ID}}"><button type="submit" class="btn">Mark
read</button></form>{{end}}
internal/web/templates/orglabels.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
10┆ <td>{{if $.CanAdmin}}<form method="post" action="/{{$.Org}}/-/labels" class="inline">
11┆ <input type="hidden" name="name" value="{{.Name}}">
12┆ <input type="text" name="color" value="{{.Color}}" aria-label="Colour for {{.Name}}"
placeholder="rrggbb" size="8">
13┆ <button type="submit" class="btn">Save</button>
14┆ </form>{{else}}<span class="mono">{{if
.Color}}{{.Color}}{{else}}—{{end}}</span>{{end}}</td>
⋮┆----------------------------------------
17┆ {{if $.CanAdmin}}<td class="act"><form method="post" action="/{{$.Org}}/-/labels"
class="inline">
18┆ <input type="hidden" name="action" value="remove">
19┆ <input type="hidden" name="name" value="{{.Name}}">
20┆ {{template "confirmfield" .Name}}
21┆ <button type="submit" class="danger">Remove</button>
22┆ </form></td>{{end}}
⋮┆----------------------------------------
29┆ <form method="post" action="/{{.Org}}/-/labels" class="setform stack">
30┆ <label for="labelname">Name</label>
31┆ <input type="text" id="labelname" name="name" maxlength="50" required>
32┆ <label for="labelcolor">Colour</label>
33┆ <input type="text" id="labelcolor" name="color" placeholder="rrggbb, or blank for one
picked from the name">
34┆ <button type="submit" class="btn">Create label</button>
35┆ </form>
internal/web/templates/orgmilestones.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
6┆ <a {{if eq .State "open"}}class="active" aria-current="page"
{{end}}href="?state=open">open</a>
⋮┆----------------------------------------
6┆ <a {{if eq .State "open"}}class="active" aria-current="page"
{{end}}href="?state=open">open</a>
⋮┆----------------------------------------
7┆ <a {{if eq .State "closed"}}class="active" aria-current="page"
{{end}}href="?state=closed">closed</a>
⋮┆----------------------------------------
7┆ <a {{if eq .State "closed"}}class="active" aria-current="page"
{{end}}href="?state=closed">closed</a>
⋮┆----------------------------------------
8┆ <a {{if eq .State "all"}}class="active" aria-current="page"
{{end}}href="?state=all">all</a>
⋮┆----------------------------------------
8┆ <a {{if eq .State "all"}}class="active" aria-current="page"
{{end}}href="?state=all">all</a>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
15┆ <form method="post" action="/{{.Org}}/-/milestones" class="setform stack">
16┆ <label for="mstitle">Title</label>
17┆ <input type="text" id="mstitle" name="title" required>
18┆ <label for="msdesc">Description</label>
19┆ <input type="text" id="msdesc" name="description">
20┆ <label for="msdue">Due</label>
21┆ <input type="text" id="msdue" name="due" placeholder="YYYY-MM-DD">
22┆ <button type="submit" class="btn">Create milestone</button>
23┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
30┆ <p class="title">{{.Title}} <span class="chip {{if eq .State "open"}}chip-open{{else}}chip-
done{{end}}">{{.State}}</span></p>
⋮┆----------------------------------------
30┆ <p class="title">{{.Title}} <span class="chip {{if eq .State "open"}}chip-open{{else}}chip-
done{{end}}">{{.State}}</span></p>
⋮┆----------------------------------------
30┆ <p class="title">{{.Title}} <span class="chip {{if eq .State "open"}}chip-open{{else}}chip-
done{{end}}">{{.State}}</span></p>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
34┆ {{if $.CanAdmin}}<form method="post" action="/{{$.Org}}/-/milestones" class="inline">
35┆ <input type="hidden" name="title" value="{{.Title}}">
36┆ {{if eq .State "open"}}<input type="hidden" name="action" value="close"><button
type="submit" class="btn">Close</button>{{else}}<input type="hidden" name="action"
value="reopen"><button type="submit" class="btn">Reopen</button>{{end}}
37┆ </form>{{end}}
internal/web/templates/owner.html
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
6┆ {{if .Profile.Website}}<p class="meta"><a href="{{.Profile.Website}}" rel="nofollow
me">{{.Profile.Website}}</a></p>{{end}}
⋮┆----------------------------------------
7┆ {{if .Profile.Links}}<p class="meta">{{range $i, $l := .Profile.Links}}{{if $i}} ·
{{end}}<a href="{{$l.URL}}" rel="nofollow me">{{if
$l.Label}}{{$l.Label}}{{else}}{{$l.URL}}{{end}}</a>{{end}}</p>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
18┆ <a {{if eq .Tab "about"}}aria-current="page" {{end}}href="/{{.Owner}}">About</a>
⋮┆----------------------------------------
18┆ <a {{if eq .Tab "about"}}aria-current="page" {{end}}href="/{{.Owner}}">About</a>
⋮┆----------------------------------------
19┆ <a {{if eq .Tab "repos"}}aria-current="page"
{{end}}href="/{{.Owner}}/-/repositories">Repositories{{if .Repos}} <i>{{len
.Repos}}</i>{{end}}</a>
⋮┆----------------------------------------
19┆ <a {{if eq .Tab "repos"}}aria-current="page"
{{end}}href="/{{.Owner}}/-/repositories">Repositories{{if .Repos}} <i>{{len
.Repos}}</i>{{end}}</a>
⋮┆----------------------------------------
20┆ {{if .Self}}<a {{if eq .Tab "bookmarks"}}aria-current="page"
{{end}}href="/{{.Owner}}/-/bookmarks">Bookmarks</a>{{end}}
⋮┆----------------------------------------
20┆ {{if .Self}}<a {{if eq .Tab "bookmarks"}}aria-current="page"
{{end}}href="/{{.Owner}}/-/bookmarks">Bookmarks</a>{{end}}
⋮┆----------------------------------------
21┆ {{if and (eq .Kind "user") (or .Snippets .Self)}}<a {{if eq .Tab "snippets"}}aria-
current="page" {{end}}href="/{{.Owner}}/-/snippets">Snippets{{if .Snippets}}
<i>{{.Snippets}}</i>{{end}}</a>{{end}}
⋮┆----------------------------------------
21┆ {{if and (eq .Kind "user") (or .Snippets .Self)}}<a {{if eq .Tab "snippets"}}aria-
current="page" {{end}}href="/{{.Owner}}/-/snippets">Snippets{{if .Snippets}}
<i>{{.Snippets}}</i>{{end}}</a>{{end}}
⋮┆----------------------------------------
22┆ {{if .CanAdmin}}<a {{if eq .Tab "people"}}aria-current="page"
{{end}}href="/{{.Owner}}/-/people">People{{if .Members}} <i>{{len
.Members}}</i>{{end}}</a>{{end}}
⋮┆----------------------------------------
22┆ {{if .CanAdmin}}<a {{if eq .Tab "people"}}aria-current="page"
{{end}}href="/{{.Owner}}/-/people">People{{if .Members}} <i>{{len
.Members}}</i>{{end}}</a>{{end}}
⋮┆----------------------------------------
31┆ {{range .Activity}}<div class="actweek">{{if .Month}}<span
class="actmonth">{{.Month}}</span>{{end}}{{range .Days}}<span class="actday{{if .Pad}}
pad{{else}} l{{.Level}}{{end}}"{{if not .Pad}} title="{{.Count}} on
{{.Date}}"{{end}}></span>{{end}}</div>{{end}}
⋮┆----------------------------------------
31┆ {{range .Activity}}<div class="actweek">{{if .Month}}<span
class="actmonth">{{.Month}}</span>{{end}}{{range .Days}}<span class="actday{{if .Pad}}
pad{{else}} l{{.Level}}{{end}}"{{if not .Pad}} title="{{.Count}} on
{{.Date}}"{{end}}></span>{{end}}</div>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
40┆ {{range .Log}}<p class="feedline"><a href="/{{.Actor}}">{{.Actor}}</a> {{.Verb}} <a
href="{{.URL}}"{{if .Jobs}} title="{{join .Jobs ", "}}"{{end}}>{{.Ref}}</a>{{if .Extra}}
{{.Extra}}{{end}}<br><span class="none">{{.Repo}} · <span title="{{whenT .WhenT}}">{{ago
.WhenT}}</span></span></p>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
40┆ {{range .Log}}<p class="feedline"><a href="/{{.Actor}}">{{.Actor}}</a> {{.Verb}} <a
href="{{.URL}}"{{if .Jobs}} title="{{join .Jobs ", "}}"{{end}}>{{.Ref}}</a>{{if .Extra}}
{{.Extra}}{{end}}<br><span class="none">{{.Repo}} · <span title="{{whenT .WhenT}}">{{ago
.WhenT}}</span></span></p>
⋮┆----------------------------------------
40┆ {{range .Log}}<p class="feedline"><a href="/{{.Actor}}">{{.Actor}}</a> {{.Verb}} <a
href="{{.URL}}"{{if .Jobs}} title="{{join .Jobs ", "}}"{{end}}>{{.Ref}}</a>{{if .Extra}}
{{.Extra}}{{end}}<br><span class="none">{{.Repo}} · <span title="{{whenT .WhenT}}">{{ago
.WhenT}}</span></span></p>
⋮┆----------------------------------------
40┆ {{range .Log}}<p class="feedline"><a href="/{{.Actor}}">{{.Actor}}</a> {{.Verb}} <a
href="{{.URL}}"{{if .Jobs}} title="{{join .Jobs ", "}}"{{end}}>{{.Ref}}</a>{{if .Extra}}
{{.Extra}}{{end}}<br><span class="none">{{.Repo}} · <span title="{{whenT .WhenT}}">{{ago
.WhenT}}</span></span></p>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
43┆ <p class="meta"><a href="{{.Feed}}">activity feed</a></p>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
93┆ <td class="act"><form method="post" action="/{{$org}}"><input type="hidden" name="field"
value="member-remove"><input type="hidden" name="user" value="{{.Name}}">{{template
"confirmfield" .Name}} <button type="submit" class="linklike">Remove</button></form></td>
⋮┆----------------------------------------
98┆ <form method="post" action="/{{$org}}" class="setform stack">
99┆ <input type="hidden" name="field" value="member-add">
100┆ <label for="member">Username</label>
101┆ <input type="text" id="member" name="user" required autocomplete="off"
spellcheck="false">
102┆ <label class="none" for="memberrole">Role</label>
103┆ <select id="memberrole" name="role">
104┆ <option value="member">member</option>
105┆ <option value="admin">admin</option>
106┆ </select>
107┆ <button type="submit" class="btn">Apply</button>
[hid 1 additional lines, adjust with --max-lines-per-finding]
121┆ <form method="post" action="/{{$org}}" class="setform stack">
122┆ <input type="hidden" name="field" value="team-add">
123┆ <input type="hidden" name="team" value="{{.Name}}">
124┆ <label class="none" for="tm-{{.Name}}">Add members</label>
125┆ <input type="text" id="tm-{{.Name}}" name="user" placeholder="usernames, space-separated"
autocomplete="off" spellcheck="false">
126┆ <button type="submit" class="btn">Add</button>
127┆ </form>
⋮┆----------------------------------------
128┆ {{if .Members}}<form method="post" action="/{{$org}}" class="setform stack">
129┆ <input type="hidden" name="field" value="team-remove">
130┆ <input type="hidden" name="team" value="{{.Name}}">
131┆ <label class="none" for="tmr-{{.Name}}">Remove members</label>
132┆ <input type="text" id="tmr-{{.Name}}" name="user" placeholder="usernames, space-
separated" autocomplete="off" spellcheck="false">
133┆ {{template "confirmfield" .Name}}
134┆ <button type="submit" class="btn">Remove</button>
135┆ </form>{{end}}
⋮┆----------------------------------------
136┆ <form method="post" action="/{{$org}}" class="setform stack">
137┆ <input type="hidden" name="field" value="team-grant">
138┆ <input type="hidden" name="team" value="{{.Name}}">
139┆ <label class="none" for="tr-{{.Name}}">Grant a repository</label>
140┆ <input type="text" id="tr-{{.Name}}" name="repo" placeholder="owner/name"
autocomplete="off" spellcheck="false">
141┆ <label class="none" for="trr-{{.Name}}">Role</label>
142┆ <select id="trr-{{.Name}}" name="role">
143┆ <option value="read">read</option>
144┆ <option value="write">write</option>
145┆ <option value="admin">admin</option>
[hid 3 additional lines, adjust with --max-lines-per-finding]
149┆ {{if .Grants}}<form method="post" action="/{{$org}}" class="setform stack">
150┆ <input type="hidden" name="field" value="team-revoke">
151┆ <input type="hidden" name="team" value="{{.Name}}">
152┆ <label class="none" for="trv-{{.Name}}">Revoke a repository</label>
153┆ <input type="text" id="trv-{{.Name}}" name="repo" placeholder="owner/name"
autocomplete="off" spellcheck="false">
154┆ {{template "confirmfield" .Name}}
155┆ <button type="submit" class="btn">Revoke</button>
156┆ </form>{{end}}
⋮┆----------------------------------------
157┆ <form method="post" action="/{{$org}}" class="setform">
158┆ <input type="hidden" name="field" value="team-delete">
159┆ <input type="hidden" name="team" value="{{.Name}}">
160┆ {{template "confirmfield" .Name}}
161┆ <button type="submit" class="danger">Delete this team</button>
162┆ </form>
⋮┆----------------------------------------
168┆ <form method="post" action="/{{$org}}" class="setform">
169┆ <input type="hidden" name="field" value="team-create">
170┆ <label for="newteam">Name</label>
171┆ <input type="text" id="newteam" name="team" required>
172┆ <button type="submit" class="btn">Create</button>
173┆ </form>
⋮┆----------------------------------------
179┆ <form method="post" action="/{{$org}}" class="setform">
180┆ <input type="hidden" name="field" value="org-rename">
181┆ <label for="orgrename">New name</label>
182┆ <input type="text" id="orgrename" name="name" value="{{$org}}" required
autocomplete="off" spellcheck="false">
183┆ <button type="submit" class="btn">Rename</button>
184┆ </form>
internal/web/templates/queries.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
14┆ <p class="title"><a href="/{{.Repo}}/{{if eq .Kind
"mr"}}mrs{{else}}issues{{end}}/{{.Number}}">{{.Title}}</a></p>
⋮┆----------------------------------------
14┆ <p class="title"><a href="/{{.Repo}}/{{if eq .Kind
"mr"}}mrs{{else}}issues{{end}}/{{.Number}}">{{.Title}}</a></p>
⋮┆----------------------------------------
14┆ <p class="title"><a href="/{{.Repo}}/{{if eq .Kind
"mr"}}mrs{{else}}issues{{end}}/{{.Number}}">{{.Title}}</a></p>
⋮┆----------------------------------------
14┆ <p class="title"><a href="/{{.Repo}}/{{if eq .Kind
"mr"}}mrs{{else}}issues{{end}}/{{.Number}}">{{.Title}}</a></p>
⋮┆----------------------------------------
17┆ <span class="chip {{if eq .State "open"}}chip-open{{else if eq .State "merged"}}chip-
done{{else}}chip-closed{{end}}">{{if .Draft}}draft{{else}}{{.State}}{{end}}</span>
⋮┆----------------------------------------
17┆ <span class="chip {{if eq .State "open"}}chip-open{{else if eq .State "merged"}}chip-
done{{else}}chip-closed{{end}}">{{if .Draft}}draft{{else}}{{.State}}{{end}}</span>
⋮┆----------------------------------------
17┆ <span class="chip {{if eq .State "open"}}chip-open{{else if eq .State "merged"}}chip-
done{{else}}chip-closed{{end}}">{{if .Draft}}draft{{else}}{{.State}}{{end}}</span>
⋮┆----------------------------------------
17┆ <span class="chip {{if eq .State "open"}}chip-open{{else if eq .State "merged"}}chip-
done{{else}}chip-closed{{end}}">{{if .Draft}}draft{{else}}{{.State}}{{end}}</span>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
21┆ {{if .Next}}<p class="pager"><a href="{{.Next}}">older →</a></p>{{end}}
internal/web/templates/register.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
8┆ <form method="post" action="/register" class="signupform">
9┆ <div class="field"><label for="username">Username</label><input type="text" id="username"
name="username" value="{{.Username}}" required autocomplete="username"
autocapitalize="none" spellcheck="false"></div>
10┆ {{if eq .Mode "invite"}}<div class="field"><label for="invite">Invite code</label><input
type="text" id="invite" name="invite" required autocomplete="off" spellcheck="false"></div>
11┆ {{else}}<div class="field"><label for="email">Email</label><input type="email" id="email"
name="email" required autocomplete="email"></div>{{end}}
12┆ <div class="field"><label for="key">SSH public key</label>
13┆ <p class="hint">Paste the contents of your public key file, usually
<code>~/.ssh/id_ed25519.pub</code>. It starts with <code>ssh-ed25519</code> or <code>ssh-
rsa</code>.</p>
14┆ {{/* The help is a disclosure rather than a link out: a wiki page is on
15┆ another origin, opens over the half-filled form, and has no way
16┆ back to it. */}}
17┆ <details class="editbox"><summary>No key yet?</summary>
[hid 7 additional lines, adjust with --max-lines-per-finding]
internal/web/templates/releases.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
7┆ <details class="editbox"{{if .Draft.Is "release"}} open{{end}}><summary>New
release</summary>
⋮┆----------------------------------------
7┆ <details class="editbox"{{if .Draft.Is "release"}} open{{end}}><summary>New
release</summary>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
9┆ <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/releases"
class="commentform">
10┆ <p class="branchpick">
11┆ <label for="tag">Tag</label>
12┆ <select id="tag" name="tag" required>
13┆ {{range .FreeTags}}<option value="{{.}}"{{if eq . $want}}
selected{{end}}>{{.}}</option>{{end}}
14┆ </select>
15┆ </p>
16┆ <p><input type="text" name="title" aria-label="Title" placeholder="title (defaults to the
tag)" value="{{.Draft.Or "release" "title" ""}}"></p>
17┆ <p><textarea name="notes" aria-label="Notes" rows="6" placeholder="what
changed">{{.Draft.Or "release" "notes" ""}}</textarea></p>
18┆ <p><button type="submit" class="btn">Create release</button> {{template "previewbtn"}}
<button type="submit" name="summarize" value="1" class="btn">Summarize changes</button></p>
[hid 1 additional lines, adjust with --max-lines-per-finding]
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
13┆ {{range .FreeTags}}<option value="{{.}}"{{if eq . $want}}
selected{{end}}>{{.}}</option>{{end}}
⋮┆----------------------------------------
13┆ {{range .FreeTags}}<option value="{{.}}"{{if eq . $want}}
selected{{end}}>{{.}}</option>{{end}}
⋮┆----------------------------------------
16┆ <p><input type="text" name="title" aria-label="Title" placeholder="title (defaults to the
tag)" value="{{.Draft.Or "release" "title" ""}}"></p>
⋮┆----------------------------------------
30┆ {{if $.CanWrite}}<details class="editbox"{{if $.Draft.Is $form}}
open{{end}}><summary>Edit</summary>
⋮┆----------------------------------------
30┆ {{if $.CanWrite}}<details class="editbox"{{if $.Draft.Is $form}}
open{{end}}><summary>Edit</summary>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
32┆ <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases"
class="commentform">
33┆ <input type="hidden" name="action" value="edit">
34┆ <input type="hidden" name="tag" value="{{$rel.Tag}}">
35┆ <p><input type="text" name="title" aria-label="Title" value="{{$.Draft.Or $form "title"
$rel.Title}}"></p>
36┆ <p><textarea name="notes" aria-label="Notes" rows="6">{{$.Draft.Or $form "notes"
$rel.Notes}}</textarea></p>
37┆ <p><button type="submit" class="btn">Save</button> {{template "previewbtn"}}</p>
38┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
35┆ <p><input type="text" name="title" aria-label="Title" value="{{$.Draft.Or $form "title"
$rel.Title}}"></p>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
39┆ {{if $.CanAdmin}}<form method="post"
action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases" class="commentform">
40┆ <input type="hidden" name="action" value="delete">
41┆ <input type="hidden" name="tag" value="{{$rel.Tag}}">
42┆ <p class="meta">Deleting is permanent and takes the assets with it. The tag stays.</p>
43┆ <p>{{template "confirmfield" $rel.Tag}} <button type="submit" class="danger">Delete
release</button></p>
44┆ </form>{{end}}</details>{{end}}
⋮┆----------------------------------------
51┆ {{if $.CanWrite}}<td class="act"><form method="post"
action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/assets" class="inline">
52┆ <input type="hidden" name="action" value="remove">
53┆ <input type="hidden" name="tag" value="{{$rel.Tag}}">
54┆ <input type="hidden" name="name" value="{{.Name}}">
55┆ {{template "confirmfield" .Name}}
56┆ <button type="submit" class="danger">Remove</button>
57┆ </form></td>{{end}}
⋮┆----------------------------------------
61┆ <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/assets"
enctype="multipart/form-data" class="commentform">
62┆ <input type="hidden" name="tag" value="{{$rel.Tag}}">
63┆ <p><input type="file" name="file" aria-label="File" required></p>
64┆ <p><input type="text" name="name" aria-label="Name" placeholder="name (defaults to the
file's name)"></p>
65┆ <p><button type="submit" class="btn">Upload</button></p>
66┆ </form>
internal/web/templates/settings.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
30┆ <form method="post" action="{{$base}}" class="setform">
31┆ <input type="hidden" name="field" value="description">
32┆ <div><label for="description">Description</label></div>
33┆ <div><input type="text" id="description" name="description" value="{{or (index .Submitted
"description") .Desc}}" placeholder="one line, shown in listings"></div>
34┆ <div><button type="submit">Save</button></div>
35┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
33┆ <div><input type="text" id="description" name="description" value="{{or (index .Submitted
"description") .Desc}}" placeholder="one line, shown in listings"></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
36┆ <form method="post" action="{{$base}}" class="setform">
37┆ <input type="hidden" name="field" value="website">
38┆ <div><label for="website">Website</label></div>
39┆ <div><input type="text" id="website" name="website" value="{{or (index .Submitted
"website") .Repo.Settings.Website}}" placeholder="https://example.org"></div>
40┆ <div><button type="submit" class="btn">Save</button></div>
41┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
39┆ <div><input type="text" id="website" name="website" value="{{or (index .Submitted
"website") .Repo.Settings.Website}}" placeholder="https://example.org"></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
42┆ <form method="post" action="{{$base}}" class="setform">
43┆ <input type="hidden" name="field" value="topics">
44┆ <div><label for="topics">Topics</label><p class="hint">Comma separated, lower
case.</p></div>
45┆ <div><input type="text" id="topics" name="topics" value="{{or (index .Submitted "topics")
(join .Topics ", ")}}"></div>
46┆ <div><button type="submit" class="btn">Save</button></div>
47┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
45┆ <div><input type="text" id="topics" name="topics" value="{{or (index .Submitted "topics")
(join .Topics ", ")}}"></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
48┆ {{if .Branches}}<form method="post" action="{{$base}}" class="setform">
49┆ <input type="hidden" name="field" value="default-branch">
50┆ <div><label for="default-branch">Default branch</label></div>
51┆ <div><select id="default-branch" name="default-branch">{{$cur :=
.Repo.DefaultBranch}}{{range .Branches}}<option value="{{.Name}}"{{if eq .Name $cur}}
selected{{end}}>{{.Name}}</option>{{end}}</select></div>
52┆ <div><button type="submit" class="btn">Save</button></div>
53┆ </form>{{end}}
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
51┆ <div><select id="default-branch" name="default-branch">{{$cur :=
.Repo.DefaultBranch}}{{range .Branches}}<option value="{{.Name}}"{{if eq .Name $cur}}
selected{{end}}>{{.Name}}</option>{{end}}</select></div>
⋮┆----------------------------------------
51┆ <div><select id="default-branch" name="default-branch">{{$cur :=
.Repo.DefaultBranch}}{{range .Branches}}<option value="{{.Name}}"{{if eq .Name $cur}}
selected{{end}}>{{.Name}}</option>{{end}}</select></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
57┆ <form method="post" action="{{$base}}" class="setform">
58┆ <input type="hidden" name="field" value="visibility">
59┆ <div><span class="fieldname">Visibility</span></div>
60┆ <div class="check">
61┆ <label><input type="radio" name="visibility" value="public"{{if eq .Repo.Visibility
"public"}} checked{{end}}> Public</label>
62┆ <label><input type="radio" name="visibility" value="private"{{if eq .Repo.Visibility
"private"}} checked{{end}}> Private</label>
63┆ </div>
64┆ <div><button type="submit" class="btn">Save</button></div>
65┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
61┆ <label><input type="radio" name="visibility" value="public"{{if eq .Repo.Visibility
"public"}} checked{{end}}> Public</label>
⋮┆----------------------------------------
61┆ <label><input type="radio" name="visibility" value="public"{{if eq .Repo.Visibility
"public"}} checked{{end}}> Public</label>
⋮┆----------------------------------------
62┆ <label><input type="radio" name="visibility" value="private"{{if eq .Repo.Visibility
"private"}} checked{{end}}> Private</label>
⋮┆----------------------------------------
62┆ <label><input type="radio" name="visibility" value="private"{{if eq .Repo.Visibility
"private"}} checked{{end}}> Private</label>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
66┆ <form method="post" action="{{$base}}" class="setform">
67┆ <input type="hidden" name="field" value="git-daemon">
68┆ <div><label for="git-daemon">Serve over git://</label><p class="hint">Public repositories
only.</p></div>
69┆ <div class="check"><input type="checkbox" id="git-daemon" name="git-daemon"
value="on"{{if .Repo.Settings.GitDaemon}} checked{{end}}></div>
70┆ <div><button type="submit" class="btn">Save</button></div>
71┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
69┆ <div class="check"><input type="checkbox" id="git-daemon" name="git-daemon" value="on"{{if
.Repo.Settings.GitDaemon}} checked{{end}}></div>
⋮┆----------------------------------------
69┆ <div class="check"><input type="checkbox" id="git-daemon" name="git-daemon" value="on"{{if
.Repo.Settings.GitDaemon}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
79┆ <td class="act">{{if eq .Source "direct"}}<form method="post" action="{{$base}}"
class="inline">
80┆ <input type="hidden" name="field" value="access-revoke">
81┆ <input type="hidden" name="user" value="{{.User}}">
82┆ <button type="submit" class="danger">Revoke</button>
83┆ </form>{{end}}</td>
⋮┆----------------------------------------
86┆ <form method="post" action="{{$base}}" class="setform">
87┆ <input type="hidden" name="field" value="access-grant">
88┆ <div><label for="grant-user">Grant access</label><p class="hint">An account name and a
role. A grant adds to what an organization or team already gives.</p></div>
89┆ <div><input type="text" id="grant-user" name="user" value="{{index .Submitted "user"}}"
autocomplete="off" spellcheck="false" placeholder="username">
90┆ <select name="role" aria-label="Role">{{$role := index .Submitted "role"}}<option
value="read"{{if eq $role "read"}} selected{{end}}>read</option><option value="write"{{if
eq $role "write"}} selected{{end}}>write</option><option value="admin"{{if eq $role
"admin"}} selected{{end}}>admin</option></select></div>
91┆ <div><button type="submit" class="btn">Grant</button></div>
92┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
89┆ <div><input type="text" id="grant-user" name="user" value="{{index .Submitted "user"}}"
autocomplete="off" spellcheck="false" placeholder="username">
⋮┆----------------------------------------
90┆ <select name="role" aria-label="Role">{{$role := index .Submitted "role"}}<option
value="read"{{if eq $role "read"}} selected{{end}}>read</option><option value="write"{{if
eq $role "write"}} selected{{end}}>write</option><option value="admin"{{if eq $role
"admin"}} selected{{end}}>admin</option></select></div>
⋮┆----------------------------------------
90┆ <select name="role" aria-label="Role">{{$role := index .Submitted "role"}}<option
value="read"{{if eq $role "read"}} selected{{end}}>read</option><option value="write"{{if
eq $role "write"}} selected{{end}}>write</option><option value="admin"{{if eq $role
"admin"}} selected{{end}}>admin</option></select></div>
⋮┆----------------------------------------
90┆ <select name="role" aria-label="Role">{{$role := index .Submitted "role"}}<option
value="read"{{if eq $role "read"}} selected{{end}}>read</option><option value="write"{{if
eq $role "write"}} selected{{end}}>write</option><option value="admin"{{if eq $role
"admin"}} selected{{end}}>admin</option></select></div>
⋮┆----------------------------------------
90┆ <select name="role" aria-label="Role">{{$role := index .Submitted "role"}}<option
value="read"{{if eq $role "read"}} selected{{end}}>read</option><option value="write"{{if
eq $role "write"}} selected{{end}}>write</option><option value="admin"{{if eq $role
"admin"}} selected{{end}}>admin</option></select></div>
⋮┆----------------------------------------
90┆ <select name="role" aria-label="Role">{{$role := index .Submitted "role"}}<option
value="read"{{if eq $role "read"}} selected{{end}}>read</option><option value="write"{{if
eq $role "write"}} selected{{end}}>write</option><option value="admin"{{if eq $role
"admin"}} selected{{end}}>admin</option></select></div>
⋮┆----------------------------------------
90┆ <select name="role" aria-label="Role">{{$role := index .Submitted "role"}}<option
value="read"{{if eq $role "read"}} selected{{end}}>read</option><option value="write"{{if
eq $role "write"}} selected{{end}}>write</option><option value="admin"{{if eq $role
"admin"}} selected{{end}}>admin</option></select></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
99┆ <form method="post" action="{{$base}}" class="inline">
100┆ <input type="hidden" name="field" value="webhook-remove">
101┆ <input type="hidden" name="id" value="{{.ID}}">
102┆ <button type="submit" class="danger">Remove</button>
103┆ </form></li>
⋮┆----------------------------------------
107┆ <form method="post" action="{{$base}}" class="setform stack" autocomplete="off">
108┆ <input type="hidden" name="field" value="webhook-add">
109┆ <label for="hook-url">Add a webhook</label>
110┆ <input type="text" id="hook-url" name="url" value="{{index .Submitted "url"}}"
placeholder="https://ci.example.org/hook" spellcheck="false">
111┆ <label for="hook-events">Events</label>
112┆ <p class="hint">Comma separated, or <code>*</code> for all.</p>
113┆ <input type="text" id="hook-events" name="events" value="{{or (index .Submitted "events")
"*"}}" spellcheck="false">
114┆ <label for="hook-secret">Secret</label>
115┆ <p class="hint">Optional. Signs each delivery; it is not shown again.</p>
116┆ <input type="password" id="hook-secret" name="secret" value="" autocomplete="new-
password">
[hid 2 additional lines, adjust with --max-lines-per-finding]
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
110┆ <input type="text" id="hook-url" name="url" value="{{index .Submitted "url"}}"
placeholder="https://ci.example.org/hook" spellcheck="false">
⋮┆----------------------------------------
113┆ <input type="text" id="hook-events" name="events" value="{{or (index .Submitted "events")
"*"}}" spellcheck="false">
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
127┆ <td class="act"><form method="post" action="{{$base}}" class="inline">
128┆ <input type="hidden" name="field" value="webhook-redeliver">
129┆ <input type="hidden" name="delivery" value="{{.ID}}">
130┆ <button type="submit" class="btn">Redeliver</button>
131┆ </form></td>
⋮┆----------------------------------------
138┆ <form method="post" action="{{$base}}" class="setform">
139┆ <input type="hidden" name="field" value="require-checks">
140┆ <div><label for="require-checks">Required checks</label><p class="hint">Requires CI to
succeed.{{with .Repo.Settings.RequiredContexts}} Also waits for {{range $i, $c := .}}{{if
$i}}, {{end}}<code>{{$c}}</code>{{end}} until they report{{if not
$.Repo.Settings.RequireChecks}}, once this is on{{end}}.{{end}}</p></div>
141┆ <div class="check"><input type="checkbox" id="require-checks" name="require-checks"
value="on"{{if .Repo.Settings.RequireChecks}} checked{{end}}></div>
142┆ <div><button type="submit" class="btn">Save</button></div>
143┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
141┆ <div class="check"><input type="checkbox" id="require-checks" name="require-checks"
value="on"{{if .Repo.Settings.RequireChecks}} checked{{end}}></div>
⋮┆----------------------------------------
141┆ <div class="check"><input type="checkbox" id="require-checks" name="require-checks"
value="on"{{if .Repo.Settings.RequireChecks}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
144┆ <form method="post" action="{{$base}}" class="setform">
145┆ <input type="hidden" name="field" value="require-contexts">
146┆ <div><label for="contexts">Required contexts</label><p class="hint">Statuses the checks
gate waits for until they report, separated by spaces. Saving any turns required checks on;
saving none leaves it as it is.</p></div>
147┆ <div><input type="text" id="contexts" name="contexts" value="{{range $i, $c :=
.Repo.Settings.RequiredContexts}}{{if $i}} {{end}}{{$c}}{{end}}" autocomplete="off"></div>
148┆ <div><button type="submit" class="btn">Save</button></div>
149┆ </form>
⋮┆----------------------------------------
150┆ <form method="post" action="{{$base}}" class="setform">
151┆ <input type="hidden" name="field" value="require-approvals">
152┆ <div><label for="approvals">Approvals</label><p class="hint">Approvals from anyone with
write access. Zero means none required.</p></div>
153┆ <div class="num"><input type="number" id="approvals" name="approvals" min="0" max="10"
value="{{.Repo.Settings.RequireApprovals}}"></div>
154┆ <div><button type="submit" class="btn">Save</button></div>
155┆ </form>
⋮┆----------------------------------------
156┆ <form method="post" action="{{$base}}" class="setform">
157┆ <input type="hidden" name="field" value="require-resolved">
158┆ <div><label for="require-resolved">Review threads</label><p class="hint">Every thread on
the diff must be resolved before merging.</p></div>
159┆ <div class="check"><input type="checkbox" id="require-resolved" name="require-resolved"
value="on"{{if .Repo.Settings.RequireResolved}} checked{{end}}></div>
160┆ <div><button type="submit" class="btn">Save</button></div>
161┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
159┆ <div class="check"><input type="checkbox" id="require-resolved" name="require-resolved"
value="on"{{if .Repo.Settings.RequireResolved}} checked{{end}}></div>
⋮┆----------------------------------------
159┆ <div class="check"><input type="checkbox" id="require-resolved" name="require-resolved"
value="on"{{if .Repo.Settings.RequireResolved}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
162┆ <form method="post" action="{{$base}}" class="setform">
163┆ <input type="hidden" name="field" value="require-codeowners">
164┆ <div><label for="require-codeowners">CODEOWNERS</label><p class="hint">Code owners must
approve.</p></div>
165┆ <div class="check"><input type="checkbox" id="require-codeowners" name="require-
codeowners" value="on"{{if .Repo.Settings.RequireCodeowners}} checked{{end}}></div>
166┆ <div><button type="submit" class="btn">Save</button></div>
167┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
165┆ <div class="check"><input type="checkbox" id="require-codeowners" name="require-codeowners"
value="on"{{if .Repo.Settings.RequireCodeowners}} checked{{end}}></div>
⋮┆----------------------------------------
165┆ <div class="check"><input type="checkbox" id="require-codeowners" name="require-codeowners"
value="on"{{if .Repo.Settings.RequireCodeowners}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
168┆ <form method="post" action="{{$base}}" class="setform">
169┆ <input type="hidden" name="field" value="require-signed">
170┆ <div><label for="require-signed">Signed commits</label><p class="hint">Every commit in
the request must carry a verified signature. Squash and merge strategies are refused, since
both mint an unsigned commit.</p></div>
171┆ <div class="check"><input type="checkbox" id="require-signed" name="require-signed"
value="on"{{if .Repo.Settings.RequireSignedCommits}} checked{{end}}></div>
172┆ <div><button type="submit" class="btn">Save</button></div>
173┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
171┆ <div class="check"><input type="checkbox" id="require-signed" name="require-signed"
value="on"{{if .Repo.Settings.RequireSignedCommits}} checked{{end}}></div>
⋮┆----------------------------------------
171┆ <div class="check"><input type="checkbox" id="require-signed" name="require-signed"
value="on"{{if .Repo.Settings.RequireSignedCommits}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
177┆ <form method="post" action="{{$base}}" class="setform">
178┆ <input type="hidden" name="field" value="security">
179┆ <div><label for="security-enabled">Scheduled scan</label><p class="hint">Runs the
instance's code scanner over <code>{{.Repo.DefaultBranch}}</code> on its schedule, on a
runner attached to this repository, and keeps an issue of what it finds.</p></div>
180┆ <div class="check"><input type="checkbox" id="security-enabled" name="security"
value="on"{{if .Security.Enabled}} checked{{end}}></div>
181┆ <div><button type="submit" class="btn">Save</button></div>
182┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
180┆ <div class="check"><input type="checkbox" id="security-enabled" name="security"
value="on"{{if .Security.Enabled}} checked{{end}}></div>
⋮┆----------------------------------------
180┆ <div class="check"><input type="checkbox" id="security-enabled" name="security"
value="on"{{if .Security.Enabled}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
192┆ <td><form method="post" action="{{$base}}" class="inline">
193┆ <input type="hidden" name="field" value="security-dismiss">
194┆ <input type="hidden" name="fingerprint" value="{{.Fingerprint}}">
195┆ <select name="reason" aria-label="Reason"><option value="false-positive">False
positive</option><option value="wont-fix">Won't fix</option><option value="test">Used in
tests</option></select>
196┆ <button type="submit">Dismiss</button>
197┆ </form></td>
⋮┆----------------------------------------
207┆ <td><form method="post" action="{{$base}}" class="inline">
208┆ <input type="hidden" name="field" value="security-reopen">
209┆ <input type="hidden" name="fingerprint" value="{{.Fingerprint}}">
210┆ <button type="submit">Reopen</button>
211┆ </form></td>
⋮┆----------------------------------------
215┆ <form method="post" action="{{$base}}" class="setform">
216┆ <input type="hidden" name="field" value="security-ignore">
217┆ <div><label for="security-ignore">Ignored paths</label><p class="hint">Findings under
these paths are set aside from the next scan. Path globs separated by spaces:
<code>testdata/**</code>, <code>web/templates/*.html</code>. Paths
<code>.gitattributes</code> marks <code>linguist-vendored</code> or <code>linguist-
generated</code> are set aside without being listed.</p></div>
218┆ <div><input type="text" id="security-ignore" name="security-ignore" value="{{join
.Repo.Settings.SecurityIgnore " "}}"></div>
219┆ <div><button type="submit" class="btn">Save</button></div>
220┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
218┆ <div><input type="text" id="security-ignore" name="security-ignore" value="{{join
.Repo.Settings.SecurityIgnore " "}}"></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
221┆ <form method="post" action="{{$base}}" class="setform">
222┆ <input type="hidden" name="field" value="security-exclude-rule">
223┆ <div><label for="security-exclude-rule">Excluded rules</label><p class="hint">Findings
from these rules are set aside from the next scan. A rule id or a family of them, separated
by spaces: <code>swift.lang.crypto.insecure-random</code>,
<code>javascript.browser</code>.</p></div>
224┆ <div><input type="text" id="security-exclude-rule" name="security-exclude-rule"
value="{{join .Repo.Settings.SecurityExcludeRules " "}}"></div>
225┆ <div><button type="submit" class="btn">Save</button></div>
226┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
224┆ <div><input type="text" id="security-exclude-rule" name="security-exclude-rule"
value="{{join .Repo.Settings.SecurityExcludeRules " "}}"></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
231┆ <form method="post" action="{{$base}}" class="setform">
232┆ <input type="hidden" name="field" value="secret-scan">
233┆ <div><label for="secret-scan">Pushes</label><p class="hint">Each push's new files are
checked for credentials in known formats. Warn accepts the push and tells the pusher where;
block refuses it. Only the path, line and kind of credential are reported, never the
value.</p></div>
234┆ <div><select id="secret-scan" name="secret-scan">{{$mode := or .Repo.Settings.SecretScan
"warn"}}<option value="off"{{if eq $mode "off"}} selected{{end}}>off</option><option
value="warn"{{if eq $mode "warn"}} selected{{end}}>warn</option><option value="block"{{if
eq $mode "block"}} selected{{end}}>block</option></select></div>
235┆ <div><button type="submit" class="btn">Save</button></div>
236┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
234┆ <div><select id="secret-scan" name="secret-scan">{{$mode := or .Repo.Settings.SecretScan
"warn"}}<option value="off"{{if eq $mode "off"}} selected{{end}}>off</option><option
value="warn"{{if eq $mode "warn"}} selected{{end}}>warn</option><option value="block"{{if
eq $mode "block"}} selected{{end}}>block</option></select></div>
⋮┆----------------------------------------
234┆ <div><select id="secret-scan" name="secret-scan">{{$mode := or .Repo.Settings.SecretScan
"warn"}}<option value="off"{{if eq $mode "off"}} selected{{end}}>off</option><option
value="warn"{{if eq $mode "warn"}} selected{{end}}>warn</option><option value="block"{{if
eq $mode "block"}} selected{{end}}>block</option></select></div>
⋮┆----------------------------------------
234┆ <div><select id="secret-scan" name="secret-scan">{{$mode := or .Repo.Settings.SecretScan
"warn"}}<option value="off"{{if eq $mode "off"}} selected{{end}}>off</option><option
value="warn"{{if eq $mode "warn"}} selected{{end}}>warn</option><option value="block"{{if
eq $mode "block"}} selected{{end}}>block</option></select></div>
⋮┆----------------------------------------
234┆ <div><select id="secret-scan" name="secret-scan">{{$mode := or .Repo.Settings.SecretScan
"warn"}}<option value="off"{{if eq $mode "off"}} selected{{end}}>off</option><option
value="warn"{{if eq $mode "warn"}} selected{{end}}>warn</option><option value="block"{{if
eq $mode "block"}} selected{{end}}>block</option></select></div>
⋮┆----------------------------------------
234┆ <div><select id="secret-scan" name="secret-scan">{{$mode := or .Repo.Settings.SecretScan
"warn"}}<option value="off"{{if eq $mode "off"}} selected{{end}}>off</option><option
value="warn"{{if eq $mode "warn"}} selected{{end}}>warn</option><option value="block"{{if
eq $mode "block"}} selected{{end}}>block</option></select></div>
⋮┆----------------------------------------
234┆ <div><select id="secret-scan" name="secret-scan">{{$mode := or .Repo.Settings.SecretScan
"warn"}}<option value="off"{{if eq $mode "off"}} selected{{end}}>off</option><option
value="warn"{{if eq $mode "warn"}} selected{{end}}>warn</option><option value="block"{{if
eq $mode "block"}} selected{{end}}>block</option></select></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
237┆ <form method="post" action="{{$base}}" class="setform">
238┆ <input type="hidden" name="field" value="secret-scan-allow">
239┆ <div><label for="secret-scan-allow">Allowed paths</label><p class="hint">Findings under
these paths are ignored, for test fixtures. Path globs separated by spaces:
<code>testdata/**</code>, <code>*_test.go</code>.</p></div>
240┆ <div><input type="text" id="secret-scan-allow" name="secret-scan-allow" value="{{join
.Repo.Settings.SecretScanAllow " "}}"></div>
241┆ <div><button type="submit" class="btn">Save</button></div>
242┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
240┆ <div><input type="text" id="secret-scan-allow" name="secret-scan-allow" value="{{join
.Repo.Settings.SecretScanAllow " "}}"></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
249┆ <form method="post" action="{{$base}}" class="inline">
250┆ <input type="hidden" name="field" value="unprotect">
251┆ <input type="hidden" name="branch" value="{{.}}">
252┆ <button type="submit" class="danger">Unprotect</button>
253┆ </form></li>
⋮┆----------------------------------------
257┆ <form method="post" action="{{$base}}" class="setform">
258┆ <input type="hidden" name="field" value="protect">
259┆ <div><label for="branch">Protect a branch</label></div>
260┆ <div><select id="branch" name="branch">{{range .Branches}}<option
value="{{.Name}}">{{.Name}}</option>{{end}}</select></div>
261┆ <div><button type="submit" class="btn">Protect</button></div>
262┆ </form>
⋮┆----------------------------------------
263┆ <form method="post" action="{{$base}}" class="setform">
264┆ <input type="hidden" name="field" value="require-mr">
265┆ <div><label for="require-mr">Require merge requests</label><p class="hint">Every
protected branch changes through a merge request. A direct push is refused in pre-
receive.</p></div>
266┆ <div class="check"><input type="checkbox" id="require-mr" name="require-mr"
value="on"{{if .Repo.Settings.RequireMR}} checked{{end}}></div>
267┆ <div><button type="submit" class="btn">Save</button></div>
268┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
266┆ <div class="check"><input type="checkbox" id="require-mr" name="require-mr" value="on"{{if
.Repo.Settings.RequireMR}} checked{{end}}></div>
⋮┆----------------------------------------
266┆ <div class="check"><input type="checkbox" id="require-mr" name="require-mr" value="on"{{if
.Repo.Settings.RequireMR}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
275┆ <form method="post" action="{{$base}}" class="inline">
276┆ <input type="hidden" name="field" value="unprotect-tag">
277┆ <input type="hidden" name="glob" value="{{.}}">
278┆ <button type="submit" class="danger">Unprotect</button>
279┆ </form></li>
⋮┆----------------------------------------
283┆ <form method="post" action="{{$base}}" class="setform">
284┆ <input type="hidden" name="field" value="protect-tag">
285┆ <div><label for="glob">Protect tags matching</label></div>
286┆ <div><input type="text" id="glob" name="glob" placeholder="v*"></div>
287┆ <div><button type="submit" class="btn">Protect</button></div>
288┆ </form>
⋮┆----------------------------------------
292┆ <form method="post" action="{{$base}}" class="setform">
293┆ <input type="hidden" name="field" value="deps">
294┆ <div><label for="deps-enabled">Check for updates and advisories</label><p
class="hint">Evaluates the manifests and lockfiles on <code>{{.Repo.DefaultBranch}}</code>
against the registries and OSV, and opens an issue for each. Updates for Go, NPM, Crates,
and PyPI; advisories for those and SwiftPM.</p></div>
295┆ <div class="check"><input type="checkbox" id="deps-enabled" name="deps" value="on"{{if
.DepsEnabled}} checked{{end}}></div>
296┆ <div><button type="submit" class="btn">Save</button></div>
297┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
295┆ <div class="check"><input type="checkbox" id="deps-enabled" name="deps" value="on"{{if
.DepsEnabled}} checked{{end}}></div>
⋮┆----------------------------------------
295┆ <div class="check"><input type="checkbox" id="deps-enabled" name="deps" value="on"{{if
.DepsEnabled}} checked{{end}}></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
327┆ <form method="post" action="{{$base}}" class="inline">
328┆ <input type="hidden" name="field" value="runner-remove">
329┆ <input type="hidden" name="fingerprint" value="{{.Fingerprint}}">
330┆ <button type="submit" class="danger">Detach</button>
331┆ </form></li>
⋮┆----------------------------------------
335┆ <form method="post" action="{{$base}}" class="setform stack">
336┆ <input type="hidden" name="field" value="runner-add">
337┆ <label for="runner-key">Attach a runner</label>
338┆ <p class="hint">Install <code>gitbay-runner</code>, run <code>gitbay-runner init</code>,
and paste the key it prints. The runner builds your commits with the repository's secrets;
merge requests from forks wait unless it runs with <code>-untrusted</code>.</p>
339┆ <textarea id="runner-key" name="key" rows="3" spellcheck="false" placeholder="ssh-ed25519
AAAA… (from gitbay-runner init)">{{index .Submitted "key"}}</textarea>
340┆ <label for="runner-jobs">Jobs</label>
341┆ <p class="hint">Leave empty for every job. Name jobs, comma-separated, to have this
runner claim only those here, for instance <code>gitbay-security</code> on a runner with
the code scanning image.</p>
342┆ <input type="text" id="runner-jobs" name="jobs" value="{{index .Submitted "jobs"}}">
343┆ <button type="submit" class="btn">Attach</button>
344┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
342┆ <input type="text" id="runner-jobs" name="jobs" value="{{index .Submitted "jobs"}}">
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
348┆ <form method="post" action="{{$base}}" class="setform">
349┆ <input type="hidden" name="field" value="archive">
350┆ <div><label for="archive">Archived</label><p class="hint">Read-only for everyone. Issues
and requests close to new activity. Reversible.</p></div>
351┆ <div class="check"><input type="checkbox" id="archive" name="archive" value="on"{{if
.Repo.Settings.Archived}} checked{{end}}></div>
352┆ <div><button type="submit" {{if
.Repo.Settings.Archived}}class="btn"{{else}}class="danger"{{end}}>Save</button></div>
353┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
351┆ <div class="check"><input type="checkbox" id="archive" name="archive" value="on"{{if
.Repo.Settings.Archived}} checked{{end}}></div>
⋮┆----------------------------------------
351┆ <div class="check"><input type="checkbox" id="archive" name="archive" value="on"{{if
.Repo.Settings.Archived}} checked{{end}}></div>
⋮┆----------------------------------------
352┆ <div><button type="submit" {{if
.Repo.Settings.Archived}}class="btn"{{else}}class="danger"{{end}}>Save</button></div>
⋮┆----------------------------------------
352┆ <div><button type="submit" {{if
.Repo.Settings.Archived}}class="btn"{{else}}class="danger"{{end}}>Save</button></div>
⋮┆----------------------------------------
352┆ <div><button type="submit" {{if
.Repo.Settings.Archived}}class="btn"{{else}}class="danger"{{end}}>Save</button></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
354┆ <form method="post" action="{{$base}}" class="setform">
355┆ <input type="hidden" name="field" value="rename">
356┆ <div><label for="rename">Name</label><p class="hint">Clone URLs change. The old path
stops resolving.</p></div>
357┆ <div><input type="text" id="rename" name="name" value="{{or (index .Submitted "name")
.Repo.Name}}" autocomplete="off" spellcheck="false"></div>
358┆ <div><button type="submit" class="btn">Rename</button></div>
359┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
357┆ <div><input type="text" id="rename" name="name" value="{{or (index .Submitted "name")
.Repo.Name}}" autocomplete="off" spellcheck="false"></div>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
361┆ <form method="post" action="{{$base}}" class="setform stack">
362┆ <input type="hidden" name="field" value="transfer">
363┆ <label for="new-owner">Transfer</label>
364┆ <p class="hint">Move it to your own account or an organization you administer. Clone URLs
change.</p>
365┆ <input type="text" id="new-owner" name="new-owner" value="{{index .Submitted "new-
owner"}}" placeholder="new owner" autocomplete="off" spellcheck="false">
366┆ <p>{{template "confirmfield" $path}} <button type="submit"
class="danger">Transfer</button></p>
367┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
365┆ <input type="text" id="new-owner" name="new-owner" value="{{index .Submitted "new-owner"}}"
placeholder="new owner" autocomplete="off" spellcheck="false">
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
368┆ <form method="post" action="{{$base}}" class="setform stack">
369┆ <input type="hidden" name="field" value="delete">
370┆ <span class="fieldname">Delete</span>
371┆ <p class="hint">Removes the repository, its issues and merge requests. Cannot be
undone.</p>
372┆ <p>{{template "confirmfield" $path}} <button type="submit" class="danger">Delete
repository</button></p>
373┆ </form>
internal/web/templates/snippet.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
17┆ <form method="post" action="/{{$.Owner}}/-/snippets/{{$.Snippet.PublicID}}/file"
class="commentform">
18┆ <input type="hidden" name="name" value="{{.Name}}">
19┆ <p><textarea name="content" aria-label="Content of {{.Name}}"
rows="12">{{.Content}}</textarea></p>
20┆ <p><button type="submit" class="btn">Save</button></p>
21┆ </form>
⋮┆----------------------------------------
22┆ <form method="post" action="/{{$.Owner}}/-/snippets/{{$.Snippet.PublicID}}/file/remove">
23┆ <input type="hidden" name="name" value="{{.Name}}">
24┆ <p>{{template "confirmfield" .Name}} <button type="submit" class="danger">Remove
{{.Name}}</button></p>
25┆ </form>
⋮┆----------------------------------------
31┆ <form method="post" action="/{{.Owner}}/-/snippets/{{.Snippet.PublicID}}/file"
class="commentform">
32┆ <p><input type="text" name="name" aria-label="File name" placeholder="filename" required
autocomplete="off" spellcheck="false"></p>
33┆ <p><textarea name="content" aria-label="Content" rows="12" required></textarea></p>
34┆ <p><button type="submit" class="btn">Add file</button></p>
35┆ </form></details>
⋮┆----------------------------------------
37┆ <form method="post" action="/{{.Owner}}/-/snippets/{{.Snippet.PublicID}}/edit">
38┆ <p><input type="text" name="description" aria-label="Description"
value="{{.Snippet.Description}}" placeholder="description"></p>
39┆ <p><select name="visibility" aria-label="Visibility">
40┆ <option value="public"{{if eq .Snippet.Visibility "public"}}
selected{{end}}>public</option>
41┆ <option value="unlisted"{{if eq .Snippet.Visibility "unlisted"}}
selected{{end}}>unlisted</option>
42┆ <option value="private"{{if eq .Snippet.Visibility "private"}}
selected{{end}}>private</option>
43┆ </select></p>
44┆ <p><button type="submit" class="btn">Save</button></p>
45┆ </form>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
40┆ <option value="public"{{if eq .Snippet.Visibility "public"}}
selected{{end}}>public</option>
⋮┆----------------------------------------
40┆ <option value="public"{{if eq .Snippet.Visibility "public"}}
selected{{end}}>public</option>
⋮┆----------------------------------------
41┆ <option value="unlisted"{{if eq .Snippet.Visibility "unlisted"}}
selected{{end}}>unlisted</option>
⋮┆----------------------------------------
41┆ <option value="unlisted"{{if eq .Snippet.Visibility "unlisted"}}
selected{{end}}>unlisted</option>
⋮┆----------------------------------------
42┆ <option value="private"{{if eq .Snippet.Visibility "private"}}
selected{{end}}>private</option>
⋮┆----------------------------------------
42┆ <option value="private"{{if eq .Snippet.Visibility "private"}}
selected{{end}}>private</option>
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
46┆ <form method="post" action="/{{.Owner}}/-/snippets/{{.Snippet.PublicID}}/delete">
47┆ <p>{{template "confirmfield" .Snippet.PublicID}} <button type="submit"
class="danger">Delete snippet</button></p>
48┆ </form>
internal/web/templates/snippetnew.html
❯❱ opt.opengrep-rules.python.django.security.django-no-csrf-token
Manually-created forms in django templates should specify a csrf_token to prevent CSRF attacks.
6┆ <form method="post" action="/{{.Owner}}/-/snippets/new" class="commentform">
7┆ <p><input type="text" name="name" aria-label="File name" placeholder="filename"
value="{{.Name}}" required autocomplete="off" spellcheck="false"></p>
8┆ <p><input type="text" name="description" aria-label="Description" placeholder="description"
value="{{.Description}}"></p>
9┆ <p><select name="visibility" aria-label="Visibility">
10┆ <option value="unlisted"{{if or (eq .Visibility "unlisted") (eq .Visibility "")}}
selected{{end}}>unlisted</option>
11┆ <option value="public"{{if eq .Visibility "public"}} selected{{end}}>public</option>
12┆ <option value="private"{{if eq .Visibility "private"}} selected{{end}}>private</option>
13┆ </select></p>
14┆ <p><textarea name="content" aria-label="Content" rows="16"
required>{{.Content}}</textarea></p>
15┆ <p><button type="submit">Create snippet</button></p>
[hid 1 additional lines, adjust with --max-lines-per-finding]
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
10┆ <option value="unlisted"{{if or (eq .Visibility "unlisted") (eq .Visibility "")}}
selected{{end}}>unlisted</option>
⋮┆----------------------------------------
10┆ <option value="unlisted"{{if or (eq .Visibility "unlisted") (eq .Visibility "")}}
selected{{end}}>unlisted</option>
⋮┆----------------------------------------
11┆ <option value="public"{{if eq .Visibility "public"}} selected{{end}}>public</option>
⋮┆----------------------------------------
11┆ <option value="public"{{if eq .Visibility "public"}} selected{{end}}>public</option>
⋮┆----------------------------------------
12┆ <option value="private"{{if eq .Visibility "private"}} selected{{end}}>private</option>
⋮┆----------------------------------------
12┆ <option value="private"{{if eq .Visibility "private"}} selected{{end}}>private</option>
internal/web/templates/symbols.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
9┆ {{range .Kinds}}<option value="{{.}}"{{if eq . $.Kind}} selected{{end}}>{{.}}</option>
⋮┆----------------------------------------
9┆ {{range .Kinds}}<option value="{{.}}"{{if eq . $.Kind}} selected{{end}}>{{.}}</option>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
29┆ {{if .Next}}<p><a href="{{.Next}}">next page</a></p>{{end}}
internal/web/templates/tree.html
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
10┆ <span class="crumbs"><a
href="/{{.Repo.OwnerName}}/{{.Repo.Name}}">{{.Repo.Name}}</a>/{{range .Crumbs}}<a
href="{{.URL}}">{{.Name}}</a>/{{end}}</span>
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
19┆ {{with .Tip}}{{if .SHA}}<tr class="tipbar"><td colspan="3"><div class="tip"><span
class="who">{{template "authorname" dict "Name" .Author "User" .User "Email"
.Email}}</span> <a class="subject"
href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/commit/{{.SHA}}">{{.Subject}}</a><span
class="spacer"></span><a class="sha"
href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/commit/{{.SHA}}"><code>{{short
.SHA}}</code></a> <span class="age"{{if not .When.IsZero}} title="{{whenT
.When}}"{{end}}>{{ago .When}}</span></div></td></tr>{{end}}{{end}}
⋮┆----------------------------------------
19┆ {{with .Tip}}{{if .SHA}}<tr class="tipbar"><td colspan="3"><div class="tip"><span
class="who">{{template "authorname" dict "Name" .Author "User" .User "Email"
.Email}}</span> <a class="subject"
href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/commit/{{.SHA}}">{{.Subject}}</a><span
class="spacer"></span><a class="sha"
href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/commit/{{.SHA}}"><code>{{short
.SHA}}</code></a> <span class="age"{{if not .When.IsZero}} title="{{whenT
.When}}"{{end}}>{{ago .When}}</span></div></td></tr>{{end}}{{end}}
⋮┆----------------------------------------
28┆ <td class="age"{{if not $c.When.IsZero}} title="{{whenT $c.When}}"{{end}}>{{ago
$c.When}}</td>
⋮┆----------------------------------------
28┆ <td class="age"{{if not $c.When.IsZero}} title="{{whenT $c.When}}"{{end}}>{{ago
$c.When}}</td>
❯❱ opt.opengrep-rules.generic.html-templates.security.var-in-href
Detected a template variable used in an anchor tag with the 'href' attribute. This allows a
malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS)
attacks. If using Flask, use 'url_for()' to safely generate a URL. If using Django, use the 'url'
filter to safely generate a URL. If using Mustache, use a URL encoding library, or prepend a slash
'/' to the variable for relative links (`href="/{{link}}"`). You may also consider setting the
Content Security Policy (CSP) header.
42┆ <a href="{{$r}}/log/{{.Ref}}"><b>{{.Facts.Commits}}</b> commit{{if ne .Facts.Commits
1}}s{{end}}</a>
internal/web/templates/wiki.html
❯❱ opt.opengrep-rules.generic.html-templates.security.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject
custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{
expr }}".
17┆ <ul>{{range .Pages}}<li><a {{if eq .Name $.Page}}class="active" {{end}}href="/{{$.Repo.Owne
rName}}/{{$.Repo.Name}}/wiki/{{.Name}}">{{.Label}}</a></li>{{end}}</ul>{{end}}
⋮┆----------------------------------------
17┆ <ul>{{range .Pages}}<li><a {{if eq .Name $.Page}}class="active" {{end}}href="/{{$.Repo.Owne
rName}}/{{$.Repo.Name}}/wiki/{{.Name}}">{{.Label}}</a></li>{{end}}</ul>{{end}}
internal/web/web.go
❯❱ opt.opengrep-rules.go.lang.security.audit.unsafe-reflect-by-name
If an attacker can supply values that the application then uses to determine which method or field
to invoke, the potential exists for the attacker to create control flow paths through the
application that were not intended by the application developers. This attack vector may allow the
attacker to bypass authentication or access control checks or otherwise cause the application to
behave in an unexpected manner.
62┆ f := rv.FieldByName(name)
⋮┆----------------------------------------
77┆ f := rv.FieldByName(name)
⋮┆----------------------------------------
161┆ f := rv.FieldByName(name)
⋮┆----------------------------------------
178┆ f := rv.FieldByName(name)
results uploaded