Comments (9)
Yep, it's totally the dots in the identifier name. I'll add those.
from stringfuzz.
Fixed in c17048e.
from stringfuzz.
The problem pasted below gives this scanning error.
scanning error:
LPAREN '('
SYMBOL 'declare-const'
WHITESPACE ' '
'|aws:SourceArn| String)\n(declare-const |aws:SourceArn_account| String)\n(declare-const |aws:SourceArn'...
(declare-const |aws:SourceArn| String)
(declare-const |aws:SourceArn_account| String)
(declare-const |aws:SourceArn_exists| Bool)
(declare-const |aws:SourceArn_partition| String)
(declare-const |aws:SourceArn_region| String)
(declare-const |aws:SourceArn_resource| String)
(declare-const |aws:SourceArn_service| String)
; Condition: p0.0.0.0
(declare-const p0.0.0.0.condition Bool)
;(assert (= p0.0.0.0.condition (and |aws:SourceArn_exists| (= "arn:aws:myService:myRegion:123456789012:myResource/part" |aws:SourceArn|))))
(assert (= p0.0.0.0.condition (and |aws:SourceArn_exists|
; SourceArn = arn : partition : service : region : account : resource
(= |aws:SourceArn_partition| "aws")
(= |aws:SourceArn_service| "myService")
(= |aws:SourceArn_region| "myRegion")
(= |aws:SourceArn_account| "123456789012")
(= |aws:SourceArn_resource| "myResource/part")
)))
; Statement: p0.0
(declare-const p0.0.statement.allows Bool)
(assert (= p0.0.statement.allows p0.0.0.0.condition))
; Policy: 0
(declare-const p0.allows Bool)
(declare-const p0.denies Bool)
(declare-const p0.neutral Bool)
(assert (= p0.allows p0.0.statement.allows))
(assert (not p0.denies))
(assert (= p0.neutral (not p0.0.statement.allows)))
; Condition: p1.0.0.0
(declare-const p1.0.0.0.condition Bool)
(assert (= p1.0.0.0.condition (and |aws:SourceArn_exists| (and
(= "aws" |aws:SourceArn_partition|)
(str.prefixof "my" |aws:SourceArn_service|)
;(str.in.re |aws:SourceArn_service| (re.++ (str.to.re "my") re.all))
(and
(str.prefixof "myR" |aws:SourceArn_region|)
;(str.in.re |aws:SourceArn_region| (re.++ (str.to.re "myR") re.all))
(str.suffixof "on" |aws:SourceArn_region|)
;(str.in.re |aws:SourceArn_region| (re.++ re.all (str.to.re "on")))
)
(str.suffixof "012" |aws:SourceArn_account|)
;(str.in.re |aws:SourceArn_account| (re.++ re.all (str.to.re "012")))
))))
; Statement: p1.0
(declare-const p1.0.statement.allows Bool)
(assert (= p1.0.statement.allows p1.0.0.0.condition))
; Policy: 1
(declare-const p1.allows Bool)
(declare-const p1.denies Bool)
(declare-const p1.neutral Bool)
(assert (= p1.allows p1.0.statement.allows))
(assert (not p1.denies))
(assert (= p1.neutral (not p1.0.statement.allows)))
; aws:SourceArn invariants
;(assert (= |aws:SourceArn| (str.++ (str.++ (str.++ (str.++ (str.++ (str.++ (str.++ (str.++ (str.++ "arn:" |aws:SourceArn_partition|) ":") |aws:SourceArn_service|) ":") |aws:SourceArn_region|) ":") |aws:SourceArn_account|) ":") |aws:SourceArn_resource|)))
; Goals
(assert (or p0.neutral p0.denies))
(assert p1.allows)
(check-sat)
(get-model)
from stringfuzz.
@FedericoAureliano fixed in 5b1b855.
from stringfuzz.
Hey @dblotsky. Came across a few more while processing Murphy's examples.
- expected an argument, got RPAREN ')'
(declare-const S String)
; S not in aaabbb*
(assert (not (str.in.re S (re.++ (str.to.re "aaabbb") re.all ))))
; S in aaa*bbb*
(assert (str.in.re S (re.++ (re.++ (re.++
(str.to.re "aaa") re.all ))
(str.to.re "bbb") re.all )))
(check-sat) ; should be SAT
(get-model)
(get-info :reason-unknown)
- expected RPAREN, got IDENTIFIER 'Domainname'
(set-logic QF_S)
(set-info :status sat)
(declare-const Username String)
(declare-const Domainname String)
(declare-const Email String)
; username at most 64 chars and can't be empty
(assert (<= (str.len Username) 64))
(assert (> (str.len Username) 0))
; domain at most 256 chars and can't be empty
(assert (<= (str.len Domainname) 256))
(assert (> (str.len Domainname) 0))
; Email = Username ++ "@" ++ Domainname
(assert (= Email (str.++ Username "@" Domainname)))
; Email is matched by the following (very simplistic) pattern:
; (non-empty alphanumeric string) @ (one or more alphanumeric strings separated by periods)
(assert (str.in.re Email (re.++
;; Username part
(re.+ (re.union (re.range "a" "z") (re.range "A" "Z") (re.range "0" "9")))
(str.to.re "@")
;; Domainname part
(re.++
(re.+ (re.++ (re.+ (re.union (re.range "a" "z") (re.range "A" "Z") (re.range "0" "9"))) (str.to.re ".")))
(re.+ (re.union (re.range "a" "z") (re.range "A" "Z") (re.range "0" "9")))))))
; Domainname is not a FQDN (does not contain '.')
(assert (not (str.in.re Domainname (re.++ (re.* re.all) (str.to.re ".") (re.* re.all)))))
(check-sat)
- expected SYMBOL, got LPAREN '('
(set-logic QF_S)
(set-info :status sat)
(declare-const key String)
(declare-const val String)
(define-fun QuoteRegex ((aRegex (RegEx String) )) ( RegEx String)
(re.++ (re.++ (str.to.re """") aRegex) (str.to.re """")))
(assert (str.in.re key (QuoteRegex (re.* (str.to.re "a")))))
(assert (= (str.len key) 2))
(check-sat)
(get-model)
from stringfuzz.
@FedericoAureliano there are valid syntax errors in all 3 examples.
- Line 6 has incorrectly balanced parentheses. The "bbb" regex should be inside the second regex concat.
- Line 16 has a n-ary concat, which we do not support.
- Line 7 has a nested type, which (as far as I am aware) we do not support. Could be wrong on this one.
I did add better error-reporting in 8734862 though, which would help diagnose these in the future.
Please let me know how you'd like us to proceed with regard to point number 3.
from stringfuzz.
Can we support n-ary concat as nested binary concats? I think this is what z3 will do, no?
The error reporting looks great!
from stringfuzz.
New one. The unary minus sign is the culprit here.
Parsing error on line 7:
... (set-info :status unsat)
(declare-const x String)
(declare-const y String)
(assert (str.in.re x (re.+ (str.to.re "ab$!Pd"))))
(assert (str.in.re y (re.* (str.to.re "aAh'{:"))))
(assert (= (str.len x) -
-----------------------^
expected RPAREN, got SYMBOL '-'
(set-logic QF_S)
(set-info :status unsat)
(declare-const x String)
(declare-const y String)
(assert (str.in.re x (re.+ (str.to.re "ab$!Pd"))))
(assert (str.in.re y (re.* (str.to.re "aAh'{:"))))
(assert (= (str.len x) -2))
(check-sat)
(get-model)
from stringfuzz.
@FedericoAureliano does SMT-LIB support negated literals like that? I actually don't know.
Not sure how to deal with the n-ary concats issue. Z3str3 actually does parse them fine. Let's discuss this in the meeting tomorrow.
from stringfuzz.
Related Issues (20)
- stringfuzzx translate should not modify re.range arguments HOT 4
- stringfuzz should generate negative literals using unary negation
- stringfuzzx strips out satisfiability info HOT 2
- stringfuzzg should always specify the logic
- stringfuzzg should specify satisfiability status, if known
- stringfuzzg random-ast works
- bin/stringmerge works
- stringfuzz can parse n-ary concats
- stringfuzz should be able to parse sorts properly
- stringfuzzx graft shouldn't swap with str.to.re args
- stringfuzzg regex: NameError: name 'ReConcatNode' is not defined HOT 1
- semantics change: re.all / re.allchar
- stringfuzzg should support norn as a new language
- Issue with double-quote character
- There should be an Add/Remove transformer
- Banditfuzz Branch Crashs. Three different inputs/error logs HOT 8
- Bandit Issue #1
- Bandit Issue #2
- Bandit Issue #3 HOT 1
- ./bin/stringfuzzg not work without installing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stringfuzz.