Skip to content

Commit

Permalink
Merge pull request #21 from contentstack/feat/CS-36095-ssl-pinning
Browse files Browse the repository at this point in the history
SSL pinning for host support added
  • Loading branch information
uttamukkoji authored Mar 30, 2023
2 parents 9dbbda1 + 1e16a9b commit eb81d48
Show file tree
Hide file tree
Showing 28 changed files with 217 additions and 148 deletions.
68 changes: 0 additions & 68 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/jira.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/sca-scan.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Version: 3.11.0
#### Date: Apr-04-2023

##### Enahancement:
- SSL pinning for CSURLSession using CSURLSessionDelegate

### Version: 3.10.1
#### Date: Nov-11-2022

Expand Down
4 changes: 2 additions & 2 deletions Contentstack.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Contentstack'
s.version = '3.10.1'
s.version = '3.11.0'
s.summary = 'Contentstack is a headless CMS with an API-first approach that puts content at the centre.'

s.description = <<-DESC
Expand All @@ -12,7 +12,7 @@ s.homepage = 'https://www.contentstack.com/'
s.license = { :type => 'Commercial',:text => 'See https://www.contentstack.com/'}
s.author = { 'Contentstack' => '[email protected]' }

s.source = { :git => 'https://github.com/contentstack/contentstack-ios.git', :tag => 'v3.10.1' }
s.source = { :git => 'https://github.com/contentstack/contentstack-ios.git', :tag => 'v3.11.0' }
s.social_media_url = 'https://twitter.com/Contentstack'

s.ios.deployment_target = '8.0'
Expand Down
4 changes: 4 additions & 0 deletions Contentstack.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
0F9C0FC6221ADAC90091205A /* SyncStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9C0FAD221ADAC90091205A /* SyncStack.h */; settings = {ATTRIBUTES = (Public, ); }; };
0F9C0FC7221ADAC90091205A /* Entry.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9C0FAE221ADAC90091205A /* Entry.h */; settings = {ATTRIBUTES = (Public, ); }; };
0F9C0FC8221ADAC90091205A /* NamespacedDependencies.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9C0FB0221ADAC90091205A /* NamespacedDependencies.h */; };
0FD6BAEF29CD6E73001A0930 /* CSURLSessionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD6BAEE29CD6E73001A0930 /* CSURLSessionDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
0FEAEF282361A18600985FF9 /* CSNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEAEF232361A18600985FF9 /* CSNetworking.h */; };
0FEAEF292361A18600985FF9 /* CSError.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEAEF242361A18600985FF9 /* CSError.h */; settings = {ATTRIBUTES = (Public, ); }; };
0FEAEF2A2361A18600985FF9 /* CSURLSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FEAEF252361A18600985FF9 /* CSURLSessionManager.m */; };
Expand Down Expand Up @@ -166,6 +167,7 @@
0F9C0FAD221ADAC90091205A /* SyncStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyncStack.h; sourceTree = "<group>"; };
0F9C0FAE221ADAC90091205A /* Entry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Entry.h; sourceTree = "<group>"; };
0F9C0FB0221ADAC90091205A /* NamespacedDependencies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NamespacedDependencies.h; sourceTree = "<group>"; };
0FD6BAEE29CD6E73001A0930 /* CSURLSessionDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSURLSessionDelegate.h; sourceTree = "<group>"; };
0FDC02D1254A9CFA005EDDE3 /* libContentstackUtils.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libContentstackUtils.a; sourceTree = BUILT_PRODUCTS_DIR; };
0FEAEF232361A18600985FF9 /* CSNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSNetworking.h; sourceTree = "<group>"; };
0FEAEF242361A18600985FF9 /* CSError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSError.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -307,6 +309,7 @@
0F9C0FA7221ADAC80091205A /* Stack.m */,
0F9C0FAD221ADAC90091205A /* SyncStack.h */,
0F9C0FA0221ADAC80091205A /* SyncStack.m */,
0FD6BAEE29CD6E73001A0930 /* CSURLSessionDelegate.h */,
0F9C0FAF221ADAC90091205A /* ThirdPartyNamespaceHeader */,
230B38C41C16E98B00444A14 /* Info.plist */,
);
Expand Down Expand Up @@ -507,6 +510,7 @@
230B39011C16EB8D00444A14 /* ISO8601DateFormatter.h in Headers */,
23A53F401E276C83001DBE35 /* CSIOInternalHeaders.h in Headers */,
0F9C0FB1221ADAC90091205A /* AssetLibrary.h in Headers */,
0FD6BAEF29CD6E73001A0930 /* CSURLSessionDelegate.h in Headers */,
0F9C0FB6221ADAC90091205A /* Config.h in Headers */,
0F9C0FC2221ADAC90091205A /* Query.h in Headers */,
0FEAEF292361A18600985FF9 /* CSError.h in Headers */,
Expand Down
16 changes: 16 additions & 0 deletions Contentstack/Asset.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,22 @@ BUILT_ASSUME_NONNULL_BEGIN
*/
- (void)removeHeaderForKey:(NSString *)headerKey;

