Skip to content

Commit

Permalink
Merge pull request #1510 from safing/feature/ignore-default-icons
Browse files Browse the repository at this point in the history
Ignore default windows icons
  • Loading branch information
dhaavi authored Apr 18, 2024
2 parents f0bed8f + a223250 commit 6486ded
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/angular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
lint:
name: Linter
name: Lint
runs-on: ubuntu-latest
defaults:
run:
Expand Down Expand Up @@ -56,4 +56,4 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build angular projects
run: earthly --ci --remote-cache=ghcr.io/safing/build-cache --push +build-angular
run: earthly --ci --remote-cache=ghcr.io/safing/build-cache --push +angular-release
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: go vet ./...

test:
name: Test
name: Test & Build
runs-on: ubuntu-latest
steps:
- uses: earthly/actions-setup@v1
Expand All @@ -64,4 +64,4 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run Go Tests
run: earthly --ci --remote-cache=ghcr.io/safing/build-cache --push +test-go
run: earthly --ci --remote-cache=ghcr.io/safing/build-cache --push +go-ci
63 changes: 36 additions & 27 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ ARG --global outputDir = "./dist"
# to GOOS, GOARCH and GOARM when building go binaries. See the +RUST_TO_GO_ARCH_STRING
# helper method at the bottom of the file.


ARG --global architectures = "x86_64-unknown-linux-gnu" \
"aarch64-unknown-linux-gnu" \
"x86_64-pc-windows-gnu"

# Compile errors here:
# "armv7-unknown-linux-gnueabihf" \
# "arm-unknown-linux-gnueabi" \
# TODO: Compile errors here:
# "aarch64-pc-windows-gnu" \
# "x86_64-apple-darwin" \
# "aarch64-apple-darwin"
# "armv7-unknown-linux-gnueabihf" \
# "arm-unknown-linux-gnueabi"

# Import the earthly rust lib since it already provides some useful
# build-targets and methods to initialize the rust toolchain.
Expand Down Expand Up @@ -84,7 +85,7 @@ go-base:
SAVE IMAGE --cache-hint

# updates all go dependencies and runs go mod tidy, saving go.mod and go.sum locally.
update-go-deps:
go-update-deps:
FROM +go-base

RUN go get -u ./..
Expand All @@ -100,9 +101,9 @@ mod-tidy:
SAVE ARTIFACT go.mod AS LOCAL go.mod
SAVE ARTIFACT --if-exists go.sum AS LOCAL go.sum

# build-go runs 'go build ./cmds/...', saving artifacts locally.
# go-build runs 'go build ./cmds/...', saving artifacts locally.
# If --CMDS is not set, it defaults to building portmaster-start, portmaster-core and hub
build-go:
go-build:
FROM +go-base

# Arguments for cross-compilation.
Expand Down Expand Up @@ -136,10 +137,10 @@ build-go:

# Test one or more go packages.
# Test are always run as -short, as "long" tests require a full desktop system.
# Run `earthly +test-go` to test all packages
# Run `earthly +test-go --PKG="service/firewall"` to only test a specific package.
# Run `earthly +test-go --TESTFLAGS="-args arg1"` to add custom flags to go test (-args in this case)
test-go:
# Run `earthly +go-test` to test all packages
# Run `earthly +go-test --PKG="service/firewall"` to only test a specific package.
# Run `earthly +go-test --TESTFLAGS="-args arg1"` to add custom flags to go test (-args in this case)
go-test:
FROM +go-base

ARG GOOS=linux
Expand All @@ -155,16 +156,16 @@ test-go:
RUN --no-cache go test -cover -short ${pkg} ${TESTFLAGS}
END

test-go-all-platforms:
go-test-all:
FROM ${work_image}

FOR arch IN ${architectures}
DO +RUST_TO_GO_ARCH_STRING --rustTarget="${arch}"
BUILD +test-go --GOARCH="${GOARCH}" --GOOS="${GOOS}" --GOARM="${GOARM}"
BUILD +go-test --GOARCH="${GOARCH}" --GOOS="${GOOS}" --GOARM="${GOARM}"
END

# Builds portmaster-start, portmaster-core, hub and notifier for all supported platforms
build-go-release:
go-release:
FROM ${work_image}

FOR arch IN ${architectures}
Expand All @@ -178,14 +179,19 @@ build-go-release:
RUN echo "Failed to extract GOOS for ${arch}"; exit 1
END

BUILD +build-go --GOARCH="${GOARCH}" --GOOS="${GOOS}" --GOARM="${GOARM}"
BUILD +go-build --GOARCH="${GOARCH}" --GOOS="${GOOS}" --GOARM="${GOARM}"
END

# Builds all binaries from the cmds/ folder for linux/windows AMD64
# Most utility binaries are never needed on other platforms.
build-utils:
BUILD +build-go --CMDS="" --GOARCH=amd64 --GOOS=linux
BUILD +build-go --CMDS="" --GOARCH=amd64 --GOOS=windows
go-build-utils:
BUILD +go-build --CMDS="" --GOARCH=amd64 --GOOS=linux
BUILD +go-build --CMDS="" --GOARCH=amd64 --GOOS=windows

