Skip to content

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Oct 1, 2025

@thaJeztah thaJeztah mentioned this pull request Oct 1, 2025
1 task
@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@thaJeztah
Copy link
Member Author

Nope, hack didn't make a difference; I'll drop that commit;

=== RUN   TestWinCredHelperRetrieveAliases
=== RUN   TestWinCredHelperRetrieveAliases/stored_with_port,_retrieved_without
    wincred_test.go:138: Error: failed to store secret for URL "https://foobar.docker.io:2376/": The stub received bad data.
=== RUN   TestWinCredHelperRetrieveAliases/stored_as_https,_retrieved_without_scheme
    wincred_test.go:138: Error: failed to store secret for URL "https://foobar.docker.io/": The stub received bad data.
=== RUN   TestWinCredHelperRetrieveAliases/stored_with_path,_retrieved_without
    wincred_test.go:138: Error: failed to store secret for URL "https://foobar.docker.io/one/two": The stub received bad data.
--- FAIL: TestWinCredHelperRetrieveAliases (0.00s)
    --- FAIL: TestWinCredHelperRetrieveAliases/stored_with_port,_retrieved_without (0.00s)
    --- FAIL: TestWinCredHelperRetrieveAliases/stored_as_https,_retrieved_without_scheme (0.00s)
    --- FAIL: TestWinCredHelperRetrieveAliases/stored_with_path,_retrieved_without (0.00s)
=== RUN   TestWinCredHelperRetrieveStrict
=== RUN   TestWinCredHelperRetrieveStrict/stored_as_https,_retrieved_using_http
    wincred_test.go:213: Error: failed to store secret for URL "https://foobar.docker.io:2376/": The stub received bad data.
=== RUN   TestWinCredHelperRetrieveStrict/stored_as_http,_retrieved_using_https
    wincred_test.go:213: Error: failed to store secret for URL "http://foobar.docker.io:2376/": The stub received bad data.
=== RUN   TestWinCredHelperRetrieveStrict/stored_as_http,_retrieved_without_scheme
    wincred_test.go:213: Error: failed to store secret for URL "http://foobar.docker.io/": The stub received bad data.
=== RUN   TestWinCredHelperRetrieveStrict/non-matching_ports
    wincred_test.go:213: Error: failed to store secret for URL "https://foobar.docker.io:1234/": The stub received bad data.
=== RUN   TestWinCredHelperRetrieveStrict/non-matching_paths
    wincred_test.go:213: Error: failed to store secret for URL "https://foobar.docker.io:1234/one/two": The stub received bad data.
--- FAIL: TestWinCredHelperRetrieveStrict (0.00s)
    --- FAIL: TestWinCredHelperRetrieveStrict/stored_as_https,_retrieved_using_http (0.00s)
    --- FAIL: TestWinCredHelperRetrieveStrict/stored_as_http,_retrieved_using_https (0.00s)
    --- FAIL: TestWinCredHelperRetrieveStrict/stored_as_http,_retrieved_without_scheme (0.00s)
    --- FAIL: TestWinCredHelperRetrieveStrict/non-matching_ports (0.00s)
    --- FAIL: TestWinCredHelperRetrieveStrict/non-matching_paths (0.00s)
=== RUN   TestWinCredHelperStoreRetrieve
=== RUN   TestWinCredHelperStoreRetrieve/foobar.docker.io
    wincred_test.go:269: Error: failed to store secret for URL: foobar.docker.io: The stub received bad data.
=== RUN   TestWinCredHelperStoreRetrieve/foobar.docker.io:2376
    wincred_test.go:269: Error: failed to store secret for URL: foobar.docker.io:2376: The stub received bad data.
=== RUN   TestWinCredHelperStoreRetrieve///foobar.docker.io:2376
    wincred_test.go:269: Error: failed to store secret for URL: //foobar.docker.io:2376: The stub received bad data.
=== RUN   TestWinCredHelperStoreRetrieve/https://foobar.docker.io:2376/
    wincred_test.go:269: Error: failed to store secret for URL: https://foobar.docker.io:2376: The stub received bad data.
