diff --git a/Cargo.lock b/Cargo.lock index 086afcbb..5353b67b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -632,6 +632,34 @@ dependencies = [ "subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "curl" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "curl-sys 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "curl-sys" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "debugid" version = "0.4.0" @@ -1190,6 +1218,17 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "libz-sys" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "linked-hash-map" version = "0.3.0" @@ -2000,6 +2039,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2013,6 +2053,7 @@ dependencies = [ "reqwest 0.9.20 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "sentry-types 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "uname 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2967,6 +3008,8 @@ dependencies = [ "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +"checksum curl 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)" = "06aa71e9208a54def20792d877bc663d6aae0732b9852e612c4a933177c31283" +"checksum curl-sys 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)" = "f71cd2dbddb49c744c1c9e0b96106f50a634e8759ec51bcd5399a578700a3ab3" "checksum debugid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "088c9627adec1e494ff9dea77377f1e69893023d631254a0ec68b16ee20be3e9" "checksum derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6d944ac6003ed268757ef1ee686753b57efc5fcf0ebe7b64c9fc81e7e32ff839" "checksum derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a141330240c921ec6d074a3e188a7c7ef95668bb95e7d44fa0e5778ec2a7afe" @@ -3029,6 +3072,7 @@ dependencies = [ "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" "checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" diff --git a/Cargo.toml b/Cargo.toml index 72d3222a..c06a16f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ num_cpus = "1.10" protobuf = "2.7.0" rand = "0.7" regex = "1.3" -sentry = "0.17.0" +sentry = { version = "0.17.0", features = ["with_curl_transport"] } serde = "1.0" serde_derive = "1.0" serde_json = { version = "1.0", features = ["arbitrary_precision"] } diff --git a/Dockerfile b/Dockerfile index fd4ac633..b19fb032 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN \ groupadd --gid 10001 app && \ useradd --uid 10001 --gid 10001 --home /app --create-home app && \ apt-get -q update && \ - apt-get -q install -y default-libmysqlclient-dev libssl-dev ca-certificates && \ + apt-get -q install -y default-libmysqlclient-dev libssl-dev ca-certificates libcurl4 && \ rm -rf /var/lib/apt/lists COPY --from=builder /app/bin /app/bin diff --git a/spanner-2019-10-01.ddl b/spanner-2019-10-01.ddl index 2a10e263..24a5a439 100644 --- a/spanner-2019-10-01.ddl +++ b/spanner-2019-10-01.ddl @@ -2,7 +2,7 @@ -- usually a UUID, so presuming a formatted form. -- fxa_kid: <`mono_num`>-<`client_state`> -- --- - mono_num: a monotonically increasing timestamp or generation number +-- - mono_num: a monotonically increasing timestamp or generation number -- in hex and padded to 13 digits, provided by the fxa server -- - client_state: the first 16 bytes of a SHA256 hash of the user's sync -- encryption key. @@ -11,17 +11,17 @@ -- ALSO, CONSOLE WANTS ONE SPACE BETWEEN DDL COMMANDS CREATE TABLE user_collections ( - fxa_uid STRING(36) NOT NULL, - fxa_kid STRING(48) NOT NULL, + fxa_uid STRING(MAX) NOT NULL, + fxa_kid STRING(MAX) NOT NULL, collection_id INT64 NOT NULL, modified TIMESTAMP NOT NULL, ) PRIMARY KEY(fxa_uid, fxa_kid, collection_id); CREATE TABLE bso ( - fxa_uid STRING(36) NOT NULL, - fxa_kid STRING(48) NOT NULL, + fxa_uid STRING(MAX) NOT NULL, + fxa_kid STRING(MAX) NOT NULL, collection_id INT64 NOT NULL, - id STRING(64) NOT NULL, + id STRING(64) NOT NULL, sortindex INT64, payload STRING(MAX) NOT NULL, modified TIMESTAMP NOT NULL, @@ -38,15 +38,30 @@ INTERLEAVE IN user_collections; CREATE TABLE collections ( id INT64 NOT NULL, - name STRING(32) NOT NULL, + name STRING(32) NOT NULL, ) PRIMARY KEY(id); CREATE UNIQUE INDEX CollectionName ON collections(name); +INSERT INTO collections (id, name) VALUES + ( 1, "clients"), + ( 2, "crypto"), + ( 3, "forms"), + ( 4, "history"), + ( 5, "keys"), + ( 6, "meta"), + ( 7, "bookmarks"), + ( 8, "prefs"), + ( 9, "tabs"), + (10, "passwords"), + (11, "addons"), + (12, "addresses"), + (13, "creditcards"); + CREATE TABLE batches ( - fxa_uid STRING(36) NOT NULL, - fxa_kid STRING(48) NOT NULL, + fxa_uid STRING(MAX) NOT NULL, + fxa_kid STRING(MAX) NOT NULL, id TIMESTAMP NOT NULL, collection_id INT64 NOT NULL, bsos STRING(MAX) NOT NULL, diff --git a/src/main.rs b/src/main.rs index 84ee4e61..7d6b5e25 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,8 +23,17 @@ struct Args { fn main() -> Result<(), Box> { env_logger::init(); debug!("Starting up..."); - // Set SENTRY_DSN environment variable to enable Sentry - let sentry = sentry::init(sentry::ClientOptions::default()); + // Set SENTRY_DSN environment variable to enable Sentry. + // Avoid its default reqwest transport for now due to issues w/ + // likely grpcio's boringssl + let curl_transport_factory = |options: &sentry::ClientOptions| { + Box::new(sentry::transports::CurlHttpTransport::new(options)) + as Box + }; + let sentry = sentry::init(sentry::ClientOptions { + transport: Box::new(curl_transport_factory), + ..sentry::ClientOptions::default() + }); if sentry.is_enabled() { sentry::integrations::panic::register_panic_handler(); }