### Motivation:
The CMake CI job in this repo is running using `swift:6.0-jammy`, and
installs CMake from the distro package manager. It doesn't get a very
new CMake and is blocking #140.
We are also missing coverage of our actual supported Swift versions
(currently 6.2 through 6.4).
### Modifications:
Run CMake CI job in a matrix by supported Swift version
### Result:
Replace the CMake CI job running on 6.0 image, with a matrix running on
6.2, 6.3, and 6.4 images.
Enable CMP0157 so Ninja compiles each Swift module in its own step,
separate from the link. Optimized configurations keep `-wmo`, as under
the old policy.
Tracking: swiftlang/swift#93995
assisted by Claude
Motivation
In #125 we attempted to apply a hardening fix that would avoid allowing
truncation of BER content by applying an end-of-contents octets at the
wrong parse depth to a higher-level object. This fix was incomplete.
Modifications
Re-write the code to handle the end-of-contents octets as part of the
loop instead of attempting to detect it after the fact. Add
defense-in-depth for unexpected nodes.
Results
More robust against issues with end-of-contents octets.
Replace repo-level CODE_OF_CONDUCT file with the inherited org-wide
[Code of
Conduct](https://github.com/apple/.github/blob/main/CODE_OF_CONDUCT.md)
in .github repo.
Co-authored-by: apple-ospo[bot] <326325757+apple-ospo[bot]@users.noreply.github.com>
### Motivation
We currently ignore unknown characters when parsing the body of a PEM
document. We should also validate whether the body forms a valid base64
encoded string.
### Modifications
- Repurposed the `checkLineLengthsOfBase64EncodedString()` method to
also return the base64 encoded bytes with the line endings removed.
- Updated `LazyPEMDocument` to now require base64 encoded bytes
_without_ line endings.
- Now that the input doesn't have any line endings, the presence of any
non-base64 characters must mean that the input has invalid characters.
- As such, `LazyPEMDocument/decode()` was updated to no longer pass the
[`.ignoreUnknownCharacters`](https://developer.apple.com/documentation/foundation/nsdata/base64decodingoptions/ignoreunknowncharacters)
option to `Data(base64Encoded:)`.
- This means that when the body contains non-base64 characters,
`Data(base64Encoded:)` returns `nil` (we already throw
`ASN1Error.invalidPEMDocument` when receiving `nil`).
### Result
Better validation.
Fixes#125
A truncated BER indefinite length constructed value was parsed as
success. The last child was popped and treated as the end of contents
marker, so that child disappeared.
The parser now throws truncatedASN1Field when input ends without those
octets, matching X.690 section 8.1.3.6.1.
## Test plan
Added testRejectsTruncatedBERIndefiniteLengthWithoutEndMarker. Built the
SwiftASN1 product. Full XCTest suite needs Xcode.
Co-authored-by: Cory Benfield <lukasa@apple.com>
Motivation:
Currently, positive signed integers whose minimal big-endian
representation exactly fills N bytes (`neededBits % 8 == 0`) have their
top bit misread as the DER sign bit. `Int64(128)` is therefore encoded
as `[0x80]` and decoded back as `-128`. We should fix this.
Modifications:
- Updated the `FixedWidthInteger.neededBytes` implementation to return
`bytes + 1` for positive signed integers in this case, causing
`IntegerBytesCollection` to emit the required `0x00` sign byte.
- Added associated test cases.
Result:
Positive signed integers whose minimal big-endian representation exactly
fills N bytes (`neededBits % 8 == 0`) are now encoded correctly.
Motivation
* The shared `macos_tests.yml` workflow no longer accepts
`xcode_16_2_build_arguments_override` and the `xcode_16_3` input is a
no-op. Passing the removed input causes CI to fail.
* Older Xcodes are being removed from the runners; Swift version inputs
are the replacement.
Modifications
* Replace `xcode_16_2/16_3_build_arguments_override` with
`swift_6_1/6_2/6_3_build_arguments_override` carrying the same
`-Xswiftc -Xfrontend -Xswiftc -require-explicit-sendable` value.
Result
* macOS CI passes again using the Swift version inputs.
## Summary
Fix typo in the internal parameter name of
`ASN1ObjectIdentifier.berEncoded(withIdentifier:)` initializer.
## Changes
- Rename parameter `identiifer` → `identifier` in
`ASN1ObjectIdentifier.berEncoded(withIdentifier:)`
(ObjectIdentifier.swift:133)
## Impact
- The typo only affected the internal parameter name (external label
`withIdentifier` was correct)
- No functional changes or breaking changes
- Improves code readability and maintainability
## Testing
- Existing tests continue to pass
- No behavioral changes
Motivation:
Swift 6.0 is no longer supported, we should bump the tools version and
remove it from our CI.
Modifications:
* Bump the Swift tools version to Swift 6.1
* Remove Swift 6.0 jobs where appropriate in main.yml, pull_request.yml
Result:
Code reflects our support window.
---------
Co-authored-by: George Barnett <gbarnett@apple.com>
Motivation:
Swift 6.3 has been released, we should add it to our CI coverage.
Modifications:
Add additional Swift 6.3 jobs where appropriate in main.yml,
pull_request.yml
Result:
Improved test coverage.
Motivation
* Following [GitHub's
announcement](https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/),
Node 20 is being deprecated and runners will begin using Node 24 by
default starting March 4th, 2026. Node 20 will reach end-of-life in
April 2026.
Modifications
* Upgrade GitHub Actions to their latest versions to ensure
compatibility with Node 24.
* Replace `actions/checkout@v4` with `actions/checkout@v6` in all
workflow files.
Result
* Workflow files reference `actions/checkout@v6`.
Added missing ASN1 type (ASN1VisibleString) with tests. Implementations
is heavily inspired by existing implementation of ASN1PrintableString.
Differs only in validation rules (_isValid method) and encoding
identifier (defaultIdentifier property).
---------
Co-authored-by: Cory Benfield <lukasa@apple.com>
Motivation
* `@main` references to `swiftlang/github-workflows` are deprecated.
Modifications
* Replace `@main` with `@0.0.7` in all workflow files.
Result
* Workflow files reference a pinned version of
`swiftlang/github-workflows`.
* Fixed#110 by using UTF-16 to encode the string literal
* Added a unit test to test the added functionality
Co-authored-by: Bram Kolkman <bramkolkman@thinkerium.com>
### Motivation:
Swift 5.10 is no longer supported, we should bump the swift-tools
version.
### Modifications:
* Update Swift tools version to 6.0
* Add `strictConcurrencyDevelopment` mode
### Result:
Code reflects our support window.
Motivation:
Swift 6.2 has been released, we should add it to our CI coverage.
Modifications:
Add additional Swift 6.2 jobs where appropriate in main.yml,
pull_request.yml
Result:
Improved test coverage.
### Motivation:
Some errors do not show up in debug builds. Enabling release mode builds
improves the CI coverage.
### Modifications:
Enable release mode builds for pull requests and scheduled builds on
main.
### Result:
Improved CI coverage.
Introduced -Xswiftc -Xfrontend flag to GA workflow. There were no
Sendability warnings to fix after this change.
---------
Co-authored-by: George Barnett <gbarnett@apple.com>
Clean up how the CMake build installs swiftmodules, using the full
module triple instead of just the architecture. This change uses the
compiler to compute the expected module triple instead of attempting to
compute it in CMake script. This is more maintainable and robust to
adding new platforms and architectures.
Motivation:
Swift 5.9 is no longer supported, we should bump the tools version and
remove it from our CI.
Modifications:
* Bump the Swift tools version to Swift 5.10
* Remove Swift 5.9 jobs where appropriate in main.yml, pull_request.yml
Result:
Code reflects our support window.
Motivation:
Swift 6.1 has been released, we should add it to our CI coverage.
Modifications:
Add additional Swift 6.1 jobs where appropriate in main.yml,
pull_request.yml
Result:
Improved test coverage.
Motivation:
* Improve test coverage
Modifications:
Enable macOS CI to be run on pull request commits and make the use of
the nightly runner pool for main.yml jobs explicit.
Result:
Improved test coverage.
Motivation:
* Improve test coverage
* Check test pass/fail status
* Monitor CI throughput
Modifications:
Enable macOS CI to be run on all merges to main and on a daily timer.
Result:
Improved test coverage run out-of-band at the moment so we can get a
feeling for if any changes need to be made in the repo or in the CI
pipelines to ensure timely and stable checks.
### Motivation:
We now have centrally-hosted CMake checks in the NIO repository which we
should use to reduce maintenance. The new checks also increase coverage
by performing a build with CMake as part of the checks.
### Modifications:
* Use the new workflow
* Commit formatting changes in the CMakeLists files from the new script
* Document how to update the CMakeLists files
* Remove the obsolete scripts
### Result:
Better CI coverage.
Following on from https://github.com/apple/swift-asn1/pull/92 delete
`Thresholds/nightly-6.1` which is no longer needed now that the shared
benchmarks workflow has been updated
* Throw error instead of halting when the encoding is invalid
Signed-off-by: Cory Benfield <lukasa@apple.com>
* Avoid extra precondition failure
---------
Signed-off-by: Cory Benfield <lukasa@apple.com>
Co-authored-by: Nicolas Bachschmidt <nicolas@nunk.net>
Enable MemberImportVisibility check on all targets. Use a standard
string header and footer to bracket the new block for ease of updating
in the future with scripts.
# Motivation
We want to make sure our packages build on all supported platforms.
# Modification
This PR enabled the Windows CI.
# Result
Better test coverage in our package.
Motivation:
Contributors list is nolonger being maintained
as it can be trivially derived from git history.
Modifications:
Remove script for updating contributors list.
Result:
One fewer script
CI: concurrency=complete require-explicit-sendable
Motivation:
Adopt `-Xswiftc -strict-concurrency=complete -Xswiftc
-require-explicit-sendable` in CI to lock-in concurrency-safety wins.
Modifications:
Added strict flags to pull request and scheduled GHA CI on Swift 6.0.
Result:
CI should ensure we don't regress data-race safety on Swift 6.0.
Motivation:
Now that we have cut over to GitHub Actions we can remove files
supporting the old workflow.
Modifications:
Remove docker and stubbed-out script files.
Result:
Nothing should change because GHA is now used as CI.
* Prepare repo for new GHA checks
Motivation:
Migrate to GitHub Actions reusable workflows (2)
Modifications:
* Add GHA PR label checks
* Add GHA benchmarks checks
* Satisfy soundness checks
Result:
New soundness checks should be green and ready for adoption
* review comments