Commit graph

36 commits

Author SHA1 Message Date
Ryan Dahl 9a8d6fbd98
DenoFlags -> Flags (#4136) 2020-02-26 11:52:15 +01:00
João Souto 5c1ab080cd
Remove ansi_term dependency (#4116) 2020-02-24 19:30:17 -05:00
Ryan Dahl 4005174f6c
Revert "Remove ansi_term dependency"
Broke colors
https://github.com/denoland/deno/issues/4112#issuecomment-590545385

This reverts commit c250778704.
2020-02-24 17:18:15 -05:00
João Souto c250778704
Remove ansi_term dependency (#4106) 2020-02-24 10:29:56 -05:00
Yoshiya Hinosawa c080d7fba3
fix: add mutex guard for permission_prompt tests (#4105)
This PR introduces the mutex guard for the test cases which depends on the 
permission prompt mocking utility. permission_request test cases depend on 
the mocked (dummy) value of the permission_prompt result. The value is stored 
at static STUB_PROMPT_VALUE: AtomicBool and these test cases share this 
value. So we should lock at the start of these test cases.

Before this change cargo test permission failed 6 times out of 20. After this 
change, 0 times out of 20 (on my mac).
2020-02-24 09:13:03 -05:00
Bartek Iwańczuk 4e1abb4f3a
refactor: use OpError instead of ErrBox for errors in ops (#4058)
To better reflect changes in error types in JS from #3662 this PR changes 
default error type used in ops from "ErrBox" to "OpError".

"OpError" is a type that can be sent over to JSON; it has all 
information needed to construct error in JavaScript. That
made "GetErrorKind" trait useless and so it was removed altogether.

To provide compatibility with previous use of "ErrBox" an implementation of
"From<ErrBox> for OpError" was added, however, it is an escape hatch and
ops implementors should strive to use "OpError" directly.
2020-02-23 14:51:29 -05:00
Kevin (Kun) "Kassimo" Qian e9fff02e96
fetch: proper error for unsupported protocol (#4085) 2020-02-23 09:45:02 -05:00
Nayeem Rahman 701ce9b334
refactor: Use PathBuf for paths in flag parsing and whitelists (#3955)
* Use PathBuf for DenoSubcommand::Bundle's out_file
* Use PathBuf for DenoSubcommand::Format's files
* Use PathBuf for DenoSubcommand::Install's dir
* Use PathBuf for read/write whitelists
2020-02-11 10:29:36 +01:00
Bartek Iwańczuk f32c31a0eb dx: descriptive permission errors (#3808)
Before:
```
▶ target/debug/deno https://deno.land/std/examples/echo_server.ts
error: Uncaught PermissionDenied: run again with the --allow-net flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendSync ($deno$/dispatch_json.ts:67:10)
    at listen ($deno$/net.ts:170:15)
    at https://deno.land/std/examples/echo_server.ts:4:23
```

```
▶ target/debug/deno --allow-read=/usr https://deno.land/std/examples/cat.ts /etc/passwd
error: Uncaught PermissionDenied: run again with the --allow-read flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
```

After:
```
▶ target/debug/deno https://deno.land/std/examples/echo_server.ts
error: Uncaught PermissionDenied: network access to "0.0.0.0:8080", run again with the --allow-net flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendSync ($deno$/dispatch_json.ts:67:10)
    at listen ($deno$/net.ts:170:15)
    at https://deno.land/std/examples/echo_server.ts:4:23
```

```
▶ target/debug/deno --allow-read=/usr https://deno.land/std/examples/cat.ts /etc/passwd
error: Uncaught PermissionDenied: read access to "/etc/passwd", run again with the --allow-read flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
```
2020-01-27 21:13:17 -05:00
Bartek Iwańczuk c90036ab88 refactor: reduce number of ErrorKind variants (#3662) 2020-01-20 10:50:16 -05:00
Nayeem Rahman 7f80f9db3f refactor: Improve path handling in permission checks (#3714) 2020-01-20 09:45:44 -05:00
Ry Dahl 76e44ddfd0
Rename crates: 'deno' to 'deno_core' and 'deno_cli' to 'deno' (#3600) 2020-01-05 11:56:18 -05:00
Ry Dahl bfab4ed0df
Happy new year! (#3578) 2020-01-02 15:13:47 -05:00
Axetroy 3bb15ceaea Upgrades rust to 1.40.0 (#3542) 2019-12-23 09:59:44 -05:00
Andy Finch 7c3b9b4f4f feat: first pass at native plugins (#3372) 2019-12-05 15:30:20 -05:00
Andy Finch 00844b4142 fix some typos in permissions (#3436) 2019-12-03 12:22:51 -05:00
Kevin (Kun) "Kassimo" Qian bca23e6433 refactor: Elevate DenoPermissions lock to top level (#3398) 2019-11-24 10:42:30 -05:00
Yoshiya Hinosawa 31115067cd Add permissions.request (#3296) 2019-11-11 10:33:29 -05:00
Bartek Iwańczuk 0049d4e50c Refactor Worker and ThreadSafeState (#3242)
* Split ThreadSafeState into State and GlobalState. State is a "local"
  state belonging to "Worker" while "GlobalState" is state shared by
  whole program.
* Update "Worker" and ops to use "GlobalState" where applicable
* Move and refactor "WorkerChannels" resource
2019-11-04 10:38:52 -05:00
Yoshiya Hinosawa efd7e78af3 Use web standard Permissions API (#3200) 2019-10-27 11:22:53 -04:00
EnokMan 7c60ab4664 refactor DenoPermissions.check_net & resolve_addr (#3182) 2019-10-23 10:19:26 -04:00
Yoshiya Hinosawa 2804ba8674 remove --no-prompt flag, fail on missing permissions (#3183) 2019-10-22 19:35:43 -04:00
Ryan Dahl 1f8b1a587c
Dynamic import should respect permissions (#2764) 2019-08-13 14:51:15 -04:00
Ryan Dahl 3971dcfe10
Use system rustfmt instead of fixed binary (#2701) 2019-07-31 17:11:37 -04:00
Bert Belder abe8a113ad Refactor error to use dynamic dispatch and traits
This is in preperation for dynamic import (#1789), which is more easily
implemented when errors are dynamic.
2019-07-11 14:37:00 -04:00
Ryan Dahl 3a4d88475b Port code from Cargo and use for progress
A lot of its functionality is unused still, but the goal it to slowly
migrate logging functionality to it. There is also a useful progress bar
which can be ported over later - it depends on this module.

4c1fa54d10/src/cargo/util/progress.rs
2019-06-25 06:32:28 -07:00
Ryan Dahl 046cbef4f0 simplify check_net test 2019-06-25 06:32:28 -07:00
Bartek Iwańczuk b9fbd55214 feat: log permission access (#2518)
Replaces -D/--log-debug flag with --log-level=debug

--log-level=info displays permission access
2019-06-22 09:02:51 -07:00
Kitson Kelly 425df50484 Combine CLI Errors (#2487) 2019-06-19 19:07:01 -07:00
Ryan Dahl 2952fb5405
Rename --allow-high-precision to --allow-hrtime (#2398) 2019-05-23 19:28:29 +03:00
Ryan Dahl aba952397a
Add progress bar (#2309) 2019-05-11 10:23:19 -04:00
andy finch 2edee3367d First pass at permissions whitelist (#2129) 2019-05-08 19:20:30 -04:00
Bert Belder 4ffe1612ff Silence clippy warnings and format source code 2019-04-09 20:05:47 +02:00
Vincent LE GOFF 734cf781c6 Allow high precision performance.now() (#1977) 2019-04-08 16:22:40 -04:00
Ryan Dahl 94405bb617
Fix clippy errors and upgrade Rust to 1.33.0 in CI (#1945) 2019-03-20 18:55:52 -04:00
Ryan Dahl fa3c35301a
Rename //src/ to //cli/ (#1962)
To better distinguish the deno_core crate from the executable deno,
which will now be called "the cli" internally.
2019-03-19 12:18:05 -04:00
Renamed from src/permissions.rs (Browse further)