Skip to content

Commit

Permalink
add aptos_labs.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
GotenJBZ authored and semgrep-bot committed Jan 24, 2025
1 parent f82ac94 commit 34606b6
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions aptos_labs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
rules:
- id: public-randomness
languages:
- move_on_aptos
message: If a public function directly or indirectly invokes the randomness API,
a malicious user can abuse the composability of this function and abort the transaction
if the result is not as desired. This allows the user to keep trying until they
achieve a beneficial outcome, undermining the randomness.
severity: INFO
metadata:
likelihood: LOW
impact: HIGH
confidence: LOW
category: security
references:
- https://aptos.dev/en/build/smart-contracts/move-security-guidelines#randomness---test-and-abort
license: Copyright 2024 Aptos Labs
rule-origin-note: published from rules/move_on_aptos/randomness/security/public-randomness.yaml
in https://github.com/aptos-labs/semgrep-move-rules.git
patterns:
- pattern-either:
- pattern: |
#[lint::allow_unsafe_randomness]
fun $FUN (...) : ...
- pattern: |
#[randomness]
fun $FUN (...) : ...
- pattern-either:
- pattern: |
public fun $FUN (...) : ...
- pattern: |
public entry fun $FUN (...) : ...
- pattern-not-inside: |
fun $ENTRYPOINT(...): ... {
abort $_
}
- pattern-not: |
#[test]
fun $FUN(...) : ...
- pattern-not: |
#[test(...)]
fun $FUN(...) : ...
- pattern-not: |
#[test_only]
fun $FUN(...) : ...
- pattern-not-inside: |
#[test_only]
module $ADDR::$MODULE { ... }

0 comments on commit 34606b6

Please sign in to comment.