=== RUN   TestWinCredHelperStoreRetrieve/http://foobar.docker.io:2376/
    wincred_test.go:269: Error: failed to store secret for URL: http://foobar.docker.io:2376: The stub received bad data.
=== RUN   TestWinCredHelperStoreRetrieve/https://foobar.docker.io:2376/some/path
    wincred_test.go:269: Error: failed to store secret for URL: https://foobar.docker.io:2376/some/path: The stub received bad data.
=== RUN   TestWinCredHelperStoreRetrieve/https://foobar.docker.io:2376/some/other/path
    wincred_test.go:269: Error: failed to store secret for URL: https://foobar.docker.io:2376/some/other/path: The stub received bad data.
=== RUN   TestWinCredHelperStoreRetrieve/https://foobar.docker.io:2376/some/other/path?foo=bar
    wincred_test.go:269: Error: failed to store secret for URL: https://foobar.docker.io:2376/some/other/path?foo=bar: The stub received bad data.

@thaJeztah
Copy link
Member Author

So for some reason it could be that the size of what's stored changed, and that we now hit the limits of the maximum. Previously, we hit this for long passwords / tokens, but now it gives the same problem for tests in this repo;

This is effectively where things go wrong, but not sure if the size constraint is just for the blob (g.CredentialBlob), or for the struct as a whole;

// Add adds new credentials to the windows credentials manager.
func (h Wincred) Add(creds *credentials.Credentials) error {
credsLabels := []byte(credentials.CredsLabel)
g := winc.NewGenericCredential(creds.ServerURL)
g.UserName = creds.Username
g.CredentialBlob = []byte(creds.Secret)
g.Persist = winc.PersistLocalMachine
g.Attributes = []winc.CredentialAttribute{{Keyword: "label", Value: credsLabels}}
return g.Write()
}