# All targets that should run in CI for go.
go-ci:
BUILD +go-release
BUILD +go-test

# Prepares the angular project by installing dependencies
angular-deps:
Expand Down Expand Up @@ -361,7 +367,7 @@ tauri-src:
# Explicitly cache here.
SAVE IMAGE --cache-hint

build-tauri:
tauri-build:
FROM +tauri-src

ARG --required target
Expand All @@ -383,7 +389,7 @@ build-tauri:
# the app. Make sure we copy portmaster-start and portmaster-core in all architectures supported.
# See documentation for externalBins for more information on how tauri searches for the binaries.

COPY (+build-go/output --GOOS="${GOOS}" --CMDS="portmaster-start portmaster-core" --GOARCH="${GOARCH}" --GOARM="${GOARM}") /tmp/gobuild
COPY (+go-build/output --GOOS="${GOOS}" --CMDS="portmaster-start portmaster-core" --GOARCH="${GOARCH}" --GOARM="${GOARM}") /tmp/gobuild

# Place them in the correct folder with the rust target tripple attached.
FOR bin IN $(ls /tmp/gobuild)
Expand Down Expand Up @@ -445,11 +451,11 @@ tauri-release:
ARG bundle="none"

FOR arch IN ${architectures}
BUILD +build-tauri --target="${arch}" --bundle="${bundle}"
BUILD +tauri-build --target="${arch}" --bundle="${bundle}"
END

build-all:
BUILD +build-go-release
build:
BUILD +go-release
BUILD +angular-release
BUILD +tauri-release

Expand Down Expand Up @@ -493,14 +499,17 @@ RUST_TO_GO_ARCH_STRING:
LET goos=""
IF [ -z "${rustTarget##*linux*}" ]
SET goos="linux"
ELSE
ELSE IF [ -z "${rustTarget##*windows*}" ]
SET goos="windows"
ELSE IF [ -z "${rustTarget##*darwin*}" ]
SET goos="darwin"
ELSE
RUN echo "GOOS not detected"; \
exit 1;
END


LET goarch=""
LET goarm=""

IF [ -z "${rustTarget##*x86_64*}" ]
SET goarch="amd64"
ELSE IF [ -z "${rustTarget##*arm*}" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface TagDescription {
}

export interface Icon {
Type: 'database' | 'path' | 'api';
Type: '' | 'database' | 'path' | 'api';
Source: '' | 'user' | 'import' | 'core' | 'ui';
Value: string;
}
Expand Down
52 changes: 37 additions & 15 deletions desktop/angular/src/app/shared/app-icon/app-icon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Min } from './../../../../dist-lib/safing/portmaster-api/lib/netquery.service.d';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Expand All @@ -19,10 +18,10 @@ import {
Record,
deepClone,

Check warning on line 19 in desktop/angular/src/app/shared/app-icon/app-icon.ts

View workflow job for this annotation

GitHub Actions / Lint

'deepClone' is defined but never used
} from '@safing/portmaster-api';
import { Subscription, map, of, throwError } from 'rxjs';
import { catchError, switchMap } from 'rxjs/operators';
import { INTEGRATION_SERVICE, ProcessInfo } from 'src/app/integration';
import { Subscription, map, of } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { AppIconResolver } from './app-icon-resolver';
import { AppProfile } from 'projects/safing/portmaster-api/src/public-api';

