Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpclient import causes compiler error with taint mode #12789

Closed
MatthewScholefield opened this issue Dec 2, 2019 · 2 comments
Closed

httpclient import causes compiler error with taint mode #12789

MatthewScholefield opened this issue Dec 2, 2019 · 2 comments

Comments

@MatthewScholefield
Copy link

When importing httpclient when taint mode is enabled, compilation fails

Example

echo "import httpclient" > foo.nim
nim c --taintMode:on foo.nim

Current Output

nim-1.0.2/lib/pure/httpclient.nim(357, 6) Error: type mismatch: got <MultipartData, string, TaintedString, string, string>
but expected one of: 
proc add(p: var MultipartData; name, content: string; filename: string = "";
        contentType: string = "")
  first type mismatch at position: 3
  required type for content: string
  but expression 'readFile(file)' is of type: TaintedString
proc add(p: var MultipartData; xs: MultipartEntries): MultipartData
  first type mismatch at position: 2
  required type for xs: MultipartEntries
  but expression 'name' is of type: string
12 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them

expression: add(p, name, readFile(file), fName & ext, contentType)

Expected Output

[Valid compilation]

Possible Solution

httpclient needs to resolve tainted strings properly

Additional Information

$ nim -v
Nim Compiler Version 1.0.2 [Linux: amd64]
Compiled at 2019-10-22
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 193b3c66bbeffafaebff166d24b9866f1eaaac0e
active boot switches: -d:release
@Araq Araq added the Easy label Dec 3, 2019
zedeus added a commit to zedeus/Nim that referenced this issue Jan 5, 2020
zedeus added a commit to zedeus/Nim that referenced this issue Jan 6, 2020
@genotrance
Copy link
Contributor

This is broken in 1.0.6 but fixed in devel. Backport? @narimiran

zedeus added a commit to zedeus/Nim that referenced this issue Feb 26, 2020
@narimiran
Copy link
Member

This is broken in 1.0.6 but fixed in devel. Backport?

Sorry for the late response. It is this PR that fixed it in devel: #12969. I think we can backport it, so it becomes part of 1.0.8.

zedeus added a commit to zedeus/Nim that referenced this issue Mar 6, 2020
@dom96 dom96 closed this as completed in e056298 Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants