{"id":21374851,"url":"https://github.com/banool/signal-take-home","last_synced_at":"2025-09-20T03:40:05.291Z","repository":{"id":90881439,"uuid":"369349798","full_name":"banool/signal-take-home","owner":"banool","description":"Code for the Signal take home project","archived":false,"fork":false,"pushed_at":"2021-05-20T23:03:35.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T14:15:31.898Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/banool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-20T22:08:51.000Z","updated_at":"2021-05-20T23:03:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec245c35-1213-4be3-8705-8838fdb8ae2d","html_url":"https://github.com/banool/signal-take-home","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/banool/signal-take-home","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Fsignal-take-home","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Fsignal-take-home/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Fsignal-take-home/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Fsignal-take-home/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/banool","download_url":"https://codeload.github.com/banool/signal-take-home/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Fsignal-take-home/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259774488,"owners_count":22909161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T08:45:47.617Z","updated_at":"2025-09-20T03:40:00.237Z","avatar_url":"https://github.com/banool.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Signal Take Home\n\n## Development\nYou should have the following available locally:\n- Cargo 1.52 (rustup is the easiest way to get this).\n\nYou should also make sure to source the environment containing the GIPHY API key and other secrets:\n```\nexport `cat .env | xargs`\n```\nThis is not checked in, but you can look at `.env.example` to see what it should look like.\n\nTo check the build as you develop, run this:\n```\ncargo check\n```\n\nTo run the server, try something like this:\n```\nRUST_LOG=debug cargo run -- --address 127.0.0.1 -p 8888 --allowed-providers api.giphy.com\n```\n\nTo make a valid query through the proxy, run the following:\n```\ncurl -x localhost:8888 \"https://api.giphy.com/v1/gifs/search?api_key=$giphy_api_key\u0026q=happy\u0026limit=1\" | jq .\n```\n\nTo test an invalid query, just this works (this sends a GET directly to the proxy, instead of a CONNECT through it for GIPHY):\n```\ncurl localhost:8888\n```\n\nYou can see a successful interaction here:\n```\n# Client makes request\ncurl -x localhost:8888 \"https://api.giphy.com/v1/gifs/search?api_key=$giphy_api_key\u0026q=happy\u0026limit=2\" | jq .\n\n# Server logs\n[2021-05-20T21:27:57Z INFO  signal_take_home] Listening on 127.0.0.1:8888\n[2021-05-20T21:27:58Z DEBUG signal_take_home] Client wrote 954 bytes and received 21946 bytes\n\n# Client response is too long but it is valid json from GIPHY\n```\n\nHere you can see the server performing correct validation on where the client is trying to connect:\n```\n# Client makes request to invalid URL\n$ curl -x localhost:8888 \"https://google.com/\"\ncurl: (56) Received HTTP code 400 from proxy after CONNECT\n\n# Server logs\n[2021-05-20T21:33:35Z WARN  signal_take_home] Rejected request for google.com which is not in the list of allowed providers\n```\n\n## Production\nBuild the image like this:\n```\ndocker build -t signal-take-home .\n```\n\nRun it like this:\n```\ndocker run -p 8888:8888 -it --init signal-take-home\n```\n\n## Deployment\n\nI have deployed this for real on my local server using Github Actions on this repo to get the image to build continuously and my existing automated server management setup at [banool/server-setup](https://github.com/banool/server-setup) (ansible, systemd, etc). See [this commit](https://github.com/banool/server-setup/commit/82ba95e514de34948245016bd74c4c8bf514cc23). I ran the following command to execute the setup:\n\n```\nansible-playbook -i hosts everything.yaml --extra-vars \"@vars.json\" --extra-vars='ansible_become_pass=\u003cfakepassword\u003e' --tags signal,nginx,https\n```\n\nThis just all runs on my own little friend at home, running CentOS 8.\n\nYou can query it for real like this:\n```\ncurl -x dport.me \"https://api.giphy.com/v1/gifs/search?api_key=$giphy_api_key\u0026q=happy\u0026limit=2\" | jq .\n```\n\n## Extension ideas\n\n- A neato extension to work on would be the padding stuff Signal does for real as described here: https://signal.org/blog/signal-and-giphy-update/. This isn't really in the domain of this proxy service however, but more on the client side, so it is a bit out of scope for here.\n- It'd be cool to try and spin up a bunch of these with Kubernetes or something similar. It'd be pretty straightforward since the service is stateless.\n- It'd be good to serve the actual functionality out of a specific endpoint and return a \"Sorry, you're looking in the wrong spot\" page for the root endpoint.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanool%2Fsignal-take-home","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbanool%2Fsignal-take-home","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanool%2Fsignal-take-home/lists"}