/**
Include the metadata for getting metadata content for the asset.
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
Asset *asset = [stack asset];
[asset includeMetadata];
//Swift
var stack:Stack = Contentstack.stackWithAPIKey("API_KEY", accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
var asset:Asset = stack.asset()
asset.includeMetadata()
*/
-(void)includeMetadata;

/**
Retrieve the published content of the fallback locale entry if the entry is not localized in specified locale.
Expand Down
4 changes: 4 additions & 0 deletions Contentstack/Asset.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ -(void)includeFallback {
[self.postParamDictionary setObject:@"true" forKey:kCSIO_IncludeFallback];
}

-(void)includeMetadata {
[self.postParamDictionary setObject:@"true" forKey:kCSIO_IncludeMetadata];
}

-(void)includeBranch {
[self.postParamDictionary setObject:@"true" forKey:kCSIO_IncludeBranch];
}
Expand Down
12 changes: 12 additions & 0 deletions Contentstack/AssetLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ typedef NS_ENUM(NSUInteger, OrderBy) {
*/
-(void)includeFallback;

/**
Include the metadata for getting metadata content for the asset.
//Obj-C
[assetLib includeMetadata];
//Swift
assetLib.includeMetadata()
*/
-(void)includeMetadata;

/**
Retrieve the branch for the published content.
Expand Down
4 changes: 4 additions & 0 deletions Contentstack/AssetLibrary.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ -(void)includeFallback {
[self.postParamDictionary setObject:@"true" forKey:kCSIO_IncludeFallback];
}

-(void)includeMetadata {
[self.postParamDictionary setObject:@"true" forKey:kCSIO_IncludeMetadata];
}

-(void)includeBranch {
[self.postParamDictionary setObject:@"true" forKey:kCSIO_IncludeBranch];
}
Expand Down
28 changes: 28 additions & 0 deletions Contentstack/CSURLSessionDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// CSURLSessionDelegate.h
// Contentstack
//
// Created by Uttam Ukkoji on 24/03/23.
// Copyright © 2023 Contentstack. All rights reserved.
//

#ifndef CSURLSessionDelegate_h
#define CSURLSessionDelegate_h
#import <Foundation/NSURLRequest.h>

@class NSURLSession;
@class NSURLAuthenticationChallenge;

API_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0))
@protocol CSURLSessionDelegate <NSObject>
@optional

- (void)URLSession:(NSURLSession *_Nonnull)session didReceiveChallenge:(NSURLAuthenticationChallenge *_Nonnull)challenge
completionHandler:(void (NS_SWIFT_SENDABLE ^_Nonnull)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler;

- (void)URLSession:(NSURLSession *_Nonnull)session task:(NSURLSessionTask *_Nonnull)task
didReceiveChallenge:(NSURLAuthenticationChallenge *_Nonnull)challenge
completionHandler:(void (NS_SWIFT_SENDABLE ^_Nonnull)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler;

@end
#endif /* CSURLSessionDelegate_h */
16 changes: 16 additions & 0 deletions Contentstack/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import <Foundation/Foundation.h>
#import "ContentstackDefinitions.h"
#import "CSURLSessionDelegate.h"
@interface Config : NSObject

/**----------------------------------------------------------------------------------------
Expand Down Expand Up @@ -72,4 +73,19 @@
*/
@property (nonatomic, copy) NSString *branch;


