-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat(permission): support suffix wildcards in --allow-env
flag
#25255
Merged
bartlomieju
merged 37 commits into
denoland:main
from
yazan-abdalrahman:Enhance---allow-env-to-Support-Prefix,-Suffix,-and-Wildcard-Matching
Nov 20, 2024
Merged
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
085b111
Add wildcard support to --allow-env flag for environment variable pat…
yazan-abdalrahman 5e463d3
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 1dae2e4
fix, test
yazan-abdalrahman 849e194
Merge remote-tracking branch 'origin/Enhance---allow-env-to-Support-P…
yazan-abdalrahman 574f292
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 8ae53a6
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 7d0b807
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 32af9f7
New solution with support env.get and set
yazan-abdalrahman ac39fc9
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 8603674
fmt
yazan-abdalrahman 981a9ce
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman a7469b9
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 7a93a1a
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 8df48c3
fix
yazan-abdalrahman 7ed8376
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 4c31cdd
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman b5c8bb8
fix new solution
yazan-abdalrahman 24e2ac5
Merge remote-tracking branch 'origin/Enhance---allow-env-to-Support-P…
yazan-abdalrahman 3076ca9
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman e49e0ef
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 6a368f9
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman afff2c8
Merge branch 'refs/heads/main' into Enhance---allow-env-to-Support-Pr…
yazan-abdalrahman 22b568f
fmt
yazan-abdalrahman 6153314
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 9ef3509
Merge branch 'refs/heads/main' into Enhance---allow-env-to-Support-Pr…
yazan-abdalrahman c828c7c
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 525cdbc
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 63b3e22
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 37c49be
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
yazan-abdalrahman 372266b
wip
bartlomieju 600d042
Merge branch 'env_wildcard' into Enhance---allow-env-to-Support-Prefi…
bartlomieju 4b2b357
cleanup
bartlomieju 365525e
test for wildcards in workers
bartlomieju 6d12ba3
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
bartlomieju 522a4f3
move definition beside impl
dsherret 78d9617
allow doing a subset of a prefix when creating child perms
dsherret 0bc4cd7
Merge branch 'main' into Enhance---allow-env-to-Support-Prefix,-Suffi…
bartlomieju File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/specs/permission/process_env_permissions/__test__.jsonc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"tempDir": true, | ||
"tests": { | ||
"deno_env_wildcard_tests": { | ||
"envs": { | ||
"MYAPP_HELLO": "Hello\tworld,", | ||
"MYAPP_GOODBYE": "farewell", | ||
"OTHER_VAR": "ignore" | ||
}, | ||
"steps": [ | ||
{ | ||
"args": "run --allow-env=MYAPP_* main.js", | ||
"output": "Hello\tworld,\nfarewell\ndone\n" | ||
}, | ||
{ | ||
"args": "run --allow-env main.js", | ||
"output": "Hello\tworld,\nfarewell\ndone\n" | ||
}, | ||
{ | ||
"args": "run --allow-env=MYAPP_HELLO,MYAPP_GOODBYE,MYAPP_TEST,MYAPP_DONE main.js", | ||
"output": "Hello\tworld,\nfarewell\ndone\n" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
console.log(Deno.env.get("MYAPP_HELLO")); | ||
console.log(Deno.env.get("MYAPP_GOODBYE")); | ||
Deno.env.set("MYAPP_TEST", "done"); | ||
Deno.env.set("MYAPP_DONE", "done"); | ||
console.log(Deno.env.get("MYAPP_DONE")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"envs": { | ||
"DENO_HELLO": "hello", | ||
"DENO_BYE": "bye", | ||
"AWS_HELLO": "aws" | ||
}, | ||
"args": "run --allow-env --allow-read --unstable-worker-options main.js", | ||
"output": "main.out", | ||
"exitCode": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
console.log("main1", Deno.env.get("DENO_HELLO")); | ||
console.log("main2", Deno.env.get("DENO_BYE")); | ||
console.log("main3", Deno.env.get("AWS_HELLO")); | ||
|
||
new Worker(import.meta.resolve("./worker.js"), { | ||
type: "module", | ||
deno: { | ||
permissions: { | ||
env: ["DENO_*"], | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
main1 hello | ||
main2 bye | ||
main3 aws | ||
worker1 hello | ||
worker2 bye | ||
error: Uncaught (in worker "") (in promise) NotCapable: Requires env access to "AWS_HELLO", run again with the --allow-env flag | ||
console.log("worker3", Deno.env.get("AWS_HELLO")); | ||
^ | ||
[WILDCARD] | ||
error: Uncaught (in promise) Error: Unhandled error in child worker. | ||
[WILDCARD] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
console.log("worker1", Deno.env.get("DENO_HELLO")); | ||
console.log("worker2", Deno.env.get("DENO_BYE")); | ||
console.log("worker3", Deno.env.get("AWS_HELLO")); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review this one thoroughly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it (see the new test)