Skip to content

Commit 6b0f149

Browse files
josecorellalucasmcdonald3
authored andcommitted
chore(verfication): remove {:only} (aws#517)
1 parent 197361f commit 6b0f149

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow checks if you are checking in dafny code
2+
# with the keyword {:only}, it adds a message to the pull
3+
# request to remind you to remove it.
4+
name: Check {:only} decorator presence
5+
6+
on:
7+
pull_request:
8+
9+
jobs:
10+
grep-only-verification-keyword:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Check only keyword
21+
id: only-keyword
22+
shell: bash
23+
run:
24+
# checking in code with the dafny decorator {:only}
25+
# will not verify the entire file or maybe the entire project depending on its configuration
26+
# This action checks if you are either adding or removing the {:only} decorator and posting on the pr if you are.
27+
echo "ONLY_KEYWORD=$(git diff origin/main origin/${GITHUB_HEAD_REF} **/*.dfy | grep -i {:only})" >> "$GITHUB_OUTPUT"
28+
29+
- name: Check if ONLY_KEYWORD is not empty
30+
id: comment
31+
env:
32+
PR_NUMBER: ${{ github.event.number }}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
ONLY_KEYWORD: ${{ steps.only-keyword.outputs.ONLY_KEYWORD }}
35+
if: ${{env.ONLY_KEYWORD != ''}}
36+
run: |
37+
COMMENT="It looks like you are adding or removing the dafny keyword {:only}.\nIs this intended?"
38+
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
39+
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"
40+
exit 1

AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Keyrings/AwsKms/AwsKmsEcdhKeyring.dfy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@ module {:options "/functionSyntax:4" } AwsKmsEcdhKeyring {
439439
{
440440
const materials: Materials.DecryptionMaterialsPendingPlaintextDataKey
441441
const cryptoPrimitives: Primitives.AtomicPrimitivesClient
442-
const senderPublicKey: seq<uint8>
443442
const recipientPublicKey: seq<uint8>
444443
const client: KMS.IKMSClient
445444
const grantTokens: KMS.GrantTokenList
@@ -582,6 +581,11 @@ module {:options "/functionSyntax:4" } AwsKmsEcdhKeyring {
582581
}
583582
}
584583

584+
:- Need(
585+
KMS.IsValid_PublicKeyType(sharedSecretPublicKey),
586+
E("Received Recipient Public Key of incorrect expected length")
587+
);
588+
585589
//= aws-encryption-sdk-specification/framework/aws-kms/aws-kms-ecdh-keyring.md#ondecrypt
586590
//# The keyring MUST derive the shared secret
587591
//# by calling [AWS KMS DeriveSharedSecret]()

AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Keyrings/RawECDHKeyring.dfy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ module {:options "/functionSyntax:4" } RawECDHKeyring {
541541
&& Materials.DecryptionMaterialsTransitionIsValid(materials, res.value)
542542

543543
}
544-
method {:vcs_split_on_every_assert} {:only} Invoke(
544+
method {:vcs_split_on_every_assert} Invoke(
545545
edk: Types.EncryptedDataKey,
546546
ghost attemptsState: seq<ActionInvoke<Types.EncryptedDataKey, Result<Materials.SealedDecryptionMaterials, Types.Error>>>
547547
) returns (res: Result<Materials.SealedDecryptionMaterials, Types.Error>)
@@ -851,4 +851,4 @@ module {:options "/functionSyntax:4" } RawECDHKeyring {
851851
function E(s : string) : Types.Error {
852852
Types.AwsCryptographicMaterialProvidersException(message := s)
853853
}
854-
}
854+
}

0 commit comments

Comments
 (0)