Compare commits

...

33 Commits

Author SHA1 Message Date
Prateek Sunal
a59ca2bdf0 fix(auth): also move the pacman build to artifacts 2024-06-22 23:32:54 +05:30
Neeraj Gupta
47ad7c7827 [auth] Update logs (#2258)
## Description

## Tests
2024-06-22 23:09:51 +05:30
Prateek Sunal
516c67e6e9 [FIX(auth)] Run pacman build on beta, fix deps (#2257)
## Description

- Only Build pacman for beta releases
- Fix dependencies
- Bump version
2024-06-22 23:06:49 +05:30
Prateek Sunal
e7970df6cf chore: bump version 2024-06-22 23:00:36 +05:30
Prateek Sunal
3ac4294c2c fix(auth): only run pacman build on beta, fix deps 2024-06-22 22:59:49 +05:30
Neeraj Gupta
c8451ecc64 [auth] Update logs 2024-06-22 22:47:38 +05:30
Prateek Sunal
f5a31397f3 chore(auth): bump to v3.0.16 2024-06-22 22:41:58 +05:30
Prateek Sunal
11b443a3f9 fix(auth): bundle metainfo linux 2024-06-22 22:41:58 +05:30
Manav Rathi
c95605127d [server] Allow replication without Cloudflare worker (#2254)
## Description
I recently started self hosting an instance of Ente. All went well until
I tried to enable replication.

This PR adds an option that allows replication to be enabled without a
Cloudflare worker, useful for self hosting.

## Tests
It doesn't look like there are any automated tests that I can add to,
but let me know if I'm wrong. Otherwise, I tested this on my own
instance and it's working as expected.
2024-06-22 22:35:31 +05:30
Neeraj Gupta
7bce4e25ae Update adding-icons.md 2024-06-22 22:34:30 +05:30
Victor Benincasa
19383ad360 Warning about icon sizes and instructions on matching the icon to the issuer. 2024-06-22 22:34:30 +05:30
Prateek Sunal
0b426fc1ab [FEAT] Auth goodies for linux (#2255)
## Description

- Pacman Build for Arch linux (Alpha)
- Add metainfo for linux
- Fix RPM build
2024-06-22 22:31:03 +05:30
Kermina Awad
81b07e772d make replication.worker-url optional 2024-06-22 12:49:35 -04:00
Prateek Sunal
65770ff58b fix(auth): update script for pacman 2024-06-22 22:13:15 +05:30
Prateek Sunal
bf926fe4b6 feat(auth): add appdata for ente_auth 2024-06-22 22:13:00 +05:30
Victor Benincasa
de36d1f9fb Additional optimizations in file size and icon quality. 2024-06-22 20:20:24 +05:30
Victor Benincasa
18fb24fcd2 Additional optimizations in file size and icon quality. 2024-06-22 20:19:23 +05:30
Manav Rathi
5687f75b0b [web] Fix for the staging deployment change (#2253)
Fix for https://github.com/ente-io/ente/pull/2252

> Error: An error occurred trying to start process '/usr/bin/bash' with
working
  directory '/home/runner/work/ente/ente/web'. No such file or directory
2024-06-22 18:58:39 +05:30
Manav Rathi
be82595e82 [web] Fix for the staging deployment change
Fix for https://github.com/ente-io/ente/pull/2252

> Error: An error occurred trying to start process '/usr/bin/bash' with working
  directory '/home/runner/work/ente/ente/web'. No such file or directory
2024-06-22 18:57:18 +05:30
Manav Rathi
d200bce7ea [web] Deploy to staging from staging/web branch if it exists (#2252)
This allows us to temporarily deploy arbitrary branches to staging by
pushing to a staging/web branch. Removing that branch reverts to the
existing and default behaviour of deploying main.

Untested (need to deploy and trigger)

Refs:

-
942f6a9fe9
-
https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context
-
https://stackoverflow.com/questions/57819539/github-actions-how-to-share-a-calculated-value-between-job-steps
2024-06-22 18:49:01 +05:30
Manav Rathi
05e490aa91 [web] Build the staging/web branch when deploying if it exists
This allows us to temporarily deploy arbitrary branches to staging by pushing to
a staging/web branch. Removing that branch reverts to the existing and default
behaviour of deploying main.

Untested (need to deploy and trigger)

Refs:

- 942f6a9fe9
- https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context
- https://stackoverflow.com/questions/57819539/github-actions-how-to-share-a-calculated-value-between-job-steps
2024-06-22 18:47:53 +05:30
Neeraj Gupta
32757c3fb6 [auth] Lint fix (#2248)
## Description

## Tests
2024-06-22 16:56:02 +05:30
Neeraj Gupta
411e444295 [auth] Lint fix 2024-06-22 16:54:58 +05:30
Neeraj Gupta
abca5bc798 [auth] Potential fix for invalid handshake error on Windows (#2247)
## Description

## Tests
2024-06-22 16:49:55 +05:30
Neeraj Gupta
8841dd44c4 Additional optimizations in file size and icon quality. (#2244) 2024-06-22 16:49:10 +05:30
Neeraj Gupta
316a5e7209 [auth] Bump version 2024-06-22 16:48:16 +05:30
Neeraj Gupta
2e53dcca00 Add logs 2024-06-22 16:47:53 +05:30
Manav Rathi
595d6f894e [accounts] Make it easier for self hosters to use passkeys (#2246)
Solves a problem someone was facing on our Discord:

https://discord.com/channels/948937918347608085/1215252276911018014/1253766354402545754
2024-06-22 11:38:23 +05:30
Manav Rathi
02a4e2b1ca [accounts] Make it easier for self hosters to use passkeys
Solves a problem someone was facing on our Discord:
https://discord.com/channels/948937918347608085/1215252276911018014/1253766354402545754
2024-06-22 11:30:20 +05:30
Victor Benincasa
e7b15b67d8 Additional optimizations in file size and icon quality. 2024-06-21 14:50:07 -03:00
Neeraj Gupta
662210b168 [auth] Potential fix for invalid handshake error 2024-06-21 13:35:50 +05:30
Prateek Sunal
077d509c23 feat(workflow/auth): update source of flutter_distributor 2024-06-18 00:58:58 +05:30
Prateek Sunal
062b3f7176 feat(auth/linux): add pacman build 2024-06-18 00:58:42 +05:30
17 changed files with 243 additions and 1576 deletions

View File

@@ -145,7 +145,7 @@ jobs:
- name: Install dependencies for desktop build
run: |
sudo apt-get update -y
sudo apt-get install -y libsecret-1-dev libsodium-dev libwebkit2gtk-4.0-dev libfuse2 ninja-build libgtk-3-dev dpkg-dev pkg-config rpm patchelf libsqlite3-dev locate libayatana-appindicator3-dev libffi-dev libtiff5
sudo apt-get install -y libsecret-1-dev libsodium-dev libwebkit2gtk-4.0-dev libfuse2 ninja-build libgtk-3-dev dpkg-dev pkg-config rpm patchelf libsqlite3-dev locate libayatana-appindicator3-dev libffi-dev libtiff5 xz-utils libarchive-tools
sudo updatedb --localpaths='/usr/lib/x86_64-linux-gnu'
- name: Install appimagetool
@@ -157,10 +157,16 @@ jobs:
- name: Build desktop app
run: |
flutter config --enable-linux-desktop
dart pub global activate flutter_distributor
# dart pub global activate flutter_distributor
dart pub global activate --source git https://github.com/prateekmedia/flutter_distributor --git-ref pacman --git-path packages/flutter_distributor
# Run below command if it is a beta or nightly
if [[ ${{ github.ref }} =~ beta|nightly ]]; then
flutter_distributor package --platform=linux --targets=pacman --skip-clean
mv dist/**/*-*-linux.pacman artifacts/ente-${{ github.ref_name }}-x86_64.pacman
fi
flutter_distributor package --platform=linux --targets=rpm --skip-clean
flutter_distributor package --platform=linux --targets=appimage --skip-clean
mv dist/**/*-*-linux.rpm artifacts/ente-${{ github.ref_name }}-x86_64.rpm
flutter_distributor package --platform=linux --targets=appimage --skip-clean
mv dist/**/*-*-linux.AppImage artifacts/ente-${{ github.ref_name }}-x86_64.AppImage
- name: Generate checksums

View File

@@ -1,5 +1,7 @@
name: "Deploy staging (web)"
# Builds the "staging/web" branch if it exists, "main" otherwise.
on:
schedule:
# Run everyday at ~3:00 PM IST
@@ -18,9 +20,20 @@ jobs:
working-directory: web
steps:
- name: Checkout code
- name: Determine branch to build
id: select-branch
working-directory: ${{ github.workspace }}
run: |
if git ls-remote --exit-code --heads https://github.com/ente-io/ente refs/heads/staging/web; then
echo "branch=staging/web" >> $GITHUB_OUTPUT
else
echo "branch=main" >> $GITHUB_OUTPUT
fi
- name: Checkout ${{ steps.select-branch.outputs.branch }}
uses: actions/checkout@v4
with:
ref: ${{ steps.select-branch.outputs.branch }}
submodules: recursive
- name: Setup node and enable yarn caching

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 386 KiB

After

Width:  |  Height:  |  Size: 316 B

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 959 B

View File

@@ -7,6 +7,15 @@ If you would like to add your own custom icon, please open a pull-request with
the relevant SVG placed within `assets/custom-icons/icons` and add the
corresponding entry within `assets/custom-icons/_data/custom-icons.json`.
Please be careful to upload small and optimized icon files. If your icon file
is over 50KB, it is likely not optimized.
Note that the correspondence between the icon and the issuer is based on the name
of the issuer provided by the user, excluding spaces. Only the text before the
first dot "." or left parentheses "(" will be used for icon matching.
e.g. Issuer name provided: "github.com (Main account)" - Then "github" will be
used for matching.
This JSON file contains the following attributes:
| Attribute | Usecase | Required |

View File

@@ -1,8 +1,10 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/core/event_bus.dart';
import 'package:ente_auth/core/win_http_client.dart';
import 'package:ente_auth/events/endpoint_updated_event.dart';
import 'package:ente_auth/utils/package_info_util.dart';
import 'package:ente_auth/utils/platform_util.dart';
@@ -50,6 +52,19 @@ class Network {
},
),
);
if (Platform.isWindows) {
final customHttpClient = windowsHttpClient();
_enteDio.httpClientAdapter = IOHttpClientAdapter(
createHttpClient: () {
return customHttpClient;
},
);
_dio.httpClientAdapter = IOHttpClientAdapter(
createHttpClient: () {
return customHttpClient;
},
);
}
_setupInterceptors(endpoint);
Bus.instance.on<EndpointUpdatedEvent>().listen((event) {

View File

@@ -0,0 +1,71 @@
import 'dart:convert';
import 'dart:io';
import 'package:logging/logging.dart';
/*
Reference from
https://github.com/realm/realm-dart/blob/main/packages/realm_dart/lib/src/handles/native/default_client.dart
https://github.com/realm/realm-dart/pull/1378
*/
HttpClient windowsHttpClient() {
final logger = Logger("WindowsHttpClient");
const isrgRootX1CertPEM = // The root certificate used by lets encrypt
'''
subject=CN=ISRG Root X1,O=Internet Security Research Group,C=US
issuer=CN=DST Root CA X3,O=Digital Signature Trust Co.
-----BEGIN CERTIFICATE-----
MIIFYDCCBEigAwIBAgIQQAF3ITfU6UK47naqPGQKtzANBgkqhkiG9w0BAQsFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTIxMDEyMDE5MTQwM1oXDTI0MDkzMDE4MTQwM1ow
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIE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ATAwMC4GCCsGAQUFBwIBFiJodHRwOi8vY3BzLnJvb3QteDEubGV0c2VuY3J5cHQu
b3JnMDwGA1UdHwQ1MDMwMaAvoC2GK2h0dHA6Ly9jcmwuaWRlbnRydXN0LmNvbS9E
U1RST09UQ0FYM0NSTC5jcmwwHQYDVR0OBBYEFHm0WeZ7tuXkAXOACIjIGlj26Ztu
MA0GCSqGSIb3DQEBCwUAA4IBAQAKcwBslm7/DlLQrt2M51oGrS+o44+/yQoDFVDC
5WxCu2+b9LRPwkSICHXM6webFGJueN7sJ7o5XPWioW5WlHAQU7G75K/QosMrAdSW
9MUgNTP52GE24HGNtLi1qoJFlcDyqSMo59ahy2cI2qBDLKobkx/J3vWraV0T9VuG
WCLKTVXkcGdtwlfFRjlBz4pYg1htmf5X6DYO8A4jqv2Il9DjXA6USbW1FzXSLr9O
he8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----''';
if (Platform.isWindows) {
final context = SecurityContext(withTrustedRoots: true);
try {
logger.info('Adding certificate to trusted certificates');
context.setTrustedCertificatesBytes(
const AsciiEncoder().convert(isrgRootX1CertPEM),
);
logger.info("Certificate added to trusted certificates");
return HttpClient(context: context);
} on TlsException catch (e) {
logger.warning(
"Error adding certificate to trusted certificates: ${e.osError?.message}",
);
// certificate is already trusted. Nothing to do here
if (e.osError?.message.contains("CERT_ALREADY_IN_HASH_TABLE") != true) {
rethrow;
} else {
return HttpClient();
}
}
}
throw UnsupportedError("This platform is not supported");
}

View File

@@ -1,6 +1,8 @@
display_name: Auth
license: GPLv3
metainfo: linux/packaging/ente_auth.appdata.xml
icon: assets/icons/auth-icon.png
keywords:

View File

@@ -10,6 +10,8 @@ license: GPLv3
icon: assets/icons/auth-icon.png
installed_size: 36000
metainfo: linux/packaging/ente_auth.appdata.xml
dependencies:
- libwebkit2gtk-4.0-37
- libsqlite3-0

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>ente_auth</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>AGPL-3.0</project_license>
<name>Ente Auth</name>
<summary>Open source 2FA authenticator, with end-to-end encrypted backups</summary>
<description>
<p>Auth provides end-to-end encrypted cloud backups so you don't have to worry about losing your tokens. Our cryptography has been externally audited.</p>
<p>Auth has an app for every platform. Mobile, desktop and web. Your codes sync across all your devices, end-to-end encrypted.</p>
<p>Auth also comes with Offline mode, tags, icons, pins, import/export and more</p>
</description>
<launchable type="desktop-id">ente_auth.desktop</launchable>
<url type="homepage">https://ente.io/auth</url>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/ente-io/ente/main/.github/assets/auth.png</image>
</screenshot>
</screenshots>
<releases>
<release version="3.0.12" date="2024-06-17"/>
</releases>
<provides>
<id>ente_auth.desktop</id>
</provides>
<content_rating type="oars-1.0" />
<developer id="io.github.ente-io.ente">
<name>Ente.io Developers</name>
</developer>
<update_contact>human@ente.io</update_contact>
</component>

View File

@@ -0,0 +1,58 @@
display_name: Auth
package_name: auth
maintainer:
name: Ente.io Developers
email: human@ente.io
licenses:
- GPLv3
icon: assets/icons/auth-icon.png
installed_size: 36000
metainfo: linux/packaging/ente_auth.appdata.xml
dependencies:
- c-ares
- ffmpeg
- gtk3
- http-parser
- libevent
- libvpx
- libxslt
- libxss
- minizip
- nss
- re2
- snappy
- libnotify
- libappindicator-gtk3
keywords:
- Authentication
- 2FA
generic_name: Ente Authentication
categories:
- Utility
supported_mime_type:
- x-scheme-handler/enteauth
postinstall_scripts:
- gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
- update-desktop-database -q
- if [ ! -e /usr/lib/libsodium.so.23 ]; then
- ln -s /usr/lib/libsodium.so /usr/lib/libsodium.so.23
- fi
postuninstall_scripts:
- post_install
postremove_scripts:
- gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
- update-desktop-database -q
- if [ -e /usr/lib/libsodium.so.23 ]; then
- rm /usr/lib/libsodium.so.23
- fi
startup_notify: false

View File

@@ -9,6 +9,8 @@ url: https://github.com/ente-io/ente
display_name: Auth
metainfo: linux/packaging/ente_auth.appdata.xml
requires:
- libsqlite3x
- webkit2gtk4.0

View File

@@ -1,6 +1,6 @@
name: ente_auth
description: ente two-factor authenticator
version: 3.0.14+314
version: 3.0.17+317
publish_to: none
environment:

View File

@@ -317,7 +317,7 @@ internal:
replication:
enabled: false
# The Cloudflare worker to use to download files from the primary hot
# bucket. Must be specified if replication is enabled.
# bucket. If this isn't specified, files will be downloaded directly.
worker-url:
# Number of go routines to spawn for replication
# This is not related to the worker-url above.

View File

@@ -87,10 +87,11 @@ func (c *ReplicationController3) StartReplication() error {
workerURL := viper.GetString("replication.worker-url")
if workerURL == "" {
return fmt.Errorf("replication.worker-url was not defined")
log.Infof("replication.worker-url was not defined, files will downloaded directly during replication")
} else {
log.Infof("Worker URL to download objects for replication v3 is: %s", workerURL)
}
c.workerURL = workerURL
log.Infof("Worker URL to download objects for replication v3 is: %s", workerURL)
c.createMetrics()
err := c.createTemporaryStorage()
@@ -414,7 +415,7 @@ func (c *ReplicationController3) downloadFromB2ViaWorker(objectKey string, file
q.Add("src", presignedEncodedURL)
request.URL.RawQuery = q.Encode()
if c.S3Config.AreLocalBuckets() {
if c.S3Config.AreLocalBuckets() || c.workerURL == "" {
originalURL := request.URL
request, err = http.NewRequest("GET", presignedURL, nil)
if err != nil {

View File

@@ -343,8 +343,18 @@ const authenticatorAttestationResponse = (credential: Credential) => {
* Return `true` if the given {@link redirectURL} (obtained from the redirect
* query parameter passed around during the passkey verification flow) is one of
* the whitelisted URLs that we allow redirecting to on success.
*
* This check is likely not necessary but we've only kept it just to be on the
* safer side. However, this gets in the way of people who are self hosting
* Ente. So only do this check if we're running on our production servers (or
* localhost).
*/
export const isWhitelistedRedirect = (redirectURL: URL) =>
shouldRestrictToWhitelistedRedirect()
? _isWhitelistedRedirect(redirectURL)
: true;
const _isWhitelistedRedirect = (redirectURL: URL) =>
(isDevBuild && redirectURL.hostname.endsWith("localhost")) ||
redirectURL.host.endsWith(".ente.io") ||
redirectURL.host.endsWith(".ente.sh") ||
@@ -352,6 +362,16 @@ export const isWhitelistedRedirect = (redirectURL: URL) =>
redirectURL.protocol == "enteauth:" ||
redirectURL.protocol == "ente-cli:";
export const shouldRestrictToWhitelistedRedirect = () => {
// host includes port, hostname is sans port
const hostname = new URL(window.location.origin).hostname;
return (
hostname.endsWith("localhost") ||
hostname.endsWith(".ente.io") ||
hostname.endsWith(".ente.sh")
);
};
export interface BeginPasskeyAuthenticationResponse {
/**
* An identifier for this authentication ceremony / session.