-
Notifications
You must be signed in to change notification settings - Fork 24
Localstack support for running locally #245
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -274,9 +274,9 @@ func UpdateExtensions(w http.ResponseWriter, r *http.Request) { | |
| host = "update.googleapis.com" | ||
| } | ||
| if jsonRequest { | ||
| http.Redirect(w, r, "https://"+host+"/service/update2/json"+queryString, http.StatusTemporaryRedirect) | ||
| http.Redirect(w, r, extension.ConstructURL(host, "/service/update2/json"+queryString), http.StatusTemporaryRedirect) | ||
| } else { | ||
| http.Redirect(w, r, "https://"+host+"/service/update2"+queryString, http.StatusTemporaryRedirect) | ||
| http.Redirect(w, r, extension.ConstructURL(host, "/service/update2"+queryString), http.StatusTemporaryRedirect) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reported by reviewdog 🐶 |
||
| } | ||
| return | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| networks: | ||
| main: | ||
|
|
||
| services: | ||
| localstack: | ||
| image: localstack/localstack | ||
| ports: | ||
| - "127.0.0.1:4566:4566" | ||
| - "127.0.0.1:4510-4559:4510-4559" | ||
| networks: | ||
| - main | ||
| volumes: | ||
| - ./misc/create_in_localstack.sh:/etc/localstack/init/ready.d/create.sh | ||
| app: | ||
| build: . | ||
| networks: | ||
| - main | ||
| environment: | ||
| DYNAMODB_ENDPOINT: http://localstack:4566 | ||
| AWS_REGION: us-west-2 | ||
| AWS_ACCESS_KEY_ID: test | ||
| AWS_SECRET_ACCESS_KEY: test | ||
| COMPONENT_UPDATER_HOST: http://localhost:8192 | ||
| S3_EXTENSIONS_BUCKET_HOST: http://localhost:4566/brave-core-ext | ||
| ENVIRONMENT: local | ||
| depends_on: | ||
| - localstack | ||
| restart: on-failure | ||
| ports: | ||
| - "127.0.0.1:8192:8192" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/sh | ||
|
|
||
| export AWS_DEFAULT_REGION=us-west-2 | ||
| export AWS_ACCESS_KEY_ID=test | ||
| export AWS_SECRET_ACCESS_KEY=test | ||
|
|
||
| awslocal dynamodb create-table \ | ||
| --table-name Extensions \ | ||
| --attribute-definitions AttributeName=ID,AttributeType=S \ | ||
| --key-schema AttributeName=ID,KeyType=HASH \ | ||
| --provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=10 || true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we (optionally) add some example data?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking that simply invoking the brave-core-crx-packager would be sufficient, rather than adding some insert commands and including a crx blob in the repo. thoughts?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't include the crx blob itself, just the metadata in DDB for testing the API (since go-update doesn't handle the actual blobs). For a full test, the crx could still be built/uploaded separately.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this would allow the user to curl the API, but it wouldn't allow a user to test the solution e2e using the browser |
||
|
|
||
| awslocal s3 mb s3://brave-core-ext || true | ||
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.
reported by reviewdog 🐶
[semgrep] An HTTP redirect was found to be crafted from user-input
r. This can lead to open redirect vulnerabilities, potentially allowing attackers to redirect users to malicious web sites. It is recommend where possible to not allow user-input to craft the redirect URL. When user-input is necessary to craft the request, it is recommended to follow OWASP best practices to restrict the URL to domains in an allowlist.Source: https://semgrep.dev/r/go.lang.security.injection.open-redirect.open-redirect
Cc @thypon @kdenhartog
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.
seems like these 2 are concerns that need to be addressed.
Also, please encode the query params