Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion internal/application/sandbox_manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,10 @@ func newSandboxManifestTestRuntimeWithBudget(t *testing.T, ctx context.Context,
t.Fatal(err)
}
t.Cleanup(func() { _ = st.Close() })
root := t.TempDir()
root, err := filepath.EvalSymlinks(t.TempDir())
if err != nil {
t.Fatal(err)
}
if err := st.SaveWorkspace(ctx, store.WorkspaceRecord{
ID: "ws-sandbox", Name: "sandbox", RootPath: root,
}); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/browserruntime/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func browserIdentityFixture(t *testing.T, product BrowserProduct,
channel BrowserChannel,
) BrowserExecutableIdentity {
t.Helper()
root := t.TempDir()
root := directTestPath(t, t.TempDir())
spec := knownSpec(t, DiscoveryRootProgramFiles, product, channel)
path := filepath.Join(append([]string{root}, spec.Components...)...)
if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {
Expand Down
17 changes: 13 additions & 4 deletions internal/browserruntime/executable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func TestBrowserExecutableDiscoveryBindsFixedPEBytesWithoutPATHOrLaunch(t *testing.T) {
root := t.TempDir()
root := directTestPath(t, t.TempDir())
relative := filepath.Join("Google", "Chrome", "Application", "chrome.exe")
path := filepath.Join(root, relative)
if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {
Expand Down Expand Up @@ -60,7 +60,7 @@ func TestBrowserExecutableDiscoveryBindsFixedPEBytesWithoutPATHOrLaunch(t *testi
}

func TestBrowserExecutableDiscoveryRejectsRegistryEscapeAndUnsafeCandidate(t *testing.T) {
root := t.TempDir()
root := directTestPath(t, t.TempDir())
escape := browserExecutableSpec{
RootID: DiscoveryRootProgramFiles, Product: BrowserProductChrome,
Channel: BrowserChannelStable, Vendor: "Google",
Expand All @@ -86,7 +86,7 @@ func TestBrowserExecutableDiscoveryRejectsRegistryEscapeAndUnsafeCandidate(t *te
}

func TestBrowserExecutableIdentityRejectsTamperingAndByteDrift(t *testing.T) {
root := t.TempDir()
root := directTestPath(t, t.TempDir())
spec := knownSpec(t, DiscoveryRootProgramFiles, BrowserProductEdge,
BrowserChannelStable)
path := filepath.Join(append([]string{root}, spec.Components...)...)
Expand Down Expand Up @@ -131,7 +131,7 @@ func TestBrowserExecutableIdentityRejectsTamperingAndByteDrift(t *testing.T) {
}

func TestBrowserExecutableDiscoverySkipsMissingCandidatesAndDeduplicatesRoots(t *testing.T) {
root := t.TempDir()
root := directTestPath(t, t.TempDir())
spec := knownSpec(t, DiscoveryRootProgramFiles, BrowserProductChromium,
BrowserChannelStable)
identities, err := discoverBrowserExecutables([]DiscoveryRoot{
Expand Down Expand Up @@ -204,3 +204,12 @@ func minimalPEImage(t *testing.T, arch string) []byte {
binary.LittleEndian.PutUint16(raw[0x96:0x98], 0x0002)
return raw
}

func directTestPath(t *testing.T, path string) string {
t.Helper()
resolved, err := filepath.EvalSymlinks(path)
if err != nil {
t.Fatal(err)
}
return resolved
}
4 changes: 2 additions & 2 deletions internal/browserruntime/launch_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func browserLaunchFixture(t *testing.T) (SessionPlan, BrowserExecutableIdentity,
if err != nil {
t.Fatal(err)
}
root := t.TempDir()
root := directTestPath(t, t.TempDir())
spec := knownSpec(t, DiscoveryRootProgramFiles, BrowserProductChrome,
BrowserChannelStable)
path := filepath.Join(append([]string{root}, spec.Components...)...)
Expand Down Expand Up @@ -168,7 +168,7 @@ func browserLaunchFixture(t *testing.T) (SessionPlan, BrowserExecutableIdentity,
if err != nil {
t.Fatal(err)
}
profileRoot := filepath.Join(t.TempDir(), ProfileRuntimeRootName)
profileRoot := filepath.Join(directTestPath(t, t.TempDir()), ProfileRuntimeRootName)
ownership, err := BuildProfileOwnershipPlan(session, identity, profileRoot)
if err != nil {
t.Fatal(err)
Expand Down
4 changes: 2 additions & 2 deletions internal/browserruntime/production_runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func newLoopbackBrowserRuntimeFacts(t *testing.T) browserRuntimeFacts {
t.Fatal(err)
}
ownership, err := BuildProfileOwnershipPlan(session, identity,
filepath.Join(t.TempDir(), ProfileRuntimeRootName))
filepath.Join(directTestPath(t, t.TempDir()), ProfileRuntimeRootName))
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -154,7 +154,7 @@ func TestSafeWebAuthorizationRequiresRestrictedLiteralLoopbackAndRuntimeGates(t
t.Fatal(err)
}
publicOwnership, err := BuildProfileOwnershipPlan(publicSession, facts.identity,
filepath.Join(t.TempDir(), ProfileRuntimeRootName))
filepath.Join(directTestPath(t, t.TempDir()), ProfileRuntimeRootName))
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/browserruntime/profile_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func profileLifecycleFixture(t *testing.T) (SessionPlan, BrowserExecutableIdenti
ProfileOwnershipPlan, string,
) {
t.Helper()
installRoot := t.TempDir()
installRoot := directTestPath(t, t.TempDir())
spec := knownSpec(t, DiscoveryRootProgramFiles, BrowserProductEdge, BrowserChannelStable)
executablePath := filepath.Join(append([]string{installRoot}, spec.Components...)...)
if err := os.MkdirAll(filepath.Dir(executablePath), 0o700); err != nil {
Expand All @@ -253,7 +253,7 @@ func profileLifecycleFixture(t *testing.T) (SessionPlan, BrowserExecutableIdenti
if err != nil {
t.Fatal(err)
}
runtimeRoot := filepath.Join(t.TempDir(), ProfileRuntimeRootName)
runtimeRoot := filepath.Join(directTestPath(t, t.TempDir()), ProfileRuntimeRootName)
ownership, err := BuildProfileOwnershipPlan(session, identities[0], runtimeRoot)
if err != nil {
t.Fatal(err)
Expand Down
5 changes: 4 additions & 1 deletion internal/tools/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ func TestReadFileToolRedactsSecrets(t *testing.T) {
}

func TestWorkspaceFSResolveForWriteScopesExistingAndNewFiles(t *testing.T) {
parent := t.TempDir()
parent, err := filepath.EvalSymlinks(t.TempDir())
if err != nil {
t.Fatal(err)
}
root := filepath.Join(parent, "workspace")
if err := os.MkdirAll(filepath.Join(root, "scripts"), 0o755); err != nil {
t.Fatal(err)
Expand Down