/**
Branch id for the
//Obj-C
Config *config = [[Config alloc] init];
config.delegate = [[CSDelegate alloc] init];
//Swift
var config:Config = Config()
config.delegate = CSDelegate()
*/
@property (nullable, retain) id<CSURLSessionDelegate> delegate;

@end
1 change: 1 addition & 0 deletions Contentstack/Contentstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#import <Contentstack/QueryResult.h>
#import <Contentstack/Group.h>
#import <Contentstack/SyncStack.h>
#import <Contentstack/CSURLSessionDelegate.h>

@class Stack;

Expand Down
3 changes: 2 additions & 1 deletion Contentstack/ContentstackDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
typedef NS_ENUM(NSUInteger, ContentstackRegion){
US = 0,
EU,
AZURE_NA
AZURE_NA,
AZURE_EU
};

typedef NS_ENUM(NSUInteger, Language) {
Expand Down
16 changes: 14 additions & 2 deletions Contentstack/Entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,26 @@ BUILT_ASSUME_NONNULL_BEGIN
Retrieve the published content of the fallback locale entry if the entry is not localized in specified locale.
//Obj-C
[entryObj includeContentType];
[entryObj includeFallback];
//Swift
entryObj.includeContentType()
entryObj.includeFallback()
*/
-(void)includeFallback;

/**
Include the metadata for getting metadata content for the entry.
//Obj-C
[entryObj includeMetadata];
//Swift
entryObj.includeMetadata()
*/
-(void)includeMetadata;

/**
Retrieve the branch for the published content.
Expand Down
4 changes: 4 additions & 0 deletions Contentstack/Entry.m
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ -(void)includeFallback {
[self.postParamDictionary setObject:@"true" forKey:kCSIO_IncludeFallback];
}

-(void)includeMetadata {
[self.postParamDictionary setObject:@"true" forKey:kCSIO_IncludeMetadata];
}

-(void)includeBranch {
[self.postParamDictionary setObject:@"true" forKey:kCSIO_IncludeBranch];
}
Expand Down
11 changes: 11 additions & 0 deletions Contentstack/Query.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,17 @@ Provides only the number of entries with values matching the specified values fo
*/
-(void)includeFallback;

/**
Include the metadata for getting metadata content for the entry.
//Obj-C
[blogQuery includeMetadata];
//Swift
blogQuery.includeMetadata()
*/
-(void)includeMetadata;
/**
Retrieve the branch for the published content.
Expand Down
4 changes: 4 additions & 0 deletions Contentstack/Query.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ -(void)includeFallback {
[self.queryDictionary setObject:@"true" forKey:kCSIO_IncludeFallback];
}

-(void)includeMetadata {
[self.queryDictionary setObject:@"true" forKey:kCSIO_IncludeMetadata];
}

-(void)includeBranch {
[self.queryDictionary setObject:@"true" forKey:kCSIO_IncludeBranch];
}
Expand Down
2 changes: 1 addition & 1 deletion Contentstack/Stack.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ - (instancetype)initWithAPIKey:(NSString*)apiKey andaccessToken:(NSString *)acce
_apiKey = apiKey;
_accessToken = accessToken;

_network = [[CSIOCoreHTTPNetworking alloc] init];
_network = [[CSIOCoreHTTPNetworking alloc] initWithDelegate:_config.delegate];
_stackHeaders = [NSMutableDictionary dictionary];
ISO8601DateFormatter *formatter = [[ISO8601DateFormatter alloc]init];
_commonDateFormatter = formatter;
Expand Down
1 change: 1 addition & 0 deletions ContentstackInternal/CSIOConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ FOUNDATION_EXPORT NSString *const kCSIO_IncludeRefContentTypeUID;
FOUNDATION_EXPORT NSString *const kCSIO_IncludeCount;
FOUNDATION_EXPORT NSString *const kCSIO_IncludeUnpublished;
FOUNDATION_EXPORT NSString *const kCSIO_IncludeFallback;
FOUNDATION_EXPORT NSString *const kCSIO_IncludeMetadata;
FOUNDATION_EXPORT NSString *const kCSIO_IncludeBranch;
FOUNDATION_EXPORT NSString *const kCSIO_IncludeEmbeddedItems;
FOUNDATION_EXPORT NSString *const kCSIO_BeforeUID;
Expand Down
Loading

0 comments on commit eb81d48

Please sign in to comment.