Comment on lines 29 to 34
out, err := json.Marshal(g)
if err != nil {
fmt.Println("Error:", err)
} else {
fmt.Println("GenericCredential:", string(out))
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for debugging; this is what's shown;

=== RUN   TestWinCredHelper
GenericCredential: {"TargetName":"https://foobar.docker.io:2376/v1","Comment":"","LastWritten":"0001-01-01T00:00:00Z","CredentialBlob":"Zm9vYmFyYmF6","Attributes":[{"Keyword":"label","Value":"RG9ja2VyIENyZWRlbnRpYWxz"}],"TargetAlias":"","UserName":"foobar","Persist":2}
    wincred_test.go:52: The stub received bad data.

Could it be something else, e.g. the LastWritten date not being accepted or something? (because it's a zero date)?

@thaJeztah
Copy link
Member Author

I opened a PR against danieljoos/wincred to see if CI would fail there as well, but .. it looks like tests are passing there;

But I did notice that those set the LastWritten field to time.Now() (where we leave it empty);
https://github.com/danieljoos/wincred/blob/28dd5b4a5c520aab6b6e5cd76ff0403d56138d5b/conversion_test.go#L17

This one's also interesting, because it doesn't fail with the same error, but DOES return a "The parameter is incorrect." error;

// recount for credentials
oldauths, err = helper.List()
if err != nil {
t.Fatal(err)
}
if err := helper.Add(creds); err != nil {
t.Fatal(err)
}

=== RUN   TestWinCredHelper
GenericCredential: {"TargetName":"https://foobar.docker.io:2376/v1","Comment":"","LastWritten":"0001-01-01T00:00:00Z","CredentialBlob":"Zm9vYmFyYmF6","Attributes":[{"Keyword":"label","Value":"RG9ja2VyIENyZWRlbnRpYWxz"}],"TargetAlias":"","UserName":"foobar","Persist":2}
sysCREDENTIAL:
 {"Flags":0,"Type":1,"TargetName":104,"Comment":0,"LastWritten":{"LowDateTime":3201347093,"HighDateTime":11290211},"CredentialBlobSize":9,"CredentialBlob":824633762576,"Persist":2,"AttributeCount":1,"Attributes":824633908264,"TargetAlias":0,"UserName":102}
    wincred_test.go:52: The parameter is incorrect.
--- FAIL: TestWinCredHelper (0.00s)

Here's what we try to write;

{"TargetName":"https://foobar.docker.io:2376/v1","Comment":"","LastWritten":"0001-01-01T00:00:00Z","CredentialBlob":"Zm9vYmFyYmF6","Attributes":[{"Keyword":"label","Value":"RG9ja2VyIENyZWRlbnRpYWxz"}],"TargetAlias":"","UserName":"foobar","Persist":2}

And the sysCREDENTIAL after converting in wincred;

 {"Flags":0,"Type":1,"TargetName":104,"Comment":0,"LastWritten":{"LowDateTime":3201347093,"HighDateTime":11290211},"CredentialBlobSize":9,"CredentialBlob":824633762576,"Persist":2,"AttributeCount":1,"Attributes":824633908264,"TargetAlias":0,"UserName":102}

Another one about "Parameter is incorrect";

=== RUN   TestWinCredHelperRetrieveAliases/stored_with_port,_retrieved_without
GenericCredential:
{"TargetName":"https://foobar.docker.io:2376","Comment":"","LastWritten":"0001-01-01T00:00:00Z","CredentialBlob":"d29ybGQ=","Attributes":[{"Keyword":"label","Value":"RG9ja2VyIENyZWRlbnRpYWxz"}],"TargetAlias":"","UserName":"hello","Persist":2}
sysCREDENTIAL:
 {"Flags":0,"Type":1,"TargetName":104,"Comment":0,"LastWritten":{"LowDateTime":3201347093,"HighDateTime":11290211},"CredentialBlobSize":5,"CredentialBlob":824633764264,"Persist":2,"AttributeCount":1,"Attributes":824634072424,"TargetAlias":0,"UserName":104}

    wincred_test.go:138: Error: failed to store secret for URL "https://foobar.docker.io:2376": The parameter is incorrect.

@thaJeztah
Copy link
Member Author

Oh! And I just realise that ALL tests now produce a The parameter is incorrect., and not the The stub received bad data. error 🤔

@thaJeztah thaJeztah force-pushed the bump_go1.25 branch 2 times, most recently from 7e0140e to 80a855b Compare October 1, 2025 23:06
Makefile Outdated
test:
mkdir -p $(COVERAGEDIR)
go test -short -v -coverprofile=$(COVERAGEDIR)/coverage.txt -covermode=atomic ./...
go test -gcflags=all=-d=variablemakehash=n -short -v -coverprofile=$(COVERAGEDIR)/coverage.txt -covermode=atomic ./...
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK; looks like I may have found some clues; it's go1.25 exposing bugs on how unsafe.Pointers are used; https://go.dev/doc/go1.25#faster-slices

Faster slices

The compiler can now allocate the backing store for slices on the stack in more situations, which improves performance. This change has the potential to amplify the effects of incorrect unsafe.Pointer usage, see for example issue 73199. In order to track down these problems, the bisect tool can be used to find the allocation causing trouble using the -compile=variablemake flag. All such new stack allocations can also be turned off using -gcflags=all=-d=variablemakehash=n.

@thaJeztah thaJeztah force-pushed the bump_go1.25 branch 2 times, most recently from 85d724f to b4688d2 Compare October 2, 2025 00:45
@thaJeztah thaJeztah force-pushed the bump_go1.25 branch 3 times, most recently from e61e1e5 to 071737d Compare October 2, 2025 19:42
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah marked this pull request as ready for review October 2, 2025 19:49
@thaJeztah
Copy link
Member Author

And .. the last one @crazy-max

@thaJeztah thaJeztah merged commit 84c3413 into docker:master Oct 2, 2025
12 checks passed
@thaJeztah thaJeztah deleted the bump_go1.25 branch October 2, 2025 19:54
@crazy-max
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants