const DepVerified, DepAtRisk, DepUnverified
Dependency statuses.
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package bouncer is Bouncer's on-chain registry: scan requests, attestations, disputes and author replies, plus the re...
Package bouncer is Bouncer's on-chain registry: scan requests, attestations, disputes and author replies, plus the reads other realms use (Check, Score) and the Tavern pages in Render.
One realm holds all state and every write, and every logic-data type is declared here (security guide §3A). Writes are crossing functions that check cur.IsCurrent() and take the caller from cur.Previous(). Reads are plain functions that return values or copies, never pointers into state, and never take callbacks.
Dependency statuses.
Labels, exactly as the prover writes them.
Severities.
Verdicts.
1const Disclaimer = "A high score means Bouncer found no issues with its current rules. It is not a guarantee of safety."Disclaimer is shown on every Passport.
APIVersion is the registry's interface version, so the bot can tell what Attest takes. 2: Attest takes the dependency list (deps.gno); LatestHashes includes the scanner version.
AddAttester allows addr to post attestations.
1func AddDetail(cur realm, pkgpath string, id uint64, index int, snippet, attack, exploit, before, after string)AddDetail attaches the vulnerable snippet and, for a PROVEN finding, the exploit and its evidence to finding index of attestation id. Only the attester who posted the attestation may call it, once per finding: the details are as permanent as the attestation itself.
1func Attest(cur realm, pkgpath, sourceHash, scannerVersion, rulesetHash, toolchain, reportHash, reportURI, findings, deps string) uint64Attest records a scan result for pkgpath. Attesters only. findings is a ";"-separated list of "RULE,severity,LABEL,file,line[,func]" entries ("" for none), in the report's order. deps is the import tree (see parseDeps). Score, grade and verdict are computed here from the findings and the dependencies' statuses in this registry.
Badge returns a Markdown image of pkgpath's live Bouncer badge (grade, score and attestation date), linked to its Passport. A realm shows it by adding one line to its Render:
1out += bouncer.Badge("gno.land/r/<address>/myrealm")
The color follows the verdict, not the grade: a package with a PROVEN High finding is red even at grade B.
ByAuthor returns the attested packages in addr's namespace, sorted.
CancelRequest withdraws the caller's open request.
Check reports whether the latest attestation of pkgpath satisfies p. An unattested package never passes.
CloseRequest lets an attester close a request it cannot serve, such as a package that does not exist.
DepStatus returns the trust status of pkgpath as a dependency.
Dispute files a challenge against the latest attestation of pkgpath, backed by a report with a different hash. One open dispute per filer per package.
IsAttester reports whether addr may post attestations.
LatestHashes returns "<source hash> <rule-set hash> <scanner version>" of pkgpath's latest attestation, or "" if there is none, so the bot can skip code it already scanned with the same rules and prover.
OpenRequestsText is OpenRequests for the scanner bot, as plain text: one "id pkgpath" line per open request, oldest first. Package paths never contain spaces or newlines.
RemoveAttester revokes addr. Its past attestations stay on record.
Reply lets the author of an address-namespace package answer its Passport and, optionally, name the fixed version (successor) in the same namespace.
RequestScan asks the scanner bot to scan pkgpath. Each address may have one open request at a time.
ResolveDispute closes a dispute with a resolution note. Admin or an attester.
Score returns the latest score for pkgpath.
ScoreFor exposes the formula, so anyone can check an attestation or score a report before attesting it.
TransferAdmin hands the admin role to next.
Versions returns every attested version of pkgpath's package, oldest first. A path without a /vN suffix is its own only version.
History returns every attestation for pkgpath, oldest first, with scores that use the current dependency statuses (like Latest).
Latest returns the newest attestation for pkgpath.
Replies returns the author's replies on pkgpath, oldest first.
DisputesFor returns copies of every dispute on pkgpath, oldest first.
RuleGuidance returns the guidance for rule, and false for a rule this realm has no guidance for yet.
Custom starts a policy at minScore that is otherwise as strict as the zero value; loosen it with the With methods:
1bouncer.Custom(60).WithProvenMedium().WithOpenDisputes()
Other realms must build policies this way: the VM refuses to allocate a Bouncer type in a foreign realm, so a bouncer.Policy{...} literal written in another realm panics.
Standard: score 75 or more and no PROVEN Critical or High finding. Open disputes are tolerated.
Strict: score 90 or more, no PROVEN findings, every dependency verified, no open disputes.
GetRequest returns a copy of request id.
OpenRequests returns up to limit open requests, oldest first, for the scanner bot.
1type Attestation struct {
2 ID uint64
3 PkgPath string
4 SourceHash string // sha256 of the scanned source, hex
5 ScannerVersion string
6 RulesetHash string // hex
7 Toolchain string // gno version the exploits ran on
8 ReportHash string // sha256 of the full JSON report, hex
9 ReportURI string // where the full report lives (ipfs:// or https://)
10 Findings []Finding
11 Deps Deps
12 Score int
13 Grade string
14 Verdict string
15 Attester address
16 Height int64
17 Time int64 // unix seconds, block time
18}Attestation is a scan result posted by an attester.
AuthorReply is an author's response to a Passport.
Dep is one dependency of an attested package. Status is filled in when the attestation is read.
Deps is an attestation's dependency trust: the list as attested, and the counts that the score uses. Counts and statuses are computed when the attestation is read (see live).
DisputeRecord is a challenge to an attestation, backed by a different report.
1type Finding struct {
2 Rule string // B01 ...
3 Severity string // critical, high, medium
4 Label string // PROVEN, NOT REPRODUCED, STATIC WARNING
5 File string
6 Line int
7 Func string // enclosing function, if known
8
9 Detailed bool // AddDetail has run for this finding
10 Snippet string // the vulnerable code
11 Attack string // what the exploit did, one line (PROVEN only)
12 Exploit string // the attacker source that ran (PROVEN only)
13 Before string // evidence before the attack (PROVEN only)
14 After string // evidence after the attack (PROVEN only)
15}Finding is one attested finding. The detail fields (Snippet onward) are filled once, after Attest, by AddDetail.
1type Guidance struct {
2 Title string // short name of the bug class
3 Guide string // security guide sections
4 Meaning string // what the finding means
5 Danger string // why it is dangerous
6 Fix string // what to change
7 Example string // the fixed code, Gno
8 Why string // why the fix works
9}Guidance is the fix guidance for one rule. It is written once per rule, so every Passport says the same thing and it costs nothing per finding.
Policy is an integration policy for Check. No policy accepts a red verdict: a PROVEN Critical or High finding fails every policy, and there is no option to allow it. The zero value is the most conservative: no PROVEN findings at all, no open disputes, any score.
WithOpenDisputes allows open disputes.
WithProvenMedium allows PROVEN medium findings.
WithVerifiedDeps requires every dependency to be verified.
Request is a scan request, as returned by reads.