// Interface that must be satisfied for the profile-input
// of app-icon.
Expand All @@ -40,14 +39,23 @@ export interface IDandName {
// Some icons we don't want to show on the UI.
// Note that this works on a best effort basis and might
// start breaking with updates to the built-in icons...
const iconsToIngore = [
const iconBlobsToIgnore = [
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABU0lEQVRYhe2WTUrEQBCF36i4ctm4FsdTKF5AEFxL0knuILgQXAy4ELxDfgTXguAFRG/hDXKCAbtcOB3aSVenMjPRTb5NvdCE97oq3QQYGflnJ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Kt1tIAsObUAF195kZ2dO0cSsLx0EgAz6yWQO3aSGeZOJ8swS5gNj+c+AeYwE4QgxlPHF6nNzkBKpGQ4EGMAnSksOGCA41nisJP/eTfuVIjAHQRCCITiPaPjBAC0kwMKMkvW7vuJTgZQffSkOBRCLqeL0cN4PKLA6trah2/FGB97wL05oSohKCEEzMBSRkpp4gf+3d3dq+SOTIAZ4Enyz+QwjYgpkIB7wF6RIxGo8eAJTgsDOpB/jP+38TcKdstukjAxWQAAAABJRU5ErkJggg==',
];
const iconIDsToIgnore = [
"a27898ddfa4e0481b62c69faa196919a738fcade",
"5a3eea8bcd08b9336ce9c5083f26185164268ee9",
"573393d6ad238d255b20dc1c1b303c95debe6965",
"d459b2cb23c27cc31ccab5025533048d5d8301bf",
"d35a0d91ebfda81df5286f68ec5ddb1d6ad6b850",
"cc33187385498384f1b648e23be5ef1a2e9f5f71",
];


const profilesToIgnore = ['local/_unidentified', 'local/_unsolicited'];

Expand Down Expand Up @@ -86,7 +94,7 @@ export class AppIconComponent implements OnInit, OnDestroy {
this._profile = p || null;

if (this.initDone) {
this.updateView();
this.updateView(true);
}
}
get profile(): IDandName | null | undefined {
Expand All @@ -98,11 +106,11 @@ export class AppIconComponent implements OnInit, OnDestroy {
isIgnoredProfile = false;

/** If not icon is available, this holds the first - uppercased - letter of the app - name */
letter: string = '';
letter = '';

/** @private The background color of the component, based on icon availability and generated by ID */
@HostBinding('style.background-color')
color: string = 'var(--text-tertiary)';
color = 'var(--text-tertiary)';

constructor(
private profileService: AppProfileService,
Expand All @@ -125,7 +133,7 @@ export class AppIconComponent implements OnInit, OnDestroy {
}

this.requestedAnimationFrame = requestAnimationFrame(() => {
this.__updateView();
this.__updateView(skipIcon);
})
}

Expand Down Expand Up @@ -158,7 +166,7 @@ export class AppIconComponent implements OnInit, OnDestroy {
}

if (!skipIcon) {
this.tryGetSystemIcon(p);
this.tryGetSystemIcon();
}

} else {
Expand Down Expand Up @@ -195,7 +203,7 @@ export class AppIconComponent implements OnInit, OnDestroy {
return null;
}

let id = this.profile.ID;
const id = this.profile.ID;
if (!id) {
return null;
}
Expand All @@ -206,7 +214,7 @@ export class AppIconComponent implements OnInit, OnDestroy {
}

// otherwise, ID likely contains the source
let [source, ...rest] = id.split('/');
const [source, ...rest] = id.split('/');
if (rest.length > 0) {
return [source, rest.join('/')];
}
Expand All @@ -220,7 +228,7 @@ export class AppIconComponent implements OnInit, OnDestroy {
* Tries to get the application icon form the system.
* Requires the app to be running in the electron wrapper.
*/
private tryGetSystemIcon(p: IDandName) {
private tryGetSystemIcon() {
const sourceAndId = this.getIDAndSource();
if (sourceAndId === null) {
return;
Expand All @@ -231,7 +239,7 @@ export class AppIconComponent implements OnInit, OnDestroy {
this.sub = this.profileService
.watchAppProfile(sourceAndId[0], sourceAndId[1])
.pipe(
switchMap((profile) => {
switchMap((profile: AppProfile) => {
this.updateLetter(profile);

if (!!profile.Icons?.length) {

Check failure on line 245 in desktop/angular/src/app/shared/app-icon/app-icon.ts

View workflow job for this annotation

GitHub Actions / Lint

Redundant double negation
Expand All @@ -252,6 +260,14 @@ export class AppIconComponent implements OnInit, OnDestroy {
case 'api':
return of(`${this.httpAPI}/v1/profile/icon/${firstIcon.Value}`);

case 'path':
// TODO: Silently ignore for now.
return of('');

case '':
// Icon is not set.
return of('');

default:
console.error(`Icon type ${firstIcon.Type} not yet supported`);
}
Expand All @@ -266,7 +282,13 @@ export class AppIconComponent implements OnInit, OnDestroy {
)
.subscribe({
next: (icon) => {
if (iconsToIngore.some((i) => i === icon)) {
if (iconBlobsToIgnore.some((i) => i === icon)) {
icon = '';
} else if (iconIDsToIgnore.some((i) => icon.includes(i))) {
// TODO: This just checks if the value (blob, URL, etc.) contains
// the SHA1 sum of the icon, which is used in the URL of api icon types.
// This is very unlikely to have false positivies, but this could still
// be done a lot cleaner.
icon = '';
}
if (icon !== '') {
Expand Down
7 changes: 6 additions & 1 deletion service/firewall/packet_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,17 @@ func resetAllConnectionVerdicts() {
func resetConnectionVerdict(ctx context.Context, conn *network.Connection) (verdictChanged bool) {
tracer := log.Tracer(ctx)

// Remove any active prompt as we settings are being re-evaluated.
// Remove any active prompt as the settings are being re-evaluated.
conn.RemovePrompt()

conn.Lock()
defer conn.Unlock()

// Do not re-evaluate connection that have already ended.
if conn.Ended > 0 {
return false
}

// Update feature flags.
if err := conn.UpdateFeatures(); err != nil && !errors.Is(err, access.ErrNotLoggedIn) {
tracer.Warningf("filter: failed to update connection feature flags: %s", err)
Expand Down
7 changes: 6 additions & 1 deletion service/profile/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ func handleGetProfileIcon(ar *api.Request) (data []byte, err error) {

// Get profile icon.
data, err = binmeta.GetProfileIcon(name)
if err != nil {
switch {
case err == nil:
// Continue
case errors.Is(err, binmeta.ErrIconIgnored):
return nil, api.ErrorWithStatus(err, http.StatusNotFound)
default:
return nil, err
}

Expand Down
Loading

0 comments on commit 6486ded

Please sign in to comment.