optimism icon indicating copy to clipboard operation
optimism copied to clipboard

cannon: use constant instead of magic value for solidity part

Open Inphi opened this issue 1 year ago • 3 comments

ref: https://github.com/ethereum-optimism/optimism/pull/12484 This is a follow-up PR for https://github.com/ethereum-optimism/optimism/pull/12386 one, which does the same to the solidity part.

Inphi avatar Oct 16 '24 15:10 Inphi

Semgrep found 3 golang_fmt_errorf_no_params findings:

No fmt.Errorf invocations without fmt arguments allowed

Ignore this finding from golang_fmt_errorf_no_params.

semgrep-app[bot] avatar Oct 17 '24 01:10 semgrep-app[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 64.86%. Comparing base (1e59d08) to head (a84a2e4). Report is 62 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12486      +/-   ##
===========================================
- Coverage    65.04%   64.86%   -0.18%     
===========================================
  Files           54       54              
  Lines         4460     4460              
===========================================
- Hits          2901     2893       -8     
- Misses        1382     1391       +9     
+ Partials       177      176       -1     
Flag Coverage Δ
cannon-go-tests 64.86% <ø> (-0.18%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes

codecov[bot] avatar Oct 17 '24 02:10 codecov[bot]

Semgrep found 1 golang_fmt_errorf_no_params finding:

  • op-supervisor/supervisor/backend/db/db_test.go

No fmt.Errorf invocations without fmt arguments allowed

Ignore this finding from golang_fmt_errorf_no_params.

Semgrep found 6 sol-style-input-arg-fmt findings:

Inputs to functions must be prepended with an underscore (_)

Ignore this finding from sol-style-input-arg-fmt.

Semgrep found 1 math-random-used finding:

  • op-supervisor/supervisor/backend/source/head_monitor_test.go

Do not use math/rand. Use crypto/rand instead.

Ignore this finding from math-random-used.

Semgrep found 1 marshal-json-pointer-receiver finding:

  • op-supervisor/supervisor/backend/db/heads/types.go

MarshalJSON with a pointer receiver has surprising results: https://github.com/golang/go/issues/22967

Ignore this finding from marshal-json-pointer-receiver.

Semgrep found 1 err-nil-check finding:

superfluous nil err check before return

Ignore this finding from err-nil-check.

semgrep-app[bot] avatar Oct 17 '24 17:10 semgrep-app[bot]

Semgrep found 1 sol-style-require-reason finding:

  • packages/contracts-bedrock/src/L2/SuperchainWETH.sol

require() must include a reason string

Ignore this finding from sol-style-require-reason.

Semgrep found 5 sol-style-input-arg-fmt findings:

Inputs to functions must be prepended with an underscore (_)

Ignore this finding from sol-style-input-arg-fmt.

semgrep-app[bot] avatar Oct 22 '24 19:10 semgrep-app[bot]

Semgrep found 1 no-direct-write-to-responsewriter finding:

  • op-challenger/game/fault/trace/prestates/multi_test.go

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()'.

Ignore this finding from no-direct-write-to-responsewriter.

Semgrep found 1 no-direct-write-to-responsewriter-taint finding:

  • op-challenger/game/fault/trace/prestates/multi_test.go

Untrusted input could be used to tamper with a web page rendering, which can lead to a Cross-site scripting (XSS) vulnerability. XSS vulnerabilities occur when untrusted input executes malicious JavaScript code, leading to issues such as account compromise and sensitive information leakage. To prevent this vulnerability, validate the user input, perform contextual output encoding or sanitize the input. For more information, see: Go XSS prevention.

View Dataflow Graph
flowchart LR
    classDef invis fill:white, stroke: none
    classDef default fill:#e7f5ff, color:#1c7fd6, stroke: none

    subgraph File0["<b>op-challenger/game/fault/trace/prestates/multi_test.go</b>"]
        direction LR
        %% Source

        subgraph Source
            direction LR

            v0["<a href=https://github.com/ethereum-optimism/optimism/blob/2ab49867cbd71c2eee68fd81d7070a1930a1a97f/op-challenger/game/fault/trace/prestates/multi_test.go#L194 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 194] r.URL</a>"]
        end
        %% Intermediate

        %% Sink

        subgraph Sink
            direction LR

            v1["<a href=https://github.com/ethereum-optimism/optimism/blob/2ab49867cbd71c2eee68fd81d7070a1930a1a97f/op-challenger/game/fault/trace/prestates/multi_test.go#L194 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 194] w.Write([]byte(r.URL.Path))</a>"]
        end
    end
    %% Class Assignment
    Source:::invis
    Sink:::invis

    File0:::invis

    %% Connections

    Source --> Sink

Ignore this finding from no-direct-write-to-responsewriter-taint.

semgrep-app[bot] avatar Oct 23 '24 17:10 semgrep-app[bot]