# The hash functions with md5, sha1, ripemd (128-bit), and sha should be highlighted,# as they are cryptographically weak and can be easily broken.defmoduleInsecureHashExampledo# Insecure hash function using MD5defpinsecure_hash_one(data)do# check this:cr.hash(data,:md5)|>Base.encode16(case::lower)end# Insecure hash function using sha1defpinsecure_hash_one(data)do# validate spacing :crypto.hash(data,:sha1)|>Base.encode16(case::lower)end# Spacing does not matter:crypto.hash(:md5,data)hex=Base.encode16(:crypto.hash(:ripemd160,data))
Compliant Code Examples
# The hash functions other than md5, sha1, ripemd (128-bit), and sha are not highlighted# as they are cryptographically strong and cannot be broken via standard hardware.defmodulePasswordComparedodefoption_one(password,md5_hash)docase:crypto.hash(:sha2,password)==md5_hashdotrue->:entry_granted_op1false->:entry_denied_op1endendenda=:crypto.hash(:sha3,something)
원활한 통합. Datadog Code Security를 경험해 보세요
Datadog Code Security
이 규칙을 사용해 Datadog Code Security로 코드를 분석하세요
규칙 사용 방법
1
2
rulesets:- elixir-security # Rules to enforce Elixir security.
리포지토리 루트에 위의 내용을 포함하는 static-analysis.datadog.yml을 만듭니다
무료 IDE 플러그인을 사용하거나 CI 파이프라인에 Code Security 검사를 추가합니다