Build 10 success

gitbay-security on main · 28e4197b1e · queued 2026-11-22 04:00 UTC · finished 2026-11-22 04:41 UTC · ran 1m32s

setup
$ git clone ssh://git@127.0.0.1/krz/micro-roguelike.git (28e4197b1e)
step 1/2 mkdir -p "$GITBAY_RESULTS"

step 2/2 opengrep scan --quiet --disable-version-check --config /opt/opengrep-rules --sarif-output="$GITBAY_RESULTS/opengrep.sarif" .
                    
                    
┌──────────────────┐
│ 26 Code Findings │
└──────────────────┘
                  
    1mb/sprites.js
    ❯❱ opt.opengrep-rules.javascript.lang.security.html-in-template-string
          This template literal looks like HTML and has interpolated variables. These variables are not HTML-
          encoded by default. If the variables contain HTML tags, these may be interpreted by the browser,   
          resulting in cross-site scripting (XSS).                                                           
                                                                                                             
           27┆ const FLAME=(x,y,s)=>`<circle cx=${x} cy=${y} r=${7*s} fill=url(#gGlow) /><path       
               transform="translate(${x} ${y}) scale(${s})" d="M0-6C3-3 4 0 3 2.5 2 4.5-2 4.5-3 2.5-4
               0-2-2 0-6Z" fill=url(#gFl) /><path transform="translate(${x} ${y+1}) scale(${s})"     
               d="M0-2.5C1.3-1 1.6.6 1 1.6.4 2.4-.4 2.4-1 1.6-1.6.6-1.2-1 0-2.5Z" fill=#fffbe6 />`   
            ⋮┆----------------------------------------
           28┆ const STONES=(rs)=>rs.map(([x,y,w,h])=>`<rect x=${x} y=${y} width=${w} height=${h} rx=1.5
               fill=url(#gF) stroke=#0004 stroke-width=.5 /><path d="M${x+1.5} ${y+.8}H${x+w-1.5}"      
               stroke=#ffffff14 stroke-width=.7 />`).join("")                                           
            ⋮┆----------------------------------------
           30┆ const BRICKS=(y0,rows,grad)=>{let s="";for(let r=0;r<rows;r++){const                      
               y=y0+r*8,o=r%2?-6:0;for(let x=o;x<32;x+=12)s+=`<rect x=${x+.5} y=${y+.5} width=11 height=7
               rx=1 fill=url(#${grad}) stroke=#0007 stroke-width=.6 /><path d="M${x+1.5}                 
               ${y+1.3}H${x+10.5}" stroke=#fff3 stroke-width=.7 />`}return s}                            
            ⋮┆----------------------------------------
           48┆ g:`<ellipse cx=16 cy=27 rx=10 ry=2.2 fill=#000 opacity=.45 /><ellipse cx=10 cy=24 rx=5 ry=2
               fill=#7d4f12 /><ellipse cx=10 cy=23 rx=5 ry=2 fill=url(#gG) stroke=#5a360b stroke-width=.5 
               /><ellipse cx=21 cy=24.5 rx=5 ry=2 fill=#7d4f12 /><ellipse cx=21 cy=23.5 rx=5 ry=2         
               fill=url(#gG) stroke=#5a360b stroke-width=.5 />`+[20,17,14,11].map(y=>`<ellipse cx=15.5    
               cy=${y+1} rx=5 ry=2 fill=#7d4f12 /><ellipse cx=15.5 cy=${y} rx=5 ry=2 fill=url(#gG)        
               stroke=#5a360b stroke-width=.5 />`).join("")+`<ellipse cx=15.5 cy=11 rx=2.8 ry=.9 fill=none
               stroke=#fff7 stroke-width=.5 /><path d="M25 8l.5 1.3 1.3.5-1.3.5-.5 1.3-.5-1.3-1.3-.5      
               1.3-.5Z" fill=#fff />`,                                                                    
            ⋮┆----------------------------------------
           53┆ C:`<circle cx=16 cy=16 r=12 fill=url(#gGlow) opacity=.6 />${SHADOW}<path d="M6 24L5 10 11  
               15.5 16 7 21 15.5 27 10 26 24Z" fill=url(#gG) stroke=#5a360b stroke-width=.8 stroke-       
               linejoin=round /><rect x=6 y=22 width=20 height=4 rx=1 fill=url(#gG) stroke=#5a360b stroke-
               width=.7 /><circle cx=5 cy=9.5 r=1.3 fill=#fff1b8 /><circle cx=16 cy=6.5 r=1.5 fill=#fff1b8
               /><circle cx=27 cy=9.5 r=1.3 fill=#fff1b8 /><circle cx=11 cy=24 r=1.2 fill=#2e6bd6         
               /><circle cx=16 cy=24 r=1.4 fill=#c4122a /><circle cx=21 cy=24 r=1.2 fill=#1e9e5a /><path  
               d="M8 13L8.6 20" stroke=#fff8 stroke-width=.8 />`,                                         
            ⋮┆----------------------------------------
           62┆ document.getElementById("s").insertAdjacentHTML("afterbegin",`<svg width=0 height=0   
               style=position:absolute aria-                                                         
               hidden=true><defs>${GFX_DEFS}${Object.entries(SPRITES).map(([k,v])=>`<symbol id=s-${k}
               viewBox="0 0 32 32">${v}</symbol>`).join("")}</defs></svg>`)                          
            ⋮┆----------------------------------------
           62┆ document.getElementById("s").insertAdjacentHTML("afterbegin",`<svg width=0 height=0   
               style=position:absolute aria-                                                         
               hidden=true><defs>${GFX_DEFS}${Object.entries(SPRITES).map(([k,v])=>`<symbol id=s-${k}
               viewBox="0 0 32 32">${v}</symbol>`).join("")}</defs></svg>`)                          
            ⋮┆----------------------------------------
           64┆ function gfxIcon(k){return k=="dark"?"":`<svg viewBox="0 0 32 32"><use
               href="#s-${k=="effigy"?"r":k=="O"?"o":k}"/></svg>`}                   
            ⋮┆----------------------------------------
           68┆ const use=id=>`<svg viewBox="0 0 32 32"><use href="#s-${id}"/></svg>`
            ⋮┆----------------------------------------
           73┆ if(k!="i"&&R[S.r]&&k in R[S.r].ex)return                                        
               fl+use(R[S.r].ex[k].replace("!","")[0]=="d"?"Dd":"D")+`<b class=dl>${glyph}</b>`
            ⋮┆----------------------------------------
           74┆ return fl+(GFX_ON_FLOOR.includes(k)?use(k):`<b>${glyph}</b>`)
                       
    tools/check-size.sh
    ❯❱ opt.opengrep-rules.bash.lang.security.ifs-tampering
          The special variable IFS affects how splitting takes place when expanding unquoted variables. Don't
          set it globally. Prefer a dedicated utility such as 'cut' or 'awk' if you need to split input data.
          If you must use 'read', set IFS locally using e.g. 'IFS="," read -a my_array'.                     
                                                                                                             
           21┆ IFS='
           22┆ '
            ⋮┆----------------------------------------
           29┆ IFS=$oldifs
                   
    tools/engine.js
    ❯❱ opt.opengrep-rules.javascript.lang.security.audit.detect-non-literal-fs-filename
          Detected that function argument `gameDir` has entered the fs module. An attacker could potentially
          control the location of this file, to include going backwards in the directory with '../'. To     
          address this, ensure that user-controlled variables in file paths are validated.                  
                                                                                                            
           10┆ const html = fs.readFileSync(path.join(gameDir, "index.html"), "utf8")
   
    ❯❱ opt.opengrep-rules.javascript.lang.security.audit.path-traversal.path-join-resolve-traversal
          Detected possible user input going into a `path.join` or `path.resolve` function. This could   
          possibly lead to a path traversal vulnerability,  where the attacker can access arbitrary files
          stored in the file system. Instead, be sure to sanitize or validate user input first.          
                                                                                                         
           10┆ const html = fs.readFileSync(path.join(gameDir, "index.html"), "utf8")
   
    ❯❱ opt.opengrep-rules.javascript.lang.security.audit.detect-non-literal-fs-filename
          Detected that function argument `gameDir` has entered the fs module. An attacker could potentially
          control the location of this file, to include going backwards in the directory with '../'. To     
          address this, ensure that user-controlled variables in file paths are validated.                  
                                                                                                            
           11┆ const dataSrc = fs.readFileSync(path.join(gameDir, "data.js"), "utf8")
   
    ❯❱ opt.opengrep-rules.javascript.lang.security.audit.path-traversal.path-join-resolve-traversal
          Detected possible user input going into a `path.join` or `path.resolve` function. This could   
          possibly lead to a path traversal vulnerability,  where the attacker can access arbitrary files
          stored in the file system. Instead, be sure to sanitize or validate user input first.          
                                                                                                         
           11┆ const dataSrc = fs.readFileSync(path.join(gameDir, "data.js"), "utf8")
   
    ❯❱ opt.opengrep-rules.javascript.lang.security.audit.detect-non-literal-fs-filename
          Detected that function argument `gameDir` has entered the fs module. An attacker could potentially
          control the location of this file, to include going backwards in the directory with '../'. To     
          address this, ensure that user-controlled variables in file paths are validated.                  
                                                                                                            
           12┆ const spriteSrc = fs.readFileSync(path.join(gameDir, "sprites.js"), "utf8")
   
    ❯❱ opt.opengrep-rules.javascript.lang.security.audit.path-traversal.path-join-resolve-traversal
          Detected possible user input going into a `path.join` or `path.resolve` function. This could   
          possibly lead to a path traversal vulnerability,  where the attacker can access arbitrary files
          stored in the file system. Instead, be sure to sanitize or validate user input first.          
                                                                                                         
           12┆ const spriteSrc = fs.readFileSync(path.join(gameDir, "sprites.js"), "utf8")
                        
    tools/playthrough.js
     ❱ opt.opengrep-rules.javascript.lang.correctness.missing-template-string-indicator
          This looks like a JavaScript template string. Are you missing a '$' in front of '{...}'?
                                                                                                  
           24┆ vm.runInContext(`
           25┆ const BOT_ACTS={U:()=>step(0,-1),D:()=>step(0,1),L:()=>step(-
               1,0),R:()=>step(1,0),".":()=>wait(),t:()=>dropTorch()}       
           26┆ const BOT_KEYS={U:"ArrowUp",D:"ArrowDown",L:"ArrowLeft",R:"ArrowRight",".":".",t:"t"}
           27┆ const LEG_LIMIT=2000000
           28┆ let botBudget=0,botDeep=[0,0]
           29┆ const GOAL_NAMES=["torch","bow","crown and key into the den","leave"]
           30┆ function botBits(){let b="";for(const k in O)for(const o of O[k])b+=o.on?1:0;return b}
           31┆ // Position, flags, overlays, and the turn parity and beast only where they act; torch,
               ward, dread and chase are compared by dominance.                                       
           32┆ function botKey(){const f=S.flags,d=S.drop;return [S.r,S.x,S.y,dark()&&!f.torch?S.turn&3:""
               ,S.gameState,S.level,!!f.torch,f.ash,f.idol,f.gold,f.crown,f.key,f.mask,f.relic,f.relicPlus
               ,S.r=="e"?S.beast.x+","+S.beast.y:"",d?[d.r,d.x,d.y,d.fuel].join():"",botBits()].join("|")}
           33┆ function botRes(){return [S.flags.torch,S.flags.ward,-S.dread,-S.chase]}
             [hid 102 additional lines, adjust with --max-lines-per-finding] 
           24┆ vm.runInContext(`
           25┆ const BOT_ACTS={U:()=>step(0,-1),D:()=>step(0,1),L:()=>step(-
               1,0),R:()=>step(1,0),".":()=>wait(),t:()=>dropTorch()}       
           26┆ const BOT_KEYS={U:"ArrowUp",D:"ArrowDown",L:"ArrowLeft",R:"ArrowRight",".":".",t:"t"}
           27┆ const LEG_LIMIT=2000000
           28┆ let botBudget=0,botDeep=[0,0]
           29┆ const GOAL_NAMES=["torch","bow","crown and key into the den","leave"]
           30┆ function botBits(){let b="";for(const k in O)for(const o of O[k])b+=o.on?1:0;return b}
           31┆ // Position, flags, overlays, and the turn parity and beast only where they act; torch,
               ward, dread and chase are compared by dominance.                                       
           32┆ function botKey(){const f=S.flags,d=S.drop;return [S.r,S.x,S.y,dark()&&!f.torch?S.turn&3:""
               ,S.gameState,S.level,!!f.torch,f.ash,f.idol,f.gold,f.crown,f.key,f.mask,f.relic,f.relicPlus
               ,S.r=="e"?S.beast.x+","+S.beast.y:"",d?[d.r,d.x,d.y,d.fuel].join():"",botBits()].join("|")}
           33┆ function botRes(){return [S.flags.torch,S.flags.ward,-S.dread,-S.chase]}
             [hid 101 additional lines, adjust with --max-lines-per-finding] 
                     
    tools/validate.js
     ❱ opt.opengrep-rules.javascript.lang.correctness.missing-template-string-indicator
          This looks like a JavaScript template string. Are you missing a '$' in front of '{...}'?
                                                                                                  
           21┆ const driver = vm.runInContext(`(function (seeds) {
           22┆   const fails = []
           23┆   for (const s0 of seeds) {
           24┆     for (const level of [1, 2, 3, 4, 5, 6, 7]) {
           25┆       S = { level, mods: pickMods(s0) }
           26┆       if (!floorSolve(s0, level)) {
           27┆         S = { level, mods: pickMods(s0) }
           28┆         build(s0)
           29┆         fails.push({ seed: s0, level, escape: V.escape, beast: V.beast, hall: V.hall, pit:
               V.pit, crack: V.crack, idol: V.idol })                                                    
           30┆       }
             [hid 4 additional lines, adjust with --max-lines-per-finding] 
           21┆ const driver = vm.runInContext(`(function (seeds) {
           22┆   const fails = []
           23┆   for (const s0 of seeds) {
           24┆     for (const level of [1, 2, 3, 4, 5, 6, 7]) {
           25┆       S = { level, mods: pickMods(s0) }
           26┆       if (!floorSolve(s0, level)) {
           27┆         S = { level, mods: pickMods(s0) }
           28┆         build(s0)
           29┆         fails.push({ seed: s0, level, escape: V.escape, beast: V.beast, hall: V.hall, pit:
               V.pit, crack: V.crack, idol: V.idol })                                                    
           30┆       }
             [hid 4 additional lines, adjust with --max-lines-per-finding] 
           60┆ const missing = JSON.parse(vm.runInContext(`JSON.stringify((() => {
           61┆   const miss = {}
           62┆   for (const s0 of ${seedsJson}) {
           63┆     for (const level of [1, 2, 3, 4, 5, 6, 7]) {
           64┆       S = { level, mods: pickMods(s0), flags: {}, drop: null, seen: {} }
           65┆       build(s0)
           66┆       for (const r in R) {
           67┆         if (r[0] == "d") continue
           68┆         for (const ch in R[r].ex) if (!ROOM_NAMES[R[r].ex[ch].replace("!", "")[0]])
               miss["exit " + r + ":" + ch] = level                                               
           69┆         for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
             [hid 9 additional lines, adjust with --max-lines-per-finding] 
           60┆ const missing = JSON.parse(vm.runInContext(`JSON.stringify((() => {
           61┆   const miss = {}
           62┆   for (const s0 of ${seedsJson}) {
            ⋮┆----------------------------------------
           62┆ for (const s0 of ${seedsJson}) {
           63┆   for (const level of [1, 2, 3, 4, 5, 6, 7]) {
           64┆     S = { level, mods: pickMods(s0), flags: {}, drop: null, seen: {} }
           65┆     build(s0)
           66┆     for (const r in R) {
           67┆       if (r[0] == "d") continue
           68┆       for (const ch in R[r].ex) if (!ROOM_NAMES[R[r].ex[ch].replace("!", "")[0]])
               miss["exit " + r + ":" + ch] = level                                             
           69┆       for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
           70┆         const t = tile(x, y, r)
           71┆         if (t != "." && t != "#" && t != ">" && !(t in R[r].ex) && !LEGEND[t]) miss["tile "
               + t] = level                                                                               
             [hid 7 additional lines, adjust with --max-lines-per-finding] 

results uploaded