Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods not implemented during master key rotation #8103

Closed
veochen-octopus opened this issue Mar 26, 2023 · 2 comments
Closed

Methods not implemented during master key rotation #8103

veochen-octopus opened this issue Mar 26, 2023 · 2 comments
Assignees
Labels
kind/bug This issue represents a verified problem we are committed to solving

Comments

@veochen-octopus
Copy link

Severity

Makes master key rotation unusable for some

Version

2022.4+

Latest Version

I could reproduce the problem in the latest build

What happened?

A code path contains an unimplemented method which fails during master key rotation on certain data types.

Reproduction

Should be able to repro with any blob data.

Error and Stacktrace

Error reading row 1, column 3. The method or operation is not implemented..
Compiled reader expression:
(DbDataReader reader, DocumentReaderContext context) =>
{
    Type deserializeAsType = Octopus.Core.Infrastructure.BlobStorage.BlobDocument
    context.Column = 0
    String temp0 = IIF(reader.IsDBNull(0), null, reader.GetString(0))
    context.Column = 1
    String temp1 = IIF(reader.IsDBNull(1), null, reader.GetString(1))
    context.Column = 2
    String temp2 = IIF(reader.IsDBNull(2), null, reader.GetString(2))
    context.Column = 3
    SensitiveByteArray temp3 = Convert(value(Octopus.Core.RelationalStorage.TypeHandlers.SensitiveByteArrayTypeHandler).ReadDatabase(reader, 3), SensitiveByteArray)
    context.Column = 4
    BlobDocument deserializedFromJson = context.DeserializeText(reader, 4, deserializeAsType)
    BlobDocument result = deserializedFromJson
    if (result != null)
    {
        result.Id = temp0
        result.ExtensionId = temp1
        result.BlobId = temp2
        result.Blob = temp3
    }
    result
}
Nevermore.ReaderException: Error reading row 1, column 3. The method or operation is not implemented..
Compiled reader expression:
(DbDataReader reader, DocumentReaderContext context) =>
{
    Type deserializeAsType = Octopus.Core.Infrastructure.BlobStorage.BlobDocument
    context.Column = 0
    String temp0 = IIF(reader.IsDBNull(0), null, reader.GetString(0))
    context.Column = 1
    String temp1 = IIF(reader.IsDBNull(1), null, reader.GetString(1))
    context.Column = 2
    String temp2 = IIF(reader.IsDBNull(2), null, reader.GetString(2))
    context.Column = 3
    SensitiveByteArray temp3 = Convert(value(Octopus.Core.RelationalStorage.TypeHandlers.SensitiveByteArrayTypeHandler).ReadDatabase(reader, 3), SensitiveByteArray)
    context.Column = 4
    BlobDocument deserializedFromJson = context.DeserializeText(reader, 4, deserializeAsType)
    BlobDocument result = deserializedFromJson
    if (result != null)
    {
        result.Id = temp0
        result.ExtensionId = temp1
        result.BlobId = temp2
        result.Blob = temp3
    }
    result
}
 ---> System.NotImplementedException: The method or operation is not implemented.
   at Octopus.Core.Features.MasterKey.RotateMasterKeyMasterKeyEncryption.ReadAsPlaintext(Stream ciphertext) in ./source/Octopus.Core/Features/MasterKey/RotateMasterKeyMasterKeyEncryption.cs:line 36
   at Octopus.Core.Security.MasterKey.MasterKeyEncryptionExtensionMethods.ToDecryptedBytes(IMasterKeyEncryption encryption, Stream encryptedStream) in ./source/Octopus.Core/Security/MasterKey/MasterKeyEncryptionExtensionMethods.cs:line 27
   at Octopus.Core.RelationalStorage.TypeHandlers.SensitiveByteArrayTypeHandler.ReadDatabase(DbDataReader reader, Int32 columnIndex) in ./source/Octopus.Core/RelationalStorage/TypeHandlers/SensitiveByteArrayTypeHandler.cs:line 38
   at lambda_method2603(Closure , DbDataReader , DocumentReaderContext )
   at Nevermore.Advanced.ReaderStrategies.Documents.DocumentReaderStrategy.<>c__DisplayClass4_1`1.<CreateReader>b__1(DbDataReader dbDataReader)
   --- End of inner exception stack trace ---
   at Nevermore.Advanced.ReaderStrategies.Documents.DocumentReaderStrategy.<>c__DisplayClass4_1`1.<CreateReader>b__1(DbDataReader dbDataReader)
   at Nevermore.Advanced.ReadTransaction.ProcessReaderAsync[TRecord](DbDataReader reader, PreparedCommand command, CancellationToken cancellationToken)+MoveNext()
   at Nevermore.Advanced.ReadTransaction.ProcessReaderAsync[TRecord](DbDataReader reader, PreparedCommand command, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
   at Nevermore.Advanced.ReadTransaction.<>c__DisplayClass101_0`1.<<StreamAsync>g__Execute|0>d.MoveNext()
--- End of stack trace from previous location ---
   at Nevermore.Advanced.ReadTransaction.<>c__DisplayClass101_0`1.<<StreamAsync>g__Execute|0>d.MoveNext()
--- End of stack trace from previous location ---
   at Nevermore.Advanced.ReadTransaction.<>c__DisplayClass101_0`1.<<StreamAsync>g__Execute|0>d.MoveNext()
--- End of stack trace from previous location ---
   at Nevermore.Advanced.ReadTransaction.<>c__DisplayClass101_0`1.<<StreamAsync>g__Execute|0>d.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
   at Nevermore.Advanced.ThreadSafeAsyncEnumerable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
   at Nevermore.Advanced.ThreadSafeAsyncEnumerable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
   at Nevermore.Advanced.ThreadSafeAsyncEnumerable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
   at System.Linq.AsyncEnumerable.<ForEachAwaitAsyncCore>g__Core|101_0[TSource](IAsyncEnumerable`1 source, Func`2 action, CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ForEach.cs:line 99
   at System.Linq.AsyncEnumerable.<ForEachAwaitAsyncCore>g__Core|101_0[TSource](IAsyncEnumerable`1 source, Func`2 action, CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ForEach.cs:line 99
   at Octopus.Core.Features.MasterKey.Actions.AbstractModelMasterKeyAction`2.Handle(Boolean rotate, IRawRelationalStore store, IEventStore eventStore, AbstractMasterKeyReport report, ILogger logger, CancellationToken cancellationToken) in ./source/Octopus.Core/Features/MasterKey/Actions/AbstractModelMasterKeyAction.cs:line 81
   at Octopus.Core.Features.MasterKey.Actions.AbstractModelMasterKeyAction`2.Rotate(IRawRelationalStore store, IEventStore eventStore, AbstractMasterKeyReport report, ILogger logger, CancellationToken cancellationToken) in ./source/Octopus.Core/Features/MasterKey/Actions/AbstractModelMasterKeyAction.cs:line 34
   at Octopus.Server.Commands.MasterKeyCommands.RotateMasterKeyCommand.Start() in ./source/Octopus.Server/Commands/MasterKeyCommands/RotateMasterKeyCommand.cs:line 128
   at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in ./source/Octopus.Shared/Startup/AbstractCommand.cs:line 101
   at Octopus.Shared.Startup.OctopusProgram.Start(ICommandRuntime commandRuntime) in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 504
   at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown) in ./source/Octopus.Shared/Startup/ConsoleHost.cs:line 34
   at Octopus.Shared.Startup.OctopusProgram.RunHost(ICommandHost host) in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 221
   at Octopus.Shared.Startup.OctopusProgram.Run() in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 167

More Information

No response

Workaround

No response

@veochen-octopus veochen-octopus added the kind/bug This issue represents a verified problem we are committed to solving label Mar 26, 2023
@veochen-octopus veochen-octopus self-assigned this Mar 26, 2023
@octoreleasebot
Copy link

Release Note: Fix blob error during master key rotation

@Octobob
Copy link
Member

Octobob commented May 19, 2023

🎉 The fix for this issue has been released in:

Release stream Release
2022.4 2022.4.8555
2023.1 2023.1.9780
2023.2 2023.2.4283
2023.3+ all releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This issue represents a verified problem we are committed to solving
Projects
None yet
Development

No branches or pull requests